You've already forked lazarus-ccr
element/attribute form : specify options at registration optimization(to avoid double serializer initializations).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4230 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1707,11 +1707,17 @@ type
|
||||
procedure RegisterInitializer(AInitializer : TRemotableTypeInitializerClass);
|
||||
function IndexOf(Const ATypeInfo : PTypeInfo):Integer;
|
||||
function Add(AItem:TTypeRegistryItem):Integer;
|
||||
function Register(
|
||||
const ANameSpace : string;
|
||||
const ADataType : PTypeInfo;
|
||||
const ADeclaredName : string;
|
||||
const AOptions : TTypeRegistryItemOptions
|
||||
):TTypeRegistryItem;overload;
|
||||
function Register(
|
||||
Const ANameSpace : String;
|
||||
Const ADataType : PTypeInfo;
|
||||
Const ADeclaredName : String = ''
|
||||
):TTypeRegistryItem;
|
||||
):TTypeRegistryItem;overload;
|
||||
function Find(ATypeInfo : PTypeInfo; Const AExact : Boolean):TTypeRegistryItem;overload;
|
||||
function Find(const APascalTypeName : string):TTypeRegistryItem;overload;
|
||||
function FindByDeclaredName(
|
||||
@ -3444,7 +3450,7 @@ begin
|
||||
FInitializerList.Add(AInitializer);
|
||||
end;
|
||||
|
||||
function TTypeRegistry.IndexOf(Const ATypeInfo: PTypeInfo): Integer;
|
||||
function TTypeRegistry.IndexOf(const ATypeInfo: PTypeInfo): Integer;
|
||||
var
|
||||
i : Integer;
|
||||
begin
|
||||
@ -3471,9 +3477,10 @@ begin
|
||||
end;
|
||||
|
||||
function TTypeRegistry.Register(
|
||||
Const ANameSpace : String;
|
||||
Const ADataType : PTypeInfo;
|
||||
Const ADeclaredName : String = ''
|
||||
const ANameSpace : string;
|
||||
const ADataType : PTypeInfo;
|
||||
const ADeclaredName : string;
|
||||
const AOptions : TTypeRegistryItemOptions
|
||||
): TTypeRegistryItem;
|
||||
var
|
||||
i : Integer;
|
||||
@ -3482,6 +3489,7 @@ begin
|
||||
if ( i = -1 ) then begin
|
||||
Result := GetItemClassFor(ADataType).Create(Self,ANameSpace,ADataType,ADeclaredName);
|
||||
Add(Result);
|
||||
Result.FOptions := Result.FOptions + AOptions;
|
||||
Result.Init();
|
||||
{$IFDEF TRemotableTypeInitializer_Initialize}
|
||||
InitializeItem(Result);
|
||||
@ -3491,7 +3499,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TTypeRegistry.Find(ATypeInfo : PTypeInfo; Const AExact : Boolean):TTypeRegistryItem;
|
||||
function TTypeRegistry.Register(
|
||||
const ANameSpace : string;
|
||||
const ADataType : PTypeInfo;
|
||||
const ADeclaredName : string
|
||||
) : TTypeRegistryItem;
|
||||
begin
|
||||
Result := Register(ANameSpace,ADataType,ADeclaredName,[]);
|
||||
end;
|
||||
|
||||
function TTypeRegistry.Find(ATypeInfo: PTypeInfo; const AExact: Boolean
|
||||
): TTypeRegistryItem;
|
||||
Var
|
||||
i : Integer;
|
||||
searchClass : TClass;
|
||||
|
@ -2644,7 +2644,7 @@ var
|
||||
end;
|
||||
|
||||
var
|
||||
strBuffer : string;
|
||||
strBuffer, locFormOptionString : string;
|
||||
begin
|
||||
locParentIsEnum := False;
|
||||
locPropList := TObjectList.Create(False);
|
||||
@ -2660,15 +2660,18 @@ begin
|
||||
Indent(); WriteLn('end;');
|
||||
DecIndent();
|
||||
|
||||
if (FFormOptions <> '') then
|
||||
locFormOptionString := Format(',%s',[FFormOptions])
|
||||
else
|
||||
locFormOptionString := '';
|
||||
FImpTempStream.Indent();
|
||||
strBuffer := Format(
|
||||
'%s.Register(%s,TypeInfo(%s),%s)',
|
||||
'%s.Register(%s,TypeInfo(%s),%s%s);',
|
||||
[ sLOCAL_TYPE_REGISTER_REFERENCE,sNAME_SPACE,ASymbol.Name,
|
||||
QuotedStr(SymbolTable.GetExternalName(ASymbol))]
|
||||
QuotedStr(SymbolTable.GetExternalName(ASymbol)),
|
||||
locFormOptionString
|
||||
]
|
||||
);
|
||||
if (FFormOptions <> '') then
|
||||
strBuffer := Format('%s.AddOptions(%s)',[strBuffer,FFormOptions]);
|
||||
strBuffer := strBuffer + ';';
|
||||
FImpTempStream.WriteLn(strBuffer);
|
||||
|
||||
SetCurrentStream(FImpStream);
|
||||
|
Reference in New Issue
Block a user