Esempio n. 1
0
  protected void createFunctions(TypeInfoUtil typeInfoUtil, String bindingMode) {
    TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
    int cFuncs = typeAttr.cFuncs.intValue();
    for (int i = 0; i < cFuncs; i++) {
      // Get the function description
      FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(i);

      TlbAbstractMethod method = null;
      if (funcDesc.invkind.value == INVOKEKIND.INVOKE_FUNC.value) {
        if (this.isVTableMode()) {
          method = new TlbFunctionVTable(i, index, typeLibUtil, funcDesc, typeInfoUtil);
        } else {
          method = new TlbFunctionDispId(i, index, typeLibUtil, funcDesc, typeInfoUtil);
        }
      } else if (funcDesc.invkind.value == INVOKEKIND.INVOKE_PROPERTYGET.value) {
        method = new TlbPropertyGet(i, index, typeLibUtil, funcDesc, typeInfoUtil);
      } else if (funcDesc.invkind.value == INVOKEKIND.INVOKE_PROPERTYPUT.value) {
        method = new TlbPropertyPut(i, index, typeLibUtil, funcDesc, typeInfoUtil);
      } else if (funcDesc.invkind.value == INVOKEKIND.INVOKE_PROPERTYPUTREF.value) {
        method = new TlbPropertyPut(i, index, typeLibUtil, funcDesc, typeInfoUtil);
      }

      if (!isReservedMethod(method.getMethodName())) {
        this.content += method.getClassBuffer();

        if (i < cFuncs - 1) this.content += CR;
      }

      // Release our function description stuff
      typeInfoUtil.ReleaseFuncDesc(funcDesc);
    }
  }
Esempio n. 2
0
  /**
   * Instantiates a new tlb class.
   *
   * @param index the index
   * @param typeLibUtil the type lib util
   */
  public TlbCoClass(int index, String packagename, TypeLibUtil typeLibUtil, String bindingMode) {
    super(index, typeLibUtil, null);

    TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);

    TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
    String docString = typeLibDoc.getDocString();

    if (typeLibDoc.getName().length() > 0) this.name = typeLibDoc.getName();

    this.logInfo("Type of kind 'CoClass' found: " + this.name);

    this.createPackageName(packagename);
    this.createClassName(this.name);
    this.setFilename(this.name);

    String guidStr = this.typeLibUtil.getLibAttr().guid.toGuidString();
    int majorVerNum = this.typeLibUtil.getLibAttr().wMajorVerNum.intValue();
    int minorVerNum = this.typeLibUtil.getLibAttr().wMinorVerNum.intValue();
    String version = majorVerNum + "." + minorVerNum;
    String clsid = typeInfoUtil.getTypeAttr().guid.toGuidString();

    this.createJavaDocHeader(guidStr, version, docString);
    this.createCLSID(clsid);
    this.createCLSIDName(this.name);

    // Get the TypeAttributes
    TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
    int cImplTypes = typeAttr.cImplTypes.intValue();
    String interfaces = "";

    for (int i = 0; i < cImplTypes; i++) {
      HREFTYPE refTypeOfImplType = typeInfoUtil.getRefTypeOfImplType(i);
      ITypeInfo refTypeInfo = typeInfoUtil.getRefTypeInfo(refTypeOfImplType);
      TypeInfoUtil refTypeInfoUtil = new TypeInfoUtil(refTypeInfo);
      this.createFunctions(refTypeInfoUtil, bindingMode);
      TypeInfoDoc documentation = refTypeInfoUtil.getDocumentation(new MEMBERID(-1));
      interfaces += documentation.getName();

      if (i < cImplTypes - 1) interfaces += ", ";
    }

    this.createInterfaces(interfaces);
    this.createContent(this.content);
  }