Browse Source

[options] Fixed: Can not compile under 10.1.2 (Issue#79)

Exilon 3 years ago
parent
commit
5b4b5c167e
2 changed files with 20 additions and 4 deletions
  1. 6 2
      Quick.Options.Serializer.Json.pas
  2. 14 2
      Quick.Options.pas

+ 6 - 2
Quick.Options.Serializer.Json.pas

@@ -1,13 +1,13 @@
 { ***************************************************************************
 
-  Copyright (c) 2015-2020 Kike Pérez
+  Copyright (c) 2015-2021 Kike Pérez
 
   Unit        : Quick.Options.Serializer.Json
   Description : Configuration groups Json Serializer
   Author      : Kike Pérez
   Version     : 1.0
   Created     : 18/10/2019
-  Modified    : 15/04/2020
+  Modified    : 30/08/2021
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
@@ -101,7 +101,11 @@ begin
   aJsonObj := nil;
   if FileExists(aFilename) then
   begin
+    {$IFDEF DELPHIRX102_UP}
     fileoptions := TFile.ReadAllText(aFilename,TEncoding.UTF8);
+    {$ELSE}
+    fileoptions := TFile.ReadAllText(aFilename);
+    {$ENDIF}
     aJsonObj := TJsonObject.ParseJSONValue(fileoptions) as TJsonObject;
     if aJsonObj = nil then raise EOptionLoadError.CreateFmt('Config file "%s" is damaged or not well-formed Json format!',[ExtractFileName(aFilename)]);
   end;

+ 14 - 2
Quick.Options.pas

@@ -1,13 +1,13 @@
 { ***************************************************************************
 
-  Copyright (c) 2015-2020 Kike Pérez
+  Copyright (c) 2015-2021 Kike Pérez
 
   Unit        : Quick.Options
   Description : Configuration group settings
   Author      : Kike Pérez
   Version     : 1.0
   Created     : 18/10/2019
-  Modified    : 27/02/2020
+  Modified    : 30/08/2021
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
@@ -72,9 +72,17 @@ type
     property MaxLength : Integer read fMaxLength write fMaxLength;
   end;
 
+  TOptionsBase = class(TInterfacedObject)
+
+  end;
+
+  {$IFDEF DELPHIRX102_UP}
   TOptions = class;
 
   TConfigureOptionsProc<T : TOptions> = reference to procedure(aOptions : T);
+  {$ELSE}
+  TConfigureOptionsProc<T> = reference to procedure(aOptions : T);
+  {$ENDIF}
 
   IOptionsValidator = interface
   ['{C6A09F78-8E34-4689-B943-83620437B9EF}']
@@ -91,7 +99,11 @@ type
     property Name : string read fName write fName;
     property HideOptions : Boolean read fHideOptions write fHideOptions;
     procedure DefaultValues; virtual;
+    {$IFDEF DELPHIRX102_UP}
     function ConfigureOptions<T : TOptions>(aOptionsFunc : TConfigureOptionsProc<T>) : IOptionsValidator;
+    {$ELSE}
+    function ConfigureOptions<T>(aOptionsFunc : TConfigureOptionsProc<T>) : IOptionsValidator;
+    {$ENDIF}
     procedure ValidateOptions;
   end;