|
@@ -69,6 +69,7 @@ type
|
|
procedure GetOptions(L: TStrings; Full: boolean); override;
|
|
procedure GetOptions(L: TStrings; Full: boolean); override;
|
|
function GetTypeName(const aTypeName: String; ForTypeDef: Boolean=False
|
|
function GetTypeName(const aTypeName: String; ForTypeDef: Boolean=False
|
|
): String; override;
|
|
): String; override;
|
|
|
|
+ function GetPasIntfName(Intf: TIDLDefinition): string;
|
|
function GetInterfaceDefHead(Intf: TIDLInterfaceDefinition): String;
|
|
function GetInterfaceDefHead(Intf: TIDLInterfaceDefinition): String;
|
|
override;
|
|
override;
|
|
function WriteOtherImplicitTypes(Intf: TIDLInterfaceDefinition; aMemberList: TIDLDefinitionList): Integer;
|
|
function WriteOtherImplicitTypes(Intf: TIDLInterfaceDefinition; aMemberList: TIDLDefinitionList): Integer;
|
|
@@ -77,6 +78,8 @@ type
|
|
function WritePrivateGetters(aList: TIDLDefinitionList): Integer; override;
|
|
function WritePrivateGetters(aList: TIDLDefinitionList): Integer; override;
|
|
function WritePrivateSetters(aList: TIDLDefinitionList): Integer; override;
|
|
function WritePrivateSetters(aList: TIDLDefinitionList): Integer; override;
|
|
function WriteProperties(aList: TIDLDefinitionList): Integer; override;
|
|
function WriteProperties(aList: TIDLDefinitionList): Integer; override;
|
|
|
|
+ function WriteUtilityMethods(Intf: TIDLInterfaceDefinition): Integer;
|
|
|
|
+ override;
|
|
// Definitions. Return true if a definition was written.
|
|
// Definitions. Return true if a definition was written.
|
|
function WritePrivateGetter(Attr: TIDLAttributeDefinition): boolean; virtual;
|
|
function WritePrivateGetter(Attr: TIDLAttributeDefinition): boolean; virtual;
|
|
function WritePrivateSetter(Attr: TIDLAttributeDefinition): boolean; virtual;
|
|
function WritePrivateSetter(Attr: TIDLAttributeDefinition): boolean; virtual;
|
|
@@ -205,6 +208,11 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TWebIDLToPasWasmJob.GetPasIntfName(Intf: TIDLDefinition): string;
|
|
|
|
+begin
|
|
|
|
+ Result:=ClassToPasIntfName(GetName(Intf));
|
|
|
|
+end;
|
|
|
|
+
|
|
function TWebIDLToPasWasmJob.GetInterfaceDefHead(Intf: TIDLInterfaceDefinition
|
|
function TWebIDLToPasWasmJob.GetInterfaceDefHead(Intf: TIDLInterfaceDefinition
|
|
): String;
|
|
): String;
|
|
var
|
|
var
|
|
@@ -217,7 +225,7 @@ begin
|
|
aParentName:=GetTypeName(Intf.ParentName);
|
|
aParentName:=GetTypeName(Intf.ParentName);
|
|
if aParentName<>'' then
|
|
if aParentName<>'' then
|
|
Result:=Result+aParentName;
|
|
Result:=Result+aParentName;
|
|
- aPasIntfName:=ClassToPasIntfName(GetName(Intf));
|
|
|
|
|
|
+ aPasIntfName:=GetPasIntfName(Intf);
|
|
Result:=Result+','+aPasIntfName+')';
|
|
Result:=Result+','+aPasIntfName+')';
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -229,7 +237,7 @@ begin
|
|
Result:=1;
|
|
Result:=1;
|
|
|
|
|
|
// Pascal interface and ancestor
|
|
// Pascal interface and ancestor
|
|
- aPasIntfName:=ClassToPasIntfName(GetName(Intf));
|
|
|
|
|
|
+ aPasIntfName:=GetPasIntfName(Intf);
|
|
|
|
|
|
Decl:=aPasIntfName+' = interface';
|
|
Decl:=aPasIntfName+' = interface';
|
|
if Assigned(Intf.ParentInterface) then
|
|
if Assigned(Intf.ParentInterface) then
|
|
@@ -243,13 +251,22 @@ begin
|
|
end;
|
|
end;
|
|
AddLn(Decl);
|
|
AddLn(Decl);
|
|
|
|
|
|
-
|
|
|
|
Indent;
|
|
Indent;
|
|
|
|
+
|
|
|
|
+ // GUID
|
|
AddLn('['''+ComputeGUID(Decl,aMemberList)+''']');
|
|
AddLn('['''+ComputeGUID(Decl,aMemberList)+''']');
|
|
|
|
+
|
|
|
|
+ // private members
|
|
WritePrivateGetters(aMemberList);
|
|
WritePrivateGetters(aMemberList);
|
|
WritePrivateSetters(aMemberList);
|
|
WritePrivateSetters(aMemberList);
|
|
|
|
+
|
|
|
|
+ // type cast function Cast:
|
|
|
|
+ AddLn('Function Cast(Intf: IJSObject): '+aPasIntfName+';');
|
|
|
|
+
|
|
|
|
+ // public members
|
|
WriteMethodDefs(aMemberList);
|
|
WriteMethodDefs(aMemberList);
|
|
WriteProperties(aMemberList);
|
|
WriteProperties(aMemberList);
|
|
|
|
+
|
|
Undent;
|
|
Undent;
|
|
AddLn('end;');
|
|
AddLn('end;');
|
|
AddLn('');
|
|
AddLn('');
|
|
@@ -291,6 +308,22 @@ begin
|
|
inc(Result);
|
|
inc(Result);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TWebIDLToPasWasmJob.WriteUtilityMethods(Intf: TIDLInterfaceDefinition
|
|
|
|
+ ): Integer;
|
|
|
|
+var
|
|
|
|
+ aClassName, aPasIntfName, Code: String;
|
|
|
|
+begin
|
|
|
|
+ Result:=0;
|
|
|
|
+ aClassName:=GetName(Intf);
|
|
|
|
+ aPasIntfName:=GetPasIntfName(Intf);
|
|
|
|
+ AddLn('Function Cast(Intf: IJSObject): '+aPasIntfName+';');
|
|
|
|
+ Code:='Function '+aClassName+'.Cast(Intf: IJSObject): '+aPasIntfName+';'+sLineBreak;
|
|
|
|
+ Code:=Code+'begin'+sLineBreak;
|
|
|
|
+ Code:=Code+' Result:='+aClassName+'.CreateCast(Intf);'+sLineBreak;
|
|
|
|
+ Code:=Code+'end;'+sLineBreak;
|
|
|
|
+ IncludeImplementationCode.Add(Code);
|
|
|
|
+end;
|
|
|
|
+
|
|
function TWebIDLToPasWasmJob.WritePrivateGetter(Attr: TIDLAttributeDefinition
|
|
function TWebIDLToPasWasmJob.WritePrivateGetter(Attr: TIDLAttributeDefinition
|
|
): boolean;
|
|
): boolean;
|
|
var
|
|
var
|