You've already forked lazarus-ccr
overloaded routines for testability
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@540 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -1425,7 +1425,8 @@ const
|
|||||||
FIELDS_STRING = '__FIELDS__';
|
FIELDS_STRING = '__FIELDS__';
|
||||||
|
|
||||||
function GetTypeRegistry():TTypeRegistry;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetTypeRegistry():TTypeRegistry;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure RegisterStdTypes();
|
procedure RegisterStdTypes();overload;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
procedure RegisterStdTypes(ARegistry : TTypeRegistry);overload;
|
||||||
procedure RegisterAttributeProperty(
|
procedure RegisterAttributeProperty(
|
||||||
const ATypeInfo : PTypeInfo; // must be tkClass or tkRecord
|
const ATypeInfo : PTypeInfo; // must be tkClass or tkRecord
|
||||||
const AProperty : shortstring
|
const AProperty : shortstring
|
||||||
@@ -1466,11 +1467,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterStdTypes();
|
procedure RegisterStdTypes();
|
||||||
|
begin
|
||||||
|
RegisterStdTypes(GetTypeRegistry());
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RegisterStdTypes(ARegistry : TTypeRegistry);
|
||||||
Var
|
Var
|
||||||
r : TTypeRegistry;
|
r : TTypeRegistry;
|
||||||
ri : TTypeRegistryItem;
|
ri : TTypeRegistryItem;
|
||||||
begin
|
begin
|
||||||
r := GetTypeRegistry();
|
r := ARegistry;
|
||||||
r.Register(sXSD_NS,TypeInfo(Integer),'int').AddPascalSynonym('Integer');
|
r.Register(sXSD_NS,TypeInfo(Integer),'int').AddPascalSynonym('Integer');
|
||||||
r.Register(sXSD_NS,TypeInfo(LongWord),'unsignedInt');
|
r.Register(sXSD_NS,TypeInfo(LongWord),'unsignedInt');
|
||||||
r.Register(sXSD_NS,TypeInfo(positiveInteger),'positiveInteger');
|
r.Register(sXSD_NS,TypeInfo(positiveInteger),'positiveInteger');
|
||||||
@@ -2947,22 +2953,20 @@ Var
|
|||||||
begin
|
begin
|
||||||
Result := Nil;
|
Result := Nil;
|
||||||
i := IndexOf(ATypeInfo);
|
i := IndexOf(ATypeInfo);
|
||||||
If ( i > -1 ) Then
|
if ( i > -1 ) then begin
|
||||||
Result := Item[i]
|
Result := Item[i]
|
||||||
Else If ( Not AExact ) And
|
end else if ( not AExact ) and Assigned(ATypeInfo) and ( ATypeInfo^.Kind = tkClass ) then begin
|
||||||
Assigned(ATypeInfo) And
|
|
||||||
( ATypeInfo^.Kind = tkClass )
|
|
||||||
Then Begin
|
|
||||||
searchClass := GetTypeData(ATypeInfo)^.ClassType;
|
searchClass := GetTypeData(ATypeInfo)^.ClassType;
|
||||||
For i := 0 To Pred(Count) Do Begin
|
for i := Pred(Count) downto 0 do begin
|
||||||
Result := Item[i];
|
Result := Item[i];
|
||||||
If ( Result.DataType^.Kind = tkClass ) And
|
if ( Result.DataType^.Kind = tkClass ) and
|
||||||
searchClass.InheritsFrom(GetTypeData(Result.DataType)^.ClassType)
|
searchClass.InheritsFrom(GetTypeData(Result.DataType)^.ClassType)
|
||||||
Then
|
then begin
|
||||||
Exit;
|
Exit;
|
||||||
End;
|
end;
|
||||||
|
end;
|
||||||
Result := Nil;
|
Result := Nil;
|
||||||
End;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTypeRegistry.Find(const APascalTypeName: string): TTypeRegistryItem;
|
function TTypeRegistry.Find(const APascalTypeName: string): TTypeRegistryItem;
|
||||||
|
@@ -68,6 +68,8 @@ type
|
|||||||
function wst_GetConfigObject() : TWstConfigurationObject;
|
function wst_GetConfigObject() : TWstConfigurationObject;
|
||||||
function wst_GetServiceConfig(const AName : string) : TwstConfigService ;
|
function wst_GetServiceConfig(const AName : string) : TwstConfigService ;
|
||||||
function wst_GetServiceConfigText(const AName : string) : string ;
|
function wst_GetServiceConfigText(const AName : string) : string ;
|
||||||
|
procedure wst_CreateDefaultFile();overload;
|
||||||
|
procedure wst_CreateDefaultFile(const AFileName : string);overload;
|
||||||
procedure wst_CreateDefaultFile(ADest : TStream; AConfigObj : TWstConfigurationObject);overload;
|
procedure wst_CreateDefaultFile(ADest : TStream; AConfigObj : TWstConfigurationObject);overload;
|
||||||
procedure wst_CreateDefaultFile(const AFileName : string; AConfigObj : TWstConfigurationObject);overload;
|
procedure wst_CreateDefaultFile(const AFileName : string; AConfigObj : TWstConfigurationObject);overload;
|
||||||
|
|
||||||
@@ -99,7 +101,11 @@ end;
|
|||||||
|
|
||||||
function wst_GetConfigFileName():string;
|
function wst_GetConfigFileName():string;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
Result := ChangeFileExt(ParamStr(0),'.' + sCONFIG_FILE_NAME);
|
||||||
|
{$ELSE}
|
||||||
Result := ChangeFileExt(GetAppConfigFile(False,True),'.' + sCONFIG_FILE_NAME);
|
Result := ChangeFileExt(GetAppConfigFile(False,True),'.' + sCONFIG_FILE_NAME);
|
||||||
|
{$ENDIF WINDOWS}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure wst_LoadConfigObject(AConfig: TWstConfigurationObject; AStream : TStream);overload;
|
procedure wst_LoadConfigObject(AConfig: TWstConfigurationObject; AStream : TStream);overload;
|
||||||
@@ -152,6 +158,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure wst_CreateDefaultFile();
|
||||||
|
begin
|
||||||
|
wst_CreateDefaultFile(wst_GetConfigFileName());
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure wst_CreateDefaultFile(const AFileName : string);
|
||||||
|
begin
|
||||||
|
wst_CreateDefaultFile(AFileName,nil);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure wst_CreateDefaultFile(ADest : TStream; AConfigObj : TWstConfigurationObject);overload;
|
procedure wst_CreateDefaultFile(ADest : TStream; AConfigObj : TWstConfigurationObject);overload;
|
||||||
var
|
var
|
||||||
locObj : TWstConfigurationObject;
|
locObj : TWstConfigurationObject;
|
||||||
|
@@ -109,7 +109,7 @@ type
|
|||||||
ADataType : PTypeInfo;
|
ADataType : PTypeInfo;
|
||||||
Const ADeclaredName : string = ''
|
Const ADeclaredName : string = ''
|
||||||
);override;
|
);override;
|
||||||
destructor Destroy();
|
destructor Destroy();override;
|
||||||
function GetSerializer() : TObjectSerializer;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetSerializer() : TObjectSerializer;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -66,7 +66,6 @@ Type
|
|||||||
ISavableSourceStream = Interface(ISourceStream)
|
ISavableSourceStream = Interface(ISourceStream)
|
||||||
['{B5F03006-FD33-4DA8-A2E7-168BDABE8832}']
|
['{B5F03006-FD33-4DA8-A2E7-168BDABE8832}']
|
||||||
procedure SaveToStream(AStream : TStream);
|
procedure SaveToStream(AStream : TStream);
|
||||||
procedure SaveToFile(const APath : string);
|
|
||||||
function GetStream(): TStream;
|
function GetStream(): TStream;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user