LCL: TConfigMemStorage: using file version, externhelp: fixed incompatible fix

git-svn-id: trunk@30658 -
This commit is contained in:
mattias 2011-05-10 14:11:34 +00:00
parent fdc466d76d
commit 9f9ef2b6a7
4 changed files with 36 additions and 19 deletions

View File

@ -463,6 +463,7 @@ var
procedure InsertParam(Insertion: TChangeParamTransactionInsert;
FrontParam: TChangeParamTransactionPos);
{ Insert a new or moved parameter }
var
SrcParam: TChangeParamTransactionPos;
begin

View File

@ -2,13 +2,17 @@
<CONFIG>
<Package Version="3">
<Name Value="ExternHelp"/>
<AddToProjectUsesSection Value="False"/>
<Author Value="Mattias Gaertner"/>
<CompilerOptions>
<Version Value="9"/>
<Version Value="10"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
@ -44,42 +48,42 @@
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
<CustomOptions Children="ExternHelp">
<_ExternHelp Children="Count/Item1/Item2/Item3">
<CustomOptions Childs="ExternHelp">
<_ExternHelp Childs="Count/Item1/Item2/Item3">
<_Count Value="3"/>
<_Item1 Children="Filename/Name/URL">
<_Filename Children="Value">
<_Item1 Childs="Filename/Name/URL">
<_Filename Childs="Value">
<_Value Value="$(FPCSrcDir)/rtl/win32/windows.pp"/>
</_Filename>
<_Name Value="Windows"/>
<_URL Children="Value">
<_URL Childs="Value">
<_Value Value="http://social.msdn.microsoft.com/Search/en-us?query=$(Identifier)"/>
</_URL>
</_Item1>
<_Item2 Children="Filename/Name/URL">
<_Filename Children="Value">
<_Item2 Childs="Filename/Name/URL">
<_Filename Childs="Value">
<_Value Value="$(FPCSrcDir)/packages/postgres/src/"/>
</_Filename>
<_Name Value="PostgreSQL"/>
<_URL Children="Value">
<_URL Childs="Value">
<_Value Value="http://search.postgresql.org/search?q=$(Identifier)"/>
</_URL>
</_Item2>
<_Item3 Children="Filename/Name/URL/WithSubDirectories">
<_Filename Children="Value">
<_Item3 Childs="Filename/Name/URL/WithSubDirectories">
<_Filename Childs="Value">
<_Value Value="$(FPCSrcDir)/packages/gtk2/"/>
</_Filename>
<_Name Value="Gtk2"/>
<_URL Children="Value">
<_URL Childs="Value">
<_Value Value="http://www.google.com/custom?domains=library.gnome.org&amp;sitesearch=library.gnome.org&amp;q=$(Identifier)"/>
</_URL>
<_WithSubDirectories Children="Value">
<_WithSubDirectories Childs="Value">
<_Value Value="True"/>
</_WithSubDirectories>
</_Item3>

View File

@ -97,7 +97,7 @@ type
FURL: string;
FWithSubDirectories: boolean;
function GetChildCount: integer;
function GetChilds(Index: integer): TExternHelpItem;
function GetChildren(Index: integer): TExternHelpItem;
procedure SetFilename(const AValue: string);
procedure SetName(const AValue: string);
procedure SetStoreIn(const AValue: string);
@ -124,7 +124,7 @@ type
property URL: string read FURL write SetURL;
property StoreIn: string read FStoreIn write SetStoreIn;
property ChildCount: integer read GetChildCount;
property Children[Index: integer]: TExternHelpItem read GetChilds;
property Children[Index: integer]: TExternHelpItem read GetChildren;
property ChangeStep: integer read FChangeStep;
end;
@ -1206,7 +1206,7 @@ begin
Result:=fChilds.Count;
end;
function TExternHelpItem.GetChilds(Index: integer): TExternHelpItem;
function TExternHelpItem.GetChildren(Index: integer): TExternHelpItem;
begin
Result:=TExternHelpItem(fChilds[Index]);
end;

View File

@ -94,6 +94,9 @@ type
TConfigMemStorageModification = (cmsmSet, cmsmGet, cmsmDelete, cmsmDeleteValue);
const
ConfigMemStorageFormatVersion = 2; // change this when format changes
type
{ TConfigMemStorage }
TConfigMemStorage = class(TConfigStorage)
@ -637,15 +640,19 @@ procedure TConfigMemStorage.SaveToConfig(Config: TConfigStorage;
ChildNode:=Node.Children.FindSuccessor(ChildNode);
end;
end;
Config.SetDeleteValue(SubPath+'Children',Names,'');
Config.SetDeleteValue(SubPath+'Items',Names,'');
end;
begin
Save(Root,APath);
if (Root<>nil) and ((Root.Value<>'') or (Root.Children<>nil)) then
Config.SetValue(APath+'Version',ConfigMemStorageFormatVersion);
end;
procedure TConfigMemStorage.LoadFromConfig(Config: TConfigStorage;
const APath: string);
var
StorageVersion: LongInt;
procedure Load(Node: TConfigMemStorageNode; SubPath: string);
var
@ -659,7 +666,10 @@ procedure TConfigMemStorage.LoadFromConfig(Config: TConfigStorage;
if (Node<>Root) then
SubPath:=SubPath+'_'+Node.Name+'/';
Node.Value:=Config.GetValue(SubPath+'Value','');
ChildNames:=Config.GetValue(SubPath+'Children','');
if StorageVersion<2 then
ChildNames:=Config.GetValue(SubPath+'Childs','')
else
ChildNames:=Config.GetValue(SubPath+'Items','');
//DebugLn(['Load SubPath="',SubPath,'" Value="',Node.Value,'" ChildNames="',ChildNames,'"']);
if ChildNames<>'' then begin
p:=PChar(ChildNames);
@ -686,6 +696,8 @@ begin
Clear;
if Root=nil then
CreateRoot;
StorageVersion:=Config.GetValue(APath+'Version',0);
//debugln(['TConfigMemStorage.LoadFromConfig ',APath,' Version=',StorageVersion]);
Load(Root,APath);
end;