lazarus-ccr/components/cmdlinecfg/trunk/testuijson.lpr
skalogryz 6ee63d67b1 cmdlinecfg: the initial files commit
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2802 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2013-10-02 03:46:44 +00:00

42 lines
800 B
ObjectPascal

program testuijson;
{$mode delphi}{$H+}
uses
Classes, cmdlinecfgui, cmdlinecfguijson;
procedure DebugSection(sc: TLayoutSection);
var
i : Integer;
begin
if sc.Name<>'' then writeln(sc.Display, ' (', sc.Name,')');
for i:=0 to sc.ElemCount-1 do begin
if sc.Elements[i].ElementType=letSwitch then
writeln(' ', sc.Elements[i].Name)
else
DebugSection(sc.Elements[i]);
end;
end;
procedure TestUIConfFile(const fn: string);
var
layout : TCmdLineLayoutInfo;
begin
layout:=TCmdLineLayoutInfo.Create;
try
CmdLineUIJSONReadFile(fn, layout);
DebugSection(layout.GetSection(''));
finally
layout.Free;
end;
end;
begin
if ParamCount=0 then begin
writeln('Please specify UI configuration file');
Exit;
end;
TestUIConfFile(ParamStr(1));
end.