Skip to content

Commit

Permalink
Version 0.65:
Browse files Browse the repository at this point in the history
1) Upgraded to Delphi 10 Seattle (SU1)
2) Using native THTTPClient for updates checks. So OpenSSL libs are no longer needed.
3) Improved Check for update algorithm while waiting for https://quality.embarcadero.com/browse/RSP-9466 to be resolved/implemented. Please, vote for this RSP! Thanks!
4) Added button and context menu entry that opens http://jsonlint.com/ for easy JSON verification
5) Bug fixes and improvements
  • Loading branch information
PKGeorgiev committed Feb 16, 2016
1 parent 02f44c0 commit 449cc95
Show file tree
Hide file tree
Showing 8 changed files with 2,321 additions and 1,777 deletions.
5 changes: 0 additions & 5 deletions JsonToDelphiClass.dpr
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
program JsonToDelphiClass;

uses
madExcept,
madLinkDisAsm,
madListHardware,
madListProcesses,
madListModules,
System.StartUpCopy,
FMX.Forms,
uMainForm in 'uMainForm.pas' {MainForm},
Expand Down
371 changes: 223 additions & 148 deletions JsonToDelphiClass.dproj

Large diffs are not rendered by default.

Binary file modified JsonToDelphiClass.res
Binary file not shown.
16 changes: 13 additions & 3 deletions Pkg.Json.Mapper.pas
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,19 @@ TStubClass = class
FParentClass: TStubClass;
FMapper: TPkgJsonMapper;
FPureClassName: string;
FArrayProperty: string;
procedure SortFields;
procedure SetName(const Value: string);
procedure SetPureClassName(const Value: string);
public
constructor Create(AParentClass: TStubClass; AClassName: string; AMapper: TPkgJsonMapper);
constructor Create(AParentClass: TStubClass; AClassName: string; AMapper: TPkgJsonMapper; AArrayProperty: string = '');
destructor Destroy; override;
property Name: string read FName write SetName;
property Items: TList<TStubField> read FItems write FItems;
function GetDeclarationPart: string;
function GetImplementationPart: string;
property PureClassName: string read FPureClassName write SetPureClassName;
property ArrayProperty: string read FArrayProperty write FArrayProperty;

end;

Expand Down Expand Up @@ -555,6 +557,7 @@ procedure TPkgJsonMapper.Parse(AJsonString: string; ARootClassName: string);
LClass := TStubClass.Create(FRootClass, 'Item', self);
end;

FRootClass.ArrayProperty := 'Items';
TStubArrayField.Create(FRootClass, 'Items', LJsonType, LClass);
ProcessJsonObject(LJsonValue2, LClass);
end;
Expand All @@ -571,7 +574,7 @@ procedure TPkgJsonMapper.Parse(AJsonString: string; ARootClassName: string);

{ TVirtualClass }

constructor TStubClass.Create(AParentClass: TStubClass; AClassName: string; AMapper: TPkgJsonMapper);
constructor TStubClass.Create(AParentClass: TStubClass; AClassName: string; AMapper: TPkgJsonMapper; AArrayProperty: string);
begin
inherited Create;
FMapper := AMapper;
Expand All @@ -581,6 +584,7 @@ constructor TStubClass.Create(AParentClass: TStubClass; AClassName: string; AMap
FComplexItems := TList<TStubField>.Create;
FArrayItems := TList<TStubField>.Create;
FMapper.FClasses.Add(self);
FArrayProperty := AArrayProperty;

FParentClass := AParentClass;

Expand Down Expand Up @@ -785,10 +789,10 @@ constructor TStubField.Create(AParentClass: TStubClass; AItemName: string; AFiel
if AItemName.Contains('-') then
raise EJsonMapper.CreateFmt('%s: Hyphens are not allowed!', [AItemName]);

FParentClass := AParentClass;
FFieldType := AFieldType;
Name := AItemName;

FParentClass := AParentClass;
if FParentClass <> nil then
FParentClass.FItems.Add(self);
end;
Expand Down Expand Up @@ -816,6 +820,10 @@ class function TStubField.GetTypeAsString(AType: TJsonType): string;

procedure TStubField.SetName(const Value: string);
begin

if (FParentClass.FArrayProperty <> '') AND (FParentClass.FArrayProperty = FName) then
FParentClass.FArrayProperty := Value;

FName := Value;

FFieldName := 'F' + String(Copy(Value, 1, 1)).ToUpper + Copy(Value, 2);
Expand All @@ -825,6 +833,8 @@ procedure TStubField.SetName(const Value: string);
else
FPropertyName := Value;



end;

function TStubField.GetTypeAsString: string;
Expand Down
Loading

0 comments on commit 449cc95

Please sign in to comment.