mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +02:00
* Rename keyword info to avoid confusion
This commit is contained in:
parent
711e412cb7
commit
13fbc876e0
@ -30,20 +30,20 @@ Type
|
||||
EJsonSchemaLoader = class(EJSONSchema);
|
||||
|
||||
{ TJsonSchemaLoader }
|
||||
TKeywordInfo = Record
|
||||
TLoadKeywordInfo = Record
|
||||
Schema : TJSONSChema;
|
||||
Keyword : TJSONStringType;
|
||||
Value : TJSONData;
|
||||
end;
|
||||
|
||||
TKeyWordHandler = Procedure(Sender : TObject; const Info : TKeywordInfo; var Handled: Boolean) of object;
|
||||
TLoadKeyWordHandler = Procedure(Sender : TObject; const Info : TLoadKeywordInfo; var Handled: Boolean) of object;
|
||||
TSchemaLoadOption = (loSkipUnknownProperties);
|
||||
TSchemaLoadOptions = Set of TSchemaLoadOption;
|
||||
|
||||
TJsonSchemaLoader = class(TComponent)
|
||||
private
|
||||
FCurrentKeyword : TJSONSchemaKeyword;
|
||||
FOnUnknownKeyword: TKeyWordHandler;
|
||||
FOnUnknownKeyword: TLoadKeyWordHandler;
|
||||
FOptions: TSchemaLoadOptions;
|
||||
procedure ReadVocabulary(aData: TJSONData; aSchema: TJSONSchema);
|
||||
Protected
|
||||
@ -61,7 +61,7 @@ Type
|
||||
function ReadPositiveInteger(aData : TJSONData): cardinal;
|
||||
function ReadString(aData : TJSONData): String;
|
||||
// Handle unknown props
|
||||
function HandleUnknownKeyWord(const aInfo : TKeywordInfo) : Boolean; virtual;
|
||||
function HandleUnknownKeyWord(const aInfo : TLoadKeywordInfo) : Boolean; virtual;
|
||||
// Read various special properties
|
||||
procedure ReadDependentRequired(aData: TJSONData; aList: TSchemaDependentRequiredList);
|
||||
procedure ReadArray(aData : TJSONData; aValues: TJSONArray);
|
||||
@ -77,7 +77,7 @@ Type
|
||||
public
|
||||
procedure ReadFromJSON(aSchema: TJSONSchema; aJSONData : TJSONData);
|
||||
Published
|
||||
property OnUnknownKeyword : TKeyWordHandler read FOnUnknownKeyword Write FOnUnknownKeyword;
|
||||
property OnUnknownKeyword : TLoadKeyWordHandler read FOnUnknownKeyword Write FOnUnknownKeyword;
|
||||
property Options : TSchemaLoadOptions Read FOptions Write FOptions;
|
||||
end;
|
||||
|
||||
@ -140,7 +140,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TJsonSchemaLoader.HandleUnknownKeyWord(const aInfo: TKeywordInfo): Boolean;
|
||||
function TJsonSchemaLoader.HandleUnknownKeyWord(const aInfo: TLoadKeywordInfo): Boolean;
|
||||
begin
|
||||
Result:=False;
|
||||
if Assigned(FOnUnknownKeyword) then
|
||||
@ -333,7 +333,7 @@ var
|
||||
Enum : TJSONEnum;
|
||||
aData : TJSONData;
|
||||
keyword : TJSONSchemaKeyword;
|
||||
Info : TKeywordInfo;
|
||||
Info : TLoadKeywordInfo;
|
||||
|
||||
begin
|
||||
For Enum in aObject do
|
||||
|
@ -31,13 +31,13 @@ Type
|
||||
|
||||
TJsonTokens = Set of TJsonToken;
|
||||
|
||||
TKeywordInfo = Record
|
||||
TReadKeywordInfo = Record
|
||||
Schema : TJSONSChema;
|
||||
Keyword : TJSONStringType;
|
||||
Scanner : TJSONScanner;
|
||||
end;
|
||||
|
||||
TKeyWordHandler = Procedure(Sender : TObject; const Info : TKeywordInfo; var Handled: Boolean) of object;
|
||||
TReadKeyWordHandler = Procedure(Sender : TObject; const Info : TReadKeywordInfo; var Handled: Boolean) of object;
|
||||
TSchemaReadOption = (roSkipUnknownProperties);
|
||||
TSchemaReadOptions = Set of TSchemaReadOption;
|
||||
|
||||
@ -46,7 +46,7 @@ Type
|
||||
|
||||
TJsonSchemaReader = class(TComponent)
|
||||
private
|
||||
FOnUnknownKeyWord: TKeywordHandler;
|
||||
FOnUnknownKeyWord: TReadKeywordHandler;
|
||||
FOptions: TSchemaReadOptions;
|
||||
FScanner : TJSONScanner;
|
||||
Protected
|
||||
@ -73,7 +73,7 @@ Type
|
||||
function ReadPositiveInteger: Cardinal;
|
||||
function ReadString: String;
|
||||
// Read properties
|
||||
function HandleUnknownKeyword(aInfo : TKeyWordInfo) : Boolean;
|
||||
function HandleUnknownKeyword(aInfo : TReadKeyWordInfo) : Boolean;
|
||||
procedure ReadDependentRequired(aSchema: TJsonSchema; aList: TSchemaDependentRequiredList);
|
||||
// procedure ReadSchemaValue(aSchema: TJsonSchema; AValue: TSchemaValue; const AValidTypes: TJsonTokens = []);
|
||||
procedure ReadArray(aValues: TJSONArray; Full : Boolean);
|
||||
@ -94,7 +94,7 @@ Type
|
||||
procedure ReadFromString(aSchema: TJSONSchema; const AString: TJSONStringType);
|
||||
function ReadJSONData: TJSONData;
|
||||
Property Options : TSchemaReadOptions Read FOptions Write FOptions;
|
||||
Property OnUnknownKeyWord : TKeywordHandler Read FOnUnknownKeyWord Write FOnUnknownKeyWord;
|
||||
Property OnUnknownKeyWord : TReadKeywordHandler Read FOnUnknownKeyWord Write FOnUnknownKeyWord;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -605,7 +605,7 @@ var
|
||||
propName: String;
|
||||
aToken: TJSONToken;
|
||||
keyword : TJSONSchemaKeyword;
|
||||
Info : TKeywordInfo;
|
||||
Info : TReadKeywordInfo;
|
||||
aValue : TJSONData;
|
||||
|
||||
begin
|
||||
@ -749,7 +749,7 @@ begin
|
||||
Result:=GetTokenString;
|
||||
end;
|
||||
|
||||
function TJsonSchemaReader.HandleUnknownKeyword(aInfo: TKeyWordInfo): Boolean;
|
||||
function TJsonSchemaReader.HandleUnknownKeyword(aInfo: TReadKeyWordInfo): Boolean;
|
||||
begin
|
||||
Result:=False;
|
||||
if Assigned(OnUnknownKeyword) then
|
||||
|
Loading…
Reference in New Issue
Block a user