FB4D Reference TJSONHelpers - SchneiderInfosystems/FB4D GitHub Wiki

Class Helper TJSONHelpers

This class helper for TJSONObject extends TJSONObject for accessing Firestore data types with getter and setter methods.

String

function GetStringValue: string; overload;
function GetStringValue(const Name: string): string; overload;
function GetStringValueDef(const Name: string;
  const Default: string = ''): string; overload;
function GetStringValueDef(const Default: string = ''): string; overload;
class function SetStringValue(const Val: string): TJSONObject;
class function SetString(const VarName, Val: string): TJSONPair;

Integer

function GetIntegerValue: integer; overload;
function GetIntegerValue(const Name: string): integer; overload;
function GetIntegerValueDef(const Name: string;
  Default: integer = 0): integer; overload;
function GetIntegerValueDef(Default: integer = 0): integer; overload;
function GetInt64Value: Int64; overload;
function GetInt64Value(const Name: string): Int64; overload;
function GetInt64ValueDef(Default: Int64 = 0): Int64; overload;
function GetInt64ValueDef(const Name: string;
  Default: Int64 = 0): Int64; overload;
class function SetIntegerValue(Val: integer): TJSONObject;
class function SetInteger(const VarName: string; Val: integer): TJSONPair;
class function SetInt64Value(Val: Int64): TJSONObject;
class function SetInt64(const VarName: string; Val: Int64): TJSONPair;

Boolean

function GetBooleanValue: boolean; overload;
function GetBooleanValue(const Name: string): boolean; overload;
function GetBooleanValueDef(const Name: string;
  Default: boolean = false): boolean; overload;
function GetBooleanValueDef(Default: boolean = false): boolean; overload;
class function SetBooleanValue(Val: boolean): TJSONObject;
class function SetBoolean(const VarName: string; Val: boolean): TJSONPair;

Double

function GetDoubleValue: double; overload;
function GetDoubleValue(const Name: string): double; overload;
function GetDoubleValueDef(const Name: string; Default: double = 0): double;
  overload;
function GetDoubleValueDef(Default: double = 0): double;
  overload;
class function SetDoubleValue(Val: double): TJSONObject;
class function SetDouble(const VarName: string; Val: double): TJSONPair;

TimeStamp

function GetTimeStampValue(TimeZone: TTimeZone = tzUTC): TDateTime; overload;
function GetTimeStampValue(const Name: string;
  TimeZone: TTimeZone = tzUTC): TDateTime; overload;
function GetTimeStampValueDef(const Name: string; Default: TDateTime = 0;
  TimeZone: TTimeZone = tzUTC): TDateTime; overload;
function GetTimeStampValueDef(Default: TDateTime = 0;
  TimeZone: TTimeZone = tzUTC): TDateTime; overload;
class function SetTimeStampValue(Val: TDateTime;
  TimeZone: FB4D.Interfaces.TTimeZone = tzUTC): TJSONObject;
class function SetTimeStamp(const VarName: string;
  Val: TDateTime; TimeZone: FB4D.Interfaces.TTimeZone = tzUTC): TJSONPair;

Null

class function SetNullValue: TJSONObject;
class function SetNull(const VarName: string): TJSONPair;
function IsNull: boolean;

Reference

function GetReference: string; overload;
function GetReference(const Name: string): string; overload;
function GetReferenceDef(const Name: string;
  const Default: string = ''): string; overload;
function GetReferenceDef(const Default: string = ''): string; overload;
class function SetReferenceValue(const ProjectID, Ref: string;
  const Database: string = cDefaultDatabaseID): TJSONObject;
class function SetReference(const Name, ProjectID, Ref: string): TJSONPair;

GeoPoint

function GetGeoPoint: TLocationCoord2D; overload;
function GetGeoPoint(const Name: string): TLocationCoord2D; overload;
function GetGeoPointDef(const Name: string;
  Default: TLocationCoord2D): TLocationCoord2D; overload;
function GetGeoPointDef(Default: TLocationCoord2D): TLocationCoord2D;
  overload;
class function SetGeoPointValue(Val: TLocationCoord2D): TJSONObject;
class function SetGeoPoint(const VarName: string;
  Val: TLocationCoord2D): TJSONPair;

Bytes

function GetBytes: TBytes; overload;
function GetBytes(const Name: string): TBytes; overload;
class function SetBytesValue(Val: TBytes): TJSONObject;
class function SetBytes(const VarName: string; Val: TBytes): TJSONPair;

Map

function GetMapSize: integer; overload;
function GetMapSize(const Name: string): integer; overload;
function GetMapItem(Ind: integer): TJSONPair; overload;
function GetMapItem(const Name: string): TJSONObject; overload;
function GetMapItem(const Name: string; Ind: integer): TJSONPair; overload;
function GetMapValue(const Name: string; Ind: integer): TJSONObject;
function GetMapValues: TJSONObject;
class function SetMapValue(MapVars: TFirestoreMap): TJSONObject;
class function SetMap(const VarName: string;
  MapVars: TFirestoreMap): TJSONPair;

Array

function GetArraySize: integer; overload;
function GetArraySize(const Name: string): integer; overload;
function GetArrayItem(Ind: integer): TJSONObject; overload;
function GetArrayItem(const Name: string; Ind: integer): TJSONObject;
  overload;
function GetArrayValues: TJSONObjects;
function GetStringArray: TStringDynArray;
class function SetArray(const VarName: string;
  FSArr: TFirestoreArr): TJSONPair;
class function SetArrayValue(FSArr: TFirestoreArr): TJSONObject;
class function SetStringArray(const VarName: string;
  Strings: TStringDynArray): TJSONPair; overload;
class function SetStringArray(const VarName: string;
  Strings: TStringList): TJSONPair; overload;
class function SetStringArray(const VarName: string;
  Strings: TList<string>): TJSONPair; overload;
⚠️ **GitHub.com Fallback** ⚠️