Browse Source

updated samples

Unknown 6 years ago
parent
commit
c999851826

+ 64 - 8
samples/delphi/QuickAutoMapper/AutoMappingObjects.dpr

@@ -6,9 +6,11 @@ program AutoMappingObjects;
 
 
 uses
 uses
   System.SysUtils,
   System.SysUtils,
+  System.Generics.Collections,
   Quick.Commons,
   Quick.Commons,
   Quick.Console,
   Quick.Console,
   Quick.JSONRecord,
   Quick.JSONRecord,
+  Quick.Json.Serializer,
   Quick.AutoMapper;
   Quick.AutoMapper;
 
 
 type
 type
@@ -21,6 +23,8 @@ type
 
 
   TCarType = (ctOil, ctDiesel);
   TCarType = (ctOil, ctDiesel);
 
 
+  TAgentStatus = (stActive, stIdle, stFail);
+
   TCar = class
   TCar = class
   private
   private
     fModel : string;
     fModel : string;
@@ -30,25 +34,41 @@ type
     property CarType : TCarType read fCarType write fCarType;
     property CarType : TCarType read fCarType write fCarType;
   end;
   end;
 
 
+  TCarList = TObjectList<TCar>;
+
+  TAgent = record
+    Name : string;
+    Status : TAgentStatus;
+  end;
+
+  TAgentList = TList<TAgent>;
+
   TUserBase = class(TJsonRecord)
   TUserBase = class(TJsonRecord)
   private
   private
     fName : string;
     fName : string;
     fAge : Integer;
     fAge : Integer;
     fCreationDate : TDateTime;
     fCreationDate : TDateTime;
     fNumbers : TArray<Integer>;
     fNumbers : TArray<Integer>;
+    fAgent : TAgent;
   published
   published
     property Name : string read fName write fName;
     property Name : string read fName write fName;
     property Age : Integer read fAge write fAge;
     property Age : Integer read fAge write fAge;
     property CreationDate : TDateTime read fCreationDate write fCreationDate;
     property CreationDate : TDateTime read fCreationDate write fCreationDate;
     property Numbers : TArray<Integer> read fNumbers write fNumbers;
     property Numbers : TArray<Integer> read fNumbers write fNumbers;
+    property Agent : TAgent read fAgent write fAgent;
   end;
   end;
 
 
+  TPointsList = TList<Integer>;
+
   TUser = class(TUserBase)
   TUser = class(TUserBase)
   private
   private
     fId : Int64;
     fId : Int64;
     fCash : Integer;
     fCash : Integer;
     fJob : TJob;
     fJob : TJob;
     fCar : TCar;
     fCar : TCar;
+    fCarList : TCarList;
+    fPoints : TPointsList;
+    fAgentList : TAgentList;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -57,34 +77,36 @@ type
     property Cash : Integer read fCash write fCash;
     property Cash : Integer read fCash write fCash;
     property Job : TJob read fJob write fJob;
     property Job : TJob read fJob write fJob;
     property Car : TCar read fCar write fCar;
     property Car : TCar read fCar write fCar;
+    property CarList : TCarList read fCarList write fCarList;
+    property Points : TPointsList read fPoints write fPoints;
+    property AgentList : TAgentList read fAgentList write fAgentList;
   end;
   end;
 
 
   TUser2 = class(TUserBase)
   TUser2 = class(TUserBase)
   private
   private
     fIdUser : Int64;
     fIdUser : Int64;
-    fName : string;
-    fAge : Integer;
-    fNumbers : TArray<Integer>;
     fJob : TJob;
     fJob : TJob;
     fMoney : Integer;
     fMoney : Integer;
     fCar : TCar;
     fCar : TCar;
+    fCarList : TCarList;
+    fPoints : TPointsList;
+    fAgentList : TAgentList;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
   published
   published
     property IdUser : Int64 read fIdUser write fIdUser;
     property IdUser : Int64 read fIdUser write fIdUser;
-    property Name : string read fName write fName;
-    property Age : Integer read fAge write fAge;
-    property Numbers : TArray<Integer> read fNumbers write fNumbers;
     property Money : Integer read fMoney write fMoney;
     property Money : Integer read fMoney write fMoney;
     property Job : TJob read fJob write fJob;
     property Job : TJob read fJob write fJob;
     property Car : TCar read fCar write fCar;
     property Car : TCar read fCar write fCar;
+    property CarList : TCarList read fCarList write fCarList;
+    property Points : TPointsList read fPoints write fPoints;
+    property AgentList : TAgentList read fAgentList write fAgentList;
   end;
   end;
 
 
 var
 var
   User : TUser;
   User : TUser;
   User2 : TUser2;
   User2 : TUser2;
-  UserClone : TUser;
   job : TJob;
   job : TJob;
   AutoMapper : TAutoMapper<TUser,TUser2>;
   AutoMapper : TAutoMapper<TUser,TUser2>;
 
 
@@ -93,11 +115,17 @@ var
 constructor TUser.Create;
 constructor TUser.Create;
 begin
 begin
   fCar := TCar.Create;
   fCar := TCar.Create;
+  fCarList := TCarList.Create(True);
+  fPoints := TPointsList.Create;
+  fAgentList := TAgentList.Create;
 end;
 end;
 
 
 destructor TUser.Destroy;
 destructor TUser.Destroy;
 begin
 begin
   fCar.Free;
   fCar.Free;
+  fCarList.Free;
+  fPoints.Free;
+  fAgentList.Free;
   inherited;
   inherited;
 end;
 end;
 
 
@@ -106,21 +134,31 @@ end;
 constructor TUser2.Create;
 constructor TUser2.Create;
 begin
 begin
   fCar := TCar.Create;
   fCar := TCar.Create;
+  fCarList := TCarList.Create(True);
+  fPoints := TPointsList.Create;
+  fAgentList := TAgentList.Create;
 end;
 end;
 
 
 destructor TUser2.Destroy;
 destructor TUser2.Destroy;
 begin
 begin
   fCar.Free;
   fCar.Free;
+  fCarList.Free;
+  fPoints.Free;
+  fAgentList.Free;
   inherited;
   inherited;
 end;
 end;
 
 
+var
+  car : TCar;
+  agent : TAgent;
+
 begin
 begin
   ReportMemoryLeaksOnShutdown := True;
   ReportMemoryLeaksOnShutdown := True;
   try
   try
     User := TUser.Create;
     User := TUser.Create;
     User.Id := 17;
     User.Id := 17;
     User.CreationDate := Now();
     User.CreationDate := Now();
-    User.Name := 'Juan';
+    User.Name := 'John Miller';
     User.Age := 30;
     User.Age := 30;
     User.Numbers := [1,2,3,4,5];
     User.Numbers := [1,2,3,4,5];
     User.Cash := 3500;
     User.Cash := 3500;
@@ -130,6 +168,24 @@ begin
     User.Job := job;
     User.Job := job;
     User.Car.Model := 'Ferrari';
     User.Car.Model := 'Ferrari';
     User.Car.CarType := ctOil;
     User.Car.CarType := ctOil;
+    car := TCar.Create;
+    car.Model := 'Ford';
+    car.CarType := ctDiesel;
+    User.CarList.Add(car);
+    car := TCar.Create;
+    car.Model := 'Nissan';
+    car.CarType := ctDiesel;
+    User.CarList.Add(car);
+    User.Points.Add(77);
+    User.Points.Add(100);
+    User.Points.Add(30);
+    agent.Name := 'FirstAgent';
+    agent.Status := TAgentStatus.stIdle;
+    User.Agent := agent;
+    User.AgentList.Add(agent);
+    agent.Name := 'SecondAgent';
+    agent.Status := TAgentStatus.stFail;
+    User.AgentList.Add(agent);
     //User2 := TMapper<TUser2>.Map(User);
     //User2 := TMapper<TUser2>.Map(User);
     AutoMapper := TAutoMapper<TUser,TUser2>.Create;
     AutoMapper := TAutoMapper<TUser,TUser2>.Create;
     try
     try

+ 231 - 1
samples/delphi/QuickConfig/ConfigToFileAndRegistry/Win64/Debug/Config.json

@@ -1 +1,231 @@
-{"Sizes":[23,11,554,12,34,29,77,30,48,59,773,221,98,3,22,983,122,231,433,12,31,987],"LastFilename":"library.txt","WindowPos":{"PosX":480,"PosY":0},"History":[{"Id":0,"Priority":"msLow","Redundant":true},{"Id":1,"Priority":"msLow","Redundant":true},{"Id":2,"Priority":"msLow","Redundant":true},{"Id":3,"Priority":"msLow","Redundant":true},{"Id":4,"Priority":"msLow","Redundant":true},{"Id":5,"Priority":"msLow","Redundant":true},{"Id":6,"Priority":"msLow","Redundant":true},{"Id":7,"Priority":"msLow","Redundant":true},{"Id":8,"Priority":"msLow","Redundant":true},{"Id":9,"Priority":"msLow","Redundant":true},{"Id":10,"Priority":"msLow","Redundant":true},{"Id":11,"Priority":"msLow","Redundant":true},{"Id":12,"Priority":"msLow","Redundant":true},{"Id":13,"Priority":"msLow","Redundant":true},{"Id":14,"Priority":"msLow","Redundant":true},{"Id":15,"Priority":"msLow","Redundant":true}],"Complex":{"Id":88586818,"Priority":"msHigh","Redundant":false},"ModifyDate":"2018-07-17T14:38:51.937Z","Title":"a fresh title","SessionName":"First Session"}
+{
+  "Sizes": [
+    23,
+    11,
+    554,
+    12,
+    34,
+    29,
+    77,
+    30,
+    48,
+    59,
+    773,
+    221,
+    98,
+    3,
+    22,
+    983,
+    122,
+    231,
+    433,
+    12,
+    31,
+    987
+  ],
+  "LastFilename": "library.txt",
+  "WindowPos": {
+    "PosX": 480,
+    "PosY": 0
+  },
+  "History": [
+    {
+      "Id": 0,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 1,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 2,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 3,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 4,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 5,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 6,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 7,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 8,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 9,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 10,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 11,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 12,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 13,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 14,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 15,
+      "Priority": 0,
+      "Redundant": true
+    }
+  ],
+  "Complex": {
+    "Id": 35907504,
+    "Priority": 2,
+    "Redundant": false
+  },
+  "ModifyDate": "08/14/2018 00:45:53",
+  "Title": "a fresh title",
+  "SessionName": "First Session",
+  "WorkList": {
+    "FOwnsObjects": true,
+    "FListHelper": {
+      "FCount": 23
+    },
+    "FItems": [
+      {
+        "Name": "Process 0",
+        "Active": false
+      },
+      {
+        "Name": "Process 1",
+        "Active": false
+      },
+      {
+        "Name": "Process 2",
+        "Active": false
+      },
+      {
+        "Name": "Process 3",
+        "Active": false
+      },
+      {
+        "Name": "Process 4",
+        "Active": false
+      },
+      {
+        "Name": "Process 5",
+        "Active": false
+      },
+      {
+        "Name": "Process 6",
+        "Active": false
+      },
+      {
+        "Name": "Process 7",
+        "Active": false
+      },
+      {
+        "Name": "Process 8",
+        "Active": false
+      },
+      {
+        "Name": "Process 9",
+        "Active": false
+      },
+      {
+        "Name": "Process 10",
+        "Active": false
+      },
+      {
+        "Name": "Process 11",
+        "Active": false
+      },
+      {
+        "Name": "Process 12",
+        "Active": false
+      },
+      {
+        "Name": "Process 13",
+        "Active": false
+      },
+      {
+        "Name": "Process 14",
+        "Active": false
+      },
+      {
+        "Name": "Process 15",
+        "Active": false
+      },
+      {
+        "Name": "Process 16",
+        "Active": false
+      },
+      {
+        "Name": "Process 17",
+        "Active": false
+      },
+      {
+        "Name": "Process 18",
+        "Active": false
+      },
+      {
+        "Name": "Process 19",
+        "Active": false
+      },
+      {
+        "Name": "Process 20",
+        "Active": false
+      },
+      {
+        "Name": "Process 21",
+        "Active": false
+      },
+      {
+        "Name": "Process 22",
+        "Active": false
+      },
+      null,
+      null,
+      null,
+      null,
+      null,
+      null,
+      null,
+      null,
+      null
+    ],
+    "FComparer": {}
+  }
+}

+ 2 - 2
samples/delphi/QuickJsonSerializer/main.pas

@@ -185,7 +185,7 @@ begin
   User2.FromJson(Memo1.Text);
   User2.FromJson(Memo1.Text);
   //User2.CreateFromJson(Memo1.Text);
   //User2.CreateFromJson(Memo1.Text);
   Memo1.Lines.Add('User2 as json:');
   Memo1.Lines.Add('User2 as json:');
-  Memo1.Lines.Add(User2.ToJson);
+  Memo1.Lines.Add(User2.ToJson(True));
   Memo1.Lines.Add(Format('Groups.OwnedObjects=%s',[BoolToStr(User2.Groups.OwnsObjects,True)]));
   Memo1.Lines.Add(Format('Groups.OwnedObjects=%s',[BoolToStr(User2.Groups.OwnsObjects,True)]));
   Memo1.Lines.Add(Format('Groups.Count=%d',[User2.Groups.Count]));
   Memo1.Lines.Add(Format('Groups.Count=%d',[User2.Groups.Count]));
   Memo1.Lines.Add(Format('Groups.Capacity=%d',[User2.Groups.Capacity]));
   Memo1.Lines.Add(Format('Groups.Capacity=%d',[User2.Groups.Capacity]));
@@ -194,7 +194,7 @@ end;
 
 
 procedure TForm1.btnToJsonClick(Sender: TObject);
 procedure TForm1.btnToJsonClick(Sender: TObject);
 begin
 begin
-  Memo1.Text := User.ToJson;
+  Memo1.Text := User.ToJson(True);
 end;
 end;
 
 
 procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
 procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

+ 7 - 7
samples/firemonkey/QuickAutoMapper/AutoMapperObjects.dproj

@@ -6,7 +6,7 @@
         <MainSource>AutoMapperObjects.dpr</MainSource>
         <MainSource>AutoMapperObjects.dpr</MainSource>
         <Base>True</Base>
         <Base>True</Base>
         <Config Condition="'$(Config)'==''">Debug</Config>
         <Config Condition="'$(Config)'==''">Debug</Config>
-        <Platform Condition="'$(Platform)'==''">Android</Platform>
+        <Platform Condition="'$(Platform)'==''">Win64</Platform>
         <TargetedPlatforms>1119</TargetedPlatforms>
         <TargetedPlatforms>1119</TargetedPlatforms>
         <AppType>Application</AppType>
         <AppType>Application</AppType>
     </PropertyGroup>
     </PropertyGroup>
@@ -397,6 +397,12 @@
                         <Overwrite>true</Overwrite>
                         <Overwrite>true</Overwrite>
                     </Platform>
                     </Platform>
                 </DeployFile>
                 </DeployFile>
+                <DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png" Configuration="Debug" Class="Android_SplashImage960">
+                    <Platform Name="Android">
+                        <RemoteName>splash_image.png</RemoteName>
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
                 <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
                 <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
                     <Platform Name="OSX32">
                     <Platform Name="OSX32">
                         <Overwrite>true</Overwrite>
                         <Overwrite>true</Overwrite>
@@ -420,12 +426,6 @@
                         <Overwrite>true</Overwrite>
                         <Overwrite>true</Overwrite>
                     </Platform>
                     </Platform>
                 </DeployFile>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png" Configuration="Debug" Class="Android_SplashImage960">
-                    <Platform Name="Android">
-                        <RemoteName>splash_image.png</RemoteName>
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
                 <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
                 <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
                     <Platform Name="OSX32">
                     <Platform Name="OSX32">
                         <Overwrite>true</Overwrite>
                         <Overwrite>true</Overwrite>

BIN
samples/firemonkey/QuickAutoMapper/AutoMapperObjects.res


+ 64 - 5
samples/firemonkey/QuickAutoMapper/Main.pas

@@ -6,7 +6,7 @@ uses
   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
   Quick.AutoMapper, Quick.JSONRecord, FMX.Controls.Presentation,
   Quick.AutoMapper, Quick.JSONRecord, FMX.Controls.Presentation,
-  FMX.ScrollBox, FMX.Memo;
+  FMX.ScrollBox, FMX.Memo, System.Generics.Collections;
 
 
 type
 type
   TForm1 = class(TForm)
   TForm1 = class(TForm)
@@ -18,7 +18,7 @@ type
     { Public declarations }
     { Public declarations }
   end;
   end;
 
 
-TJob = record
+  TJob = record
     Name : string;
     Name : string;
     DateFrom : TDateTime;
     DateFrom : TDateTime;
     DateTo : TDateTime;
     DateTo : TDateTime;
@@ -26,6 +26,8 @@ TJob = record
 
 
   TCarType = (ctOil, ctDiesel);
   TCarType = (ctOil, ctDiesel);
 
 
+  TAgentStatus = (stActive, stIdle, stFail);
+
   TCar = class
   TCar = class
   private
   private
     fModel : string;
     fModel : string;
@@ -35,25 +37,41 @@ TJob = record
     property CarType : TCarType read fCarType write fCarType;
     property CarType : TCarType read fCarType write fCarType;
   end;
   end;
 
 
+  TCarList = TObjectList<TCar>;
+
+  TAgent = record
+    Name : string;
+    Status : TAgentStatus;
+  end;
+
+  TAgentList = TList<TAgent>;
+
   TUserBase = class(TJsonRecord)
   TUserBase = class(TJsonRecord)
   private
   private
     fName : string;
     fName : string;
     fAge : Integer;
     fAge : Integer;
     fCreationDate : TDateTime;
     fCreationDate : TDateTime;
     fNumbers : TArray<Integer>;
     fNumbers : TArray<Integer>;
+    fAgent : TAgent;
   published
   published
     property Name : string read fName write fName;
     property Name : string read fName write fName;
     property Age : Integer read fAge write fAge;
     property Age : Integer read fAge write fAge;
     property CreationDate : TDateTime read fCreationDate write fCreationDate;
     property CreationDate : TDateTime read fCreationDate write fCreationDate;
     property Numbers : TArray<Integer> read fNumbers write fNumbers;
     property Numbers : TArray<Integer> read fNumbers write fNumbers;
+    property Agent : TAgent read fAgent write fAgent;
   end;
   end;
 
 
+  TPointsList = TList<Integer>;
+
   TUser = class(TUserBase)
   TUser = class(TUserBase)
   private
   private
     fId : Int64;
     fId : Int64;
     fCash : Integer;
     fCash : Integer;
     fJob : TJob;
     fJob : TJob;
     fCar : TCar;
     fCar : TCar;
+    fCarList : TCarList;
+    fPoints : TPointsList;
+    fAgentList : TAgentList;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -62,6 +80,9 @@ TJob = record
     property Cash : Integer read fCash write fCash;
     property Cash : Integer read fCash write fCash;
     property Job : TJob read fJob write fJob;
     property Job : TJob read fJob write fJob;
     property Car : TCar read fCar write fCar;
     property Car : TCar read fCar write fCar;
+    property CarList : TCarList read fCarList write fCarList;
+    property Points : TPointsList read fPoints write fPoints;
+    property AgentList : TAgentList read fAgentList write fAgentList;
   end;
   end;
 
 
   TUser2 = class(TUserBase)
   TUser2 = class(TUserBase)
@@ -70,6 +91,9 @@ TJob = record
     fJob : TJob;
     fJob : TJob;
     fMoney : Integer;
     fMoney : Integer;
     fCar : TCar;
     fCar : TCar;
+    fCarList : TCarList;
+    fPoints : TPointsList;
+    fAgentList : TAgentList;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -78,6 +102,9 @@ TJob = record
     property Money : Integer read fMoney write fMoney;
     property Money : Integer read fMoney write fMoney;
     property Job : TJob read fJob write fJob;
     property Job : TJob read fJob write fJob;
     property Car : TCar read fCar write fCar;
     property Car : TCar read fCar write fCar;
+    property CarList : TCarList read fCarList write fCarList;
+    property Points : TPointsList read fPoints write fPoints;
+    property AgentList : TAgentList read fAgentList write fAgentList;
   end;
   end;
 
 
 var
 var
@@ -86,6 +113,8 @@ var
   UserClone : TUser;
   UserClone : TUser;
   job : TJob;
   job : TJob;
   AutoMapper : TAutoMapper<TUser,TUser2>;
   AutoMapper : TAutoMapper<TUser,TUser2>;
+  car : TCar;
+  agent : TAgent;
 
 
 var
 var
   Form1: TForm1;
   Form1: TForm1;
@@ -99,11 +128,17 @@ implementation
 constructor TUser.Create;
 constructor TUser.Create;
 begin
 begin
   fCar := TCar.Create;
   fCar := TCar.Create;
+  fCarList := TCarList.Create(True);
+  fPoints := TPointsList.Create;
+  fAgentList := TAgentList.Create;
 end;
 end;
 
 
 destructor TUser.Destroy;
 destructor TUser.Destroy;
 begin
 begin
   fCar.Free;
   fCar.Free;
+  fCarList.Free;
+  fPoints.Free;
+  fAgentList.Free;
   inherited;
   inherited;
 end;
 end;
 
 
@@ -112,11 +147,17 @@ end;
 constructor TUser2.Create;
 constructor TUser2.Create;
 begin
 begin
   fCar := TCar.Create;
   fCar := TCar.Create;
+  fCarList := TCarList.Create(True);
+  fPoints := TPointsList.Create;
+  fAgentList := TAgentList.Create;
 end;
 end;
 
 
 destructor TUser2.Destroy;
 destructor TUser2.Destroy;
 begin
 begin
   fCar.Free;
   fCar.Free;
+  fCarList.Free;
+  fPoints.Free;
+  fAgentList.Free;
   inherited;
   inherited;
 end;
 end;
 
 
@@ -125,7 +166,7 @@ begin
 User := TUser.Create;
 User := TUser.Create;
     User.Id := 17;
     User.Id := 17;
     User.CreationDate := Now();
     User.CreationDate := Now();
-    User.Name := 'Jhon Miller';
+    User.Name := 'John Miller';
     User.Age := 30;
     User.Age := 30;
     User.Numbers := [1,2,3,4,5];
     User.Numbers := [1,2,3,4,5];
     User.Cash := 3500;
     User.Cash := 3500;
@@ -135,6 +176,24 @@ User := TUser.Create;
     User.Job := job;
     User.Job := job;
     User.Car.Model := 'Ferrari';
     User.Car.Model := 'Ferrari';
     User.Car.CarType := ctOil;
     User.Car.CarType := ctOil;
+    car := TCar.Create;
+    car.Model := 'Ford';
+    car.CarType := ctDiesel;
+    User.CarList.Add(car);
+    car := TCar.Create;
+    car.Model := 'Nissan';
+    car.CarType := ctDiesel;
+    User.CarList.Add(car);
+    User.Points.Add(77);
+    User.Points.Add(100);
+    User.Points.Add(30);
+    agent.Name := 'FirstAgent';
+    agent.Status := TAgentStatus.stIdle;
+    User.Agent := agent;
+    User.AgentList.Add(agent);
+    agent.Name := 'SecondAgent';
+    agent.Status := TAgentStatus.stFail;
+    User.AgentList.Add(agent);
     //User2 := TMapper<TUser2>.Map(User);
     //User2 := TMapper<TUser2>.Map(User);
     AutoMapper := TAutoMapper<TUser,TUser2>.Create;
     AutoMapper := TAutoMapper<TUser,TUser2>.Create;
     try
     try
@@ -162,10 +221,10 @@ User := TUser.Create;
 
 
       Memo1.Lines.Add(' ');
       Memo1.Lines.Add(' ');
       Memo1.Lines.Add('USER AS JSON RESULT');
       Memo1.Lines.Add('USER AS JSON RESULT');
-      Memo1.Lines.Add(Format('%s',[User.ToJson]));
+      Memo1.Lines.Add(Format('%s',[User.ToJson(True)]));
       Memo1.Lines.Add(' ');
       Memo1.Lines.Add(' ');
       Memo1.Lines.Add('USER2 AS JSON RESULT');
       Memo1.Lines.Add('USER2 AS JSON RESULT');
-      Memo1.Lines.Add(Format('%s',[User2.ToJson]));
+      Memo1.Lines.Add(Format('%s',[User2.ToJson(True)]));
 
 
     finally
     finally
       AutoMapper.Free;
       AutoMapper.Free;

BIN
samples/fpc/QuickAutoMapper/AutoMapperObjects


+ 0 - 4
samples/fpc/QuickAutoMapper/AutoMapperObjects.lpi

@@ -43,10 +43,6 @@
       <OtherUnitFiles Value="..\..\.."/>
       <OtherUnitFiles Value="..\..\.."/>
       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
     </SearchPaths>
-    <CodeGeneration>
-      <TargetCPU Value="x86_64"/>
-      <TargetOS Value="linux"/>
-    </CodeGeneration>
   </CompilerOptions>
   </CompilerOptions>
   <Debugging>
   <Debugging>
     <Exceptions Count="3">
     <Exceptions Count="3">

+ 75 - 3
samples/fpc/QuickAutoMapper/AutoMapperObjects.lpr

@@ -2,6 +2,7 @@ program AutoMapperObjects;
 
 
 uses
 uses
   SysUtils,
   SysUtils,
+  Generics.Collections,
   Quick.Commons,
   Quick.Commons,
   Quick.Console,
   Quick.Console,
   Quick.JSONRecord,
   Quick.JSONRecord,
@@ -22,6 +23,8 @@ type
 
 
   TCarType = (ctOil, ctDiesel);
   TCarType = (ctOil, ctDiesel);
 
 
+  TAgentStatus = (stActive, stIdle, stFail);
+
   TCar = class
   TCar = class
   private
   private
     fModel : string;
     fModel : string;
@@ -31,27 +34,47 @@ type
     property CarType : TCarType read fCarType write fCarType;
     property CarType : TCarType read fCarType write fCarType;
   end;
   end;
 
 
-  TArrayOfInteger = array of Integer;
+  TCarList = specialize TObjectList<TCar>;
+
+  TAgent = class
+  private
+    fName : string;
+    fStatus : TAgentStatus;
+  published
+    property Name : string read fName write fName;
+    property Status : TAgentStatus read fStatus write fStatus;
+  end;
+
+  TAgentList = specialize TList<TAgent>;
+
+  TArrayNumbers = array of Integer;
 
 
   TUserBase = class(TJsonRecord)
   TUserBase = class(TJsonRecord)
   private
   private
     fName : string;
     fName : string;
     fAge : Integer;
     fAge : Integer;
     fCreationDate : TDateTime;
     fCreationDate : TDateTime;
-    fNumbers : TArrayOfInteger;
+    fNumbers : TArrayNumbers;
+    fAgent : TAgent;
   published
   published
     property Name : string read fName write fName;
     property Name : string read fName write fName;
     property Age : Integer read fAge write fAge;
     property Age : Integer read fAge write fAge;
     property CreationDate : TDateTime read fCreationDate write fCreationDate;
     property CreationDate : TDateTime read fCreationDate write fCreationDate;
-    property Numbers : TArrayOfInteger read fNumbers write fNumbers;
+    property Numbers : TArrayNumbers read fNumbers write fNumbers;
+    property Agent : TAgent read fAgent write fAgent;
   end;
   end;
 
 
+  TPointsList = specialize TList<Integer>;
+
   TUser = class(TUserBase)
   TUser = class(TUserBase)
   private
   private
     fId : Int64;
     fId : Int64;
     fCash : Integer;
     fCash : Integer;
     fJob : TJob;
     fJob : TJob;
     fCar : TCar;
     fCar : TCar;
+    fCarList : TCarList;
+    fPoints : TPointsList;
+    fAgentList : TAgentList;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -60,6 +83,9 @@ type
     property Cash : Integer read fCash write fCash;
     property Cash : Integer read fCash write fCash;
     property Job : TJob read fJob write fJob;
     property Job : TJob read fJob write fJob;
     property Car : TCar read fCar write fCar;
     property Car : TCar read fCar write fCar;
+    property CarList : TCarList read fCarList write fCarList;
+    property Points : TPointsList read fPoints write fPoints;
+    property AgentList : TAgentList read fAgentList write fAgentList;
   end;
   end;
 
 
   TUser2 = class(TUserBase)
   TUser2 = class(TUserBase)
@@ -68,6 +94,9 @@ type
     fJob : TJob;
     fJob : TJob;
     fMoney : Integer;
     fMoney : Integer;
     fCar : TCar;
     fCar : TCar;
+    fCarList : TCarList;
+    fPoints : TPointsList;
+    fAgentList : TAgentList;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -76,12 +105,18 @@ type
     property Money : Integer read fMoney write fMoney;
     property Money : Integer read fMoney write fMoney;
     property Job : TJob read fJob write fJob;
     property Job : TJob read fJob write fJob;
     property Car : TCar read fCar write fCar;
     property Car : TCar read fCar write fCar;
+    property CarList : TCarList read fCarList write fCarList;
+    property Points : TPointsList read fPoints write fPoints;
+    property AgentList : TAgentList read fAgentList write fAgentList;
   end;
   end;
 
 
 var
 var
   User : TUser;
   User : TUser;
   User2 : TUser2;
   User2 : TUser2;
   AutoMapper : specialize TAutoMapper<TUser,TUser2>;
   AutoMapper : specialize TAutoMapper<TUser,TUser2>;
+  job : TJob;
+  car : TCar;
+  agent : TAgent;
 
 
 { TUser }
 { TUser }
 
 
@@ -89,12 +124,20 @@ constructor TUser.Create;
 begin
 begin
   fCar := TCar.Create;
   fCar := TCar.Create;
   fJob := TJob.Create;
   fJob := TJob.Create;
+  fCarList := TCarList.Create(True);
+  fPoints := TPointsList.Create;
+  fAgent := TAgent.Create;
+  fAgentList := TAgentList.Create;
 end;
 end;
 
 
 destructor TUser.Destroy;
 destructor TUser.Destroy;
 begin
 begin
   fCar.Free;
   fCar.Free;
   fJob.Free;
   fJob.Free;
+  fCarList.Free;
+  fPoints.Free;
+  fAgent.Free;
+  fAgentList.Free;
   inherited;
   inherited;
 end;
 end;
 
 
@@ -104,12 +147,20 @@ constructor TUser2.Create;
 begin
 begin
   fCar := TCar.Create;
   fCar := TCar.Create;
   fJob := TJob.Create;
   fJob := TJob.Create;
+  fCarList := TCarList.Create(True);
+  fPoints := TPointsList.Create;
+  fAgent := TAgent.Create;
+  fAgentList := TAgentList.Create;
 end;
 end;
 
 
 destructor TUser2.Destroy;
 destructor TUser2.Destroy;
 begin
 begin
   fCar.Free;
   fCar.Free;
   fJob.Free;
   fJob.Free;
+  fCarList.Free;
+  fPoints.Free;
+  fAgent.Free;
+  fAgentList.Free;
   inherited;
   inherited;
 end;
 end;
 
 
@@ -128,6 +179,27 @@ begin
     User.Job.DateTo := Now();
     User.Job.DateTo := Now();
     User.Car.Model := 'Ferrari';
     User.Car.Model := 'Ferrari';
     User.Car.CarType := ctOil;
     User.Car.CarType := ctOil;
+    car := TCar.Create;
+    car.Model := 'Ford';
+    car.CarType := ctDiesel;
+    User.CarList.Add(car);
+    car := TCar.Create;
+    car.Model := 'Nissan';
+    car.CarType := ctDiesel;
+    User.CarList.Add(car);
+    User.Points.Add(77);
+    User.Points.Add(100);
+    User.Points.Add(30);
+    agent := TAgent.Create;
+    agent.Name := 'FirstAgent';
+    agent.Status := TAgentStatus.stIdle;
+    User.Agent.Name := 'John';
+    User.Agent.Status := TAgentStatus.stIdle;
+    User.AgentList.Add(agent);
+    agent := TAgent.Create;
+    agent.Name := 'SecondAgent';
+    agent.Status := TAgentStatus.stFail;
+    User.AgentList.Add(agent);
     //User2 := TMapper<TUser2>.Map(User);
     //User2 := TMapper<TUser2>.Map(User);
     AutoMapper := specialize TAutoMapper<TUser,TUser2>.Create;
     AutoMapper := specialize TAutoMapper<TUser,TUser2>.Create;
     try
     try

BIN
samples/fpc/QuickChrono/simplechrono


+ 1 - 0
samples/fpc/QuickConfig/ConfigToFileAndRegistry/Config.json

@@ -0,0 +1 @@
+{ "Title" : "hola", "SessionName" : "", "Sizes" : [], "LastFilename" : "", "History" : [], "Complex" : { "Id" : 1, "Priority" : "msMed", "Redundant" : true }, "ModifyDate" : "2018-07-19T00:40:06.764Z " }

BIN
samples/fpc/QuickConsole/ConsoleOut/bin/x86_64-linux/ConsoleOut


BIN
samples/fpc/QuickJsonSerializer/JsonSerializer


BIN
samples/fpc/QuickJsonSerializer/lib/x86_64-linux/JsonSerializer.or


BIN
samples/fpc/QuickJsonSerializer/lib/x86_64-linux/JsonSerializer.res


+ 40 - 0
samples/fpc/QuickJsonSerializer/lib/x86_64-linux/main.lfm

@@ -0,0 +1,40 @@
+object Form1: TForm1
+  Left = 343
+  Height = 621
+  Top = 226
+  Width = 1025
+  Caption = 'Form1'
+  ClientHeight = 621
+  ClientWidth = 1025
+  OnClose = FormClose
+  OnCreate = FormCreate
+  LCLVersion = '1.9.0.0'
+  object Memo1: TMemo
+    Left = 8
+    Height = 540
+    Top = 8
+    Width = 1008
+    Lines.Strings = (
+      'Memo1'
+    )
+    TabOrder = 0
+  end
+  object btnFromJson: TButton
+    Left = 920
+    Height = 25
+    Top = 582
+    Width = 94
+    Caption = 'FromJson'
+    OnClick = btnFromJsonClick
+    TabOrder = 1
+  end
+  object btnToJson: TButton
+    Left = 808
+    Height = 25
+    Top = 582
+    Width = 99
+    Caption = 'ToJson'
+    OnClick = btnToJsonClick
+    TabOrder = 2
+  end
+end