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