Permalink
Browse files

try to circumvent some weird Delphi compiler bug with "object"

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Oct 16, 2018
1 parent f180f41 commit af47c68ee676c0c4d4b9fb226365673be1a56813
@@ -1990,6 +1990,7 @@ procedure AddID(var Values: TIDDynArray; Value: TID); overload;
// - used e.g. by GetJSONObjectAsSQL() function or ExecuteFromJSON and
// InternalBatchStop methods
{$ifdef UNICODE}TJSONObjectDecoder = record{$else}TJSONObjectDecoder = object{$endif}
public
/// contains the decoded field names
FieldNames: array[0..MAX_SQLFIELDS-1] of RawUTF8;
/// contains the decoded field values
@@ -2485,7 +2486,7 @@ function JSONFileToObject(const JSONFile: TFileName; var ObjectInstance;
/// store information about a class, able to easily create new instances
// - using this temporary storage will speed up the creation process
// - any virtual constructor will be used, including for TCollection types
TClassInstance = object
{$ifdef UNICODE}TClassInstance = record{$else}TClassInstance = object{$endif}
public
/// the class type itself
ItemClass: TClass;
@@ -2595,6 +2596,7 @@ function JSONFileToObject(const JSONFile: TFileName; var ObjectInstance;
// - for TSQLRecord, you should better use the RecordProps.Fields[] array,
// which is faster and contains the properties published in parent classes
{$ifdef UNICODE}TClassProp = record{$else}TClassProp = object{$endif}
public
/// number of published properties in this object
PropCount: Word;
/// point to a TPropInfo packed array
@@ -2614,6 +2616,7 @@ {$ifdef UNICODE}TClassProp = record{$else}TClassProp = object{$endif}
PClassType = ^TClassType;
/// a wrapper to class type information, as defined by the Delphi RTTI
{$ifdef UNICODE}TClassType = record{$else}TClassType = object{$endif}
public
/// the class type
ClassType: TClass;
/// the parent class type information
@@ -2642,6 +2645,7 @@ {$ifdef UNICODE}TClassType = record{$else}TClassType = object{$endif}
// a text equivalent, translated if necessary, from the enumeration type
// definition itself
{$ifdef UNICODE}TEnumType = record{$else}TEnumType = object{$endif}
public
/// specify ordinal storage size and sign
// - is prefered to MaxValue to identify the number of stored bytes
OrdType: TOrdType;
@@ -2816,6 +2820,7 @@ {$ifdef UNICODE}TEnumType = record{$else}TEnumType = object{$endif}
// - user types defined as new types have this type information:
// & type NewType = type OldType;
{$ifdef UNICODE}TTypeInfo = record{$else}TTypeInfo = object{$endif}
public
/// the value type family
Kind: TTypeKind;
/// the declared name of the type ('String','Word','RawUnicode'...)
@@ -2919,6 +2924,7 @@ {$ifdef UNICODE}TTypeInfo = record{$else}TTypeInfo = object{$endif}
// indexed properties are not handled yet (use faster RawUnicodeString instead
// of WideString and UnicodeString) - in fact, the generic string type is handled
{$ifdef UNICODE}TPropInfo = record{$else}TPropInfo = object{$endif}
public
{$ifdef USETYPEINFO}
function RetrieveFieldSize: integer;
{$endif}
@@ -3189,6 +3195,7 @@ {$ifdef UNICODE}TPropInfo = record{$else}TPropInfo = object{$endif}
{$A-} { Delphi and FPC compiler use packed storage for this internal type }
/// a wrapper around method returned result definition
{$ifdef UNICODE}TReturnInfo = record{$else}TReturnInfo = object{$endif}
public
/// RTTI version
// - 2 up to Delphi 2010, 3 for Delphi XE and up
Version: byte;
@@ -3209,6 +3216,7 @@ {$ifdef UNICODE}TReturnInfo = record{$else}TReturnInfo = object{$endif}
{$A-} { Delphi and FPC compiler use packed storage for this internal type }
/// a wrapper around an individual method parameter definition
{$ifdef UNICODE}TParamInfo = record{$else}TParamInfo = object{$endif}
public
/// the kind of parameter
Flags: TParamFlags;
/// the parameter type information
@@ -3233,6 +3241,7 @@ {$ifdef UNICODE}TParamInfo = record{$else}TParamInfo = object{$endif}
{$A-} { Delphi and FPC compiler use packed storage for this internal type }
/// a wrapper around a method definition
{$ifdef UNICODE}TMethodInfo = record{$else}TMethodInfo = object{$endif}
public
{$ifdef FPC}
/// method name
Name: PShortString;
@@ -4935,7 +4944,7 @@ function StringToMethod(const method: RawUTF8): TSQLURIMethod;
// consolidated statistics
// - it will therefore store up to 24*365+365+12+1 = 9138 records per year
// in the associated storage engine (so there is no actual need to purge it)
TSynMonitorUsageID = object
{$ifdef UNICODE}TSynMonitorUsageID = record{$else}TSynMonitorUsageID = object{$endif}
public
/// the TID, as computed from time and granularity
Value: integer;
@@ -5800,6 +5809,7 @@ TServiceFactoryServer = class;
/// store all parameters for a Client or Server method call
// - as used by TSQLRestServer.URI or TSQLRestClientURI.InternalURI
{$ifdef UNICODE}TSQLRestURIParams = record{$else}TSQLRestURIParams = object{$endif}
public
/// input parameter containing the caller URI
Url: RawUTF8;
/// input parameter containing the caller method
@@ -6059,6 +6069,7 @@ TSQLRestServerURIContextClass = class of TSQLRestServerURIContext;
// - one property for every and each URI method (GET/POST/PUT/DELETE)
// - one bit for every and each Table in Model.Tables[]
{$ifdef UNICODE}TSQLAccessRights = record{$else}TSQLAccessRights = object{$endif}
public
/// set of allowed actions on the server side
AllowRemoteExecute: TSQLAllowRemoteExecute;
/// GET method (retrieve record) table access bits
@@ -9136,6 +9147,7 @@ TSQLTableWritable = class(TSQLTableJSON)
// - the maximum count of the locked list if fixed to 512 by default,
// which seems correct for common usage
{$ifdef UNICODE}TSQLLocks = record{$else}TSQLLocks = object{$endif}
public
/// the number of locked records stored in this object
Count: integer;
/// contains the locked record ID
@@ -9275,7 +9287,7 @@ TSQLQueryCustom = record
/// defines the settings for a Tab for User Interface generation
// - used in mORMotToolBar.pas unit and TSQLModel.Create() overloaded method
TSQLRibbonTabParameters = object
{$ifdef UNICODE}TSQLRibbonTabParameters = record{$else}TSQLRibbonTabParameters = object{$endif}
public
/// the Table associated to this Tab
Table: TSQLRecordClass;
@@ -11930,6 +11942,7 @@ TInterfaceStubRule = record
/// define the rules for a given method as used internaly by TInterfaceStub
{$ifdef UNICODE}TInterfaceStubRules = record{$else}TInterfaceStubRules = object{$endif}
public
/// the mocking / stubing rules associated to this method
Rules: array of TInterfaceStubRule;
/// index in Rules[] of the default rule, i.e. the one with Params=''
@@ -11977,6 +11990,7 @@ {$ifdef UNICODE}TInterfaceStubRules = record{$else}TInterfaceStubRules = objec
/// used to keep track of one stubbed method call
{$ifdef UNICODE}TInterfaceStubLog = record{$else}TInterfaceStubLog = object{$endif}
public
/// call timestamp, in milliseconds
// - is filled with GetTickCount64() API returned value
Timestamp64: Int64;
@@ -16811,7 +16825,8 @@ {$ifdef UNICODE}TSQLRestServerURI = record{$else}TSQLRestServerURI = object{$e
/// used to publish all Services supported by a TSQLRestServer instance
// - as expected by TSQLRestServer.ServicesPublishedInterfaces
// - can be serialized as a JSON object via RecordLoadJSON/RecordSaveJSON
TServicesPublishedInterfaces = object
{$ifdef UNICODE}TServicesPublishedInterfaces = record{$else}TServicesPublishedInterfaces = object{$endif}
public
/// how this TSQLRestServer could be accessed
PublicURI: TSQLRestServerURI;
/// the list of supported services names
@@ -346,7 +346,7 @@ TGDIPagereference = class
end;
/// contains one page
TGDIPageContent = object
TGDIPageContent = record
/// SynLZ-compressed content of the page
MetaFileCompressed: RawByteString;
/// text equivalent of the page
@@ -184,6 +184,7 @@ interface
type
PServiceStatus = ^TServiceStatus;
TServiceStatus = object
public
dwServiceType: DWORD;
dwCurrentState: DWORD;
dwControlsAccepted: DWORD;
@@ -195,6 +196,7 @@ interface
PServiceStatusProcess = ^TServiceStatusProcess;
TServiceStatusProcess = object(TServiceStatus)
public
dwProcessId: DWORD;
dwServiceFlags: DWORD;
end;
@@ -127,7 +127,8 @@ interface
TFreeShortCutSet = set of ord('A')..ord('Z');
/// a simple object to get one char shortcuts from caption value
TFreeShortCut = object
{$ifdef UNICODE}TFreeShortCut = record{$else}TFreeShortCut = object{$endif}
public
/// bit set for already used short cut, from 'A' to 'Z'
Values: TFreeShortCutSet;
/// attempt to create free shortcut of one char length, from
@@ -478,7 +479,7 @@ TSQLLister = class(TComponent)
// custom buttons to a previously created one by TSQLLister.SetToolBar()
// - simply set the associated objects via the Init() method, then call
// AddToolBar() for every toolbar which need to be created
TSQLCustomToolBar = object
{$ifdef UNICODE}TSQLCustomToolBar = record{$else}TSQLCustomToolBar = object{$endif}
public
Page: TSynPage;
ActionHints: string;
@@ -293,7 +293,8 @@ interface
type
/// a common record to identify a language
TLanguage = object
{$ifdef UNICODE}TLanguage = record{$else}TLanguage = object{$endif}
public
/// as in LanguageAbr[index], LANGUAGE_NONE before first SetLanguageLocal()
Index: TLanguages;
/// the corresponding Char Set
@@ -771,7 +771,8 @@ TWebSocketFrameList = class(TSynPersistent)
end;
/// parameters to be used for WebSockets process
TWebSocketProcessSettings = object
{$ifdef UNICODE}TWebSocketProcessSettings = record{$else}TWebSocketProcessSettings = object{$endif}
public
/// time in milli seconds between each focPing commands sent to the other end
// - default is 0, i.e. no automatic ping sending on client side, and
// 20000, i.e. 20 seconds, on server side
@@ -3226,6 +3226,7 @@ procedure AddRawUTF8(var Values: TRawUTF8DynArray; var ValuesCount: integer;
type
/// simple stack-allocated type for handling a type names list
{$ifdef UNICODE}TPropNameList = record{$else}TPropNameList = object{$endif}
public
Values: TRawUTF8DynArray;
Count: Integer;
/// initialize the list
@@ -3491,6 +3492,7 @@ function TemporaryFileName: TFileName;
{$A-}
/// file found result item, as returned by FindFiles()
{$ifdef UNICODE}TFindFiles = record{$else}TFindFiles = object{$endif}
public
/// the matching file name, including its folder name
Name: TFileName;
/// the matching file attributes
@@ -5881,6 +5883,7 @@ TPendingTaskList = class(TSynPersistent)
/// used to store one list of hashed RawUTF8 in TRawUTF8Interning pool
{$ifdef UNICODE}TRawUTF8InterningSlot = record{$else}TRawUTF8InterningSlot = object{$endif}
public
/// actual RawUTF8 storage
Value: TRawUTF8DynArray;
/// hashed access to the Value[] list
@@ -6007,6 +6010,7 @@ TSynNameValueItem = record
// in Delphi 2009/2010 compiler (at least): this structure is not initialized
// if defined as an object on the stack, but will be as a record :(
{$ifdef UNICODE}TSynNameValue = record{$else}TSynNameValue = object{$endif}
private
fDynArray: TDynArrayHashed;
fOnAdd: TSynNameValueNotify;
function GetBlobData: RawByteString;
@@ -10033,7 +10037,8 @@ {$ifdef UNICODE}TFileBufferReader = record{$else}TFileBufferReader = object{$e
// - is also safer, since will check for reaching end of buffer
// - raise a EFastReader exception on decoding error (e.g. if a buffer
// overflow may occur) or call OnErrorOverflow/OnErrorData event handlers
TFastReader = object
{$ifdef UNICODE}TFastReader = record{$else}TFastReader = object{$endif}
public
/// the current position in the memory
P: PAnsiChar;
/// the last position in the buffer
@@ -12188,6 +12193,7 @@ function EventEquals(const eventA,eventB): boolean;
// - FPC's TSystemTime in datih.inc does NOT match Windows TSystemTime fields!
// - also used to store a Date/Time in TSynTimeZone internal structures
{$ifdef UNICODE}TSynSystemTime = record{$else}TSynSystemTime = object{$endif}
public
Year, Month, DayOfWeek, Day,
Hour, Minute, Second, MilliSecond: word;
/// set all fields to 0
@@ -12241,6 +12247,7 @@ {$ifdef UNICODE}TSynSystemTime = record{$else}TSynSystemTime = object{$endif}
// - TTimeLogBits.Value has a 38-bit precision, so features exact representation
// as JavaScript numbers (stored in a 52-bit mantissa)
{$ifdef UNICODE}TTimeLogBits = record{$else}TTimeLogBits = object{$endif}
public
/// the bit-encoded value itself, which follows an abstract "year" of 16
// months of 32 days of 32 hours of 64 minutes of 64 seconds
// - bits 0..5 = Seconds (0..59)
@@ -12727,6 +12734,7 @@ TTimeZoneInfo = record
/// used to store Time Zone information for a single area in TSynTimeZone
{$ifdef UNICODE}TTimeZoneData = record{$else}TTimeZoneData = object{$endif}
public
id: TTimeZoneID;
display: RawUTF8;
tzi: TTimeZoneInfo;
@@ -23954,7 +23962,9 @@ function FormatUTF8(const Format: RawUTF8; const Args: array of const): RawUTF8;
end;
type
TFormatUTF8 = object // only supported token is %, with any const arguments
// only supported token is %, with any const arguments
{$ifdef UNICODE}TFormatUTF8 = record{$else}TFormatUTF8 = object{$endif}
public
b: PTempUTF8;
L,argN: integer;
blocks: array[0..63] of TTempUTF8; // to avoid most heap allocations
@@ -37025,6 +37035,7 @@ function RdRand32: cardinal;
type
{$ifdef UNICODE}TLecuyer = record{$else}TLecuyer = object{$endif}
public
rs1, rs2, rs3: cardinal;
seedcount: cardinal;
procedure Seed(entropy: PByteArray; entropylen: integer);
@@ -38228,6 +38239,7 @@ function AddSortedRawUTF8(var Values: TRawUTF8DynArray; var ValuesCount: integer
type
/// used internaly for faster quick sort
{$ifdef UNICODE}TQuickSortRawUTF8 = record{$else}TQuickSortRawUTF8 = object{$endif}
public
Values: PPointerArray;
Compare: TUTF8Compare;
CoValues: PIntegerArray;
@@ -48492,6 +48504,7 @@ function TDynArray.FastLocateOrAddSorted(const Elem; wasAdded: PBoolean): intege
type
// internal structure used to make QuickSort faster & with less stack usage
{$ifdef UNICODE}TDynArrayQuickSort = record{$else}TDynArrayQuickSort = object{$endif}
public
Compare: TDynArraySortCompare;
Pivot: pointer;
Index: PCardinalArray;
@@ -426,10 +426,6 @@ TSynLogCallbacks = class(TSynPersistentLocked)
/// how file existing shall be handled during logging
TSynLogExistsAction = (acOverwrite, acAppend);
/// See TSynLogFamily.HandleExceptionBeforeLogging for details
TSynLogExceptionHandlingEvent = function(aExceptionContext: TSynLogExceptionContext): boolean of object;
/// regroup several logs under an unique family name
// - you should usualy use one family per application or per architectural
// module: e.g. a server application may want to log in separate files the
@@ -449,8 +445,6 @@ TSynLogCallbacks = class(TSynPersistentLocked)
// ! ILog.Log(sllInfo,'method called');
// ! end;
TSynLogFamily = class
private
FHandleExceptionBeforeLogging: TSynLogExceptionHandlingEvent;
protected
fLevel, fLevelStackTrace: TSynLogInfos;
fArchiveAfterDays: Integer;
@@ -569,11 +563,6 @@ TSynLogFamily = class
property EchoCustom: TOnTextWriterEcho read fEchoCustom write SetEchoCustom;
/// the associated TSynLog class
property SynLogClass: TSynLogClass read fSynLogClass;
/// you can choose to log or ignore each exception caught by TSynLog using
// this HandleExceptionBeforeLogging event. In other words, TSynLog will NOT
// log the exception the event handler returns true, otherwise the exception wil be logged.
property HandleExceptionBeforeLogging: TSynLogExceptionHandlingEvent read FHandleExceptionBeforeLogging write
FHandleExceptionBeforeLogging;
published
/// the associated TSynLog class
property SynLogClassName: string read GetSynLogClassName;
@@ -2573,9 +2562,6 @@ procedure SynLogException(const Ctxt: TSynLogExceptionContext);
if (Ctxt.EClass=ESynLogSilent) or
(SynLog.fFamily.ExceptionIgnore.IndexOf(Ctxt.EClass)>=0) then
exit;
if Assigned(SynLog.fFamily.FHandleExceptionBeforeLogging) then
if SynLog.fFamily.FHandleExceptionBeforeLogging(Ctxt) then
exit;
if SynLog.LogHeaderLock(Ctxt.ELevel,false) then
try
if GlobalLastExceptionIndex=MAX_EXCEPTHISTORY then
@@ -97,7 +97,8 @@ TSecContext = record
TSecContextDynArray = array of TSecContext;
/// defines a SSPI buffer
TSecBuffer = object
{$ifdef UNICODE}TSecBuffer = record{$else}TSecBuffer = object{$endif}
public
cbBuffer: Cardinal;
BufferType: Cardinal;
pvBuffer: Pointer;
@@ -106,7 +107,8 @@ TSecContext = record
PSecBuffer = ^TSecBuffer;
/// describes a SSPI buffer
TSecBufferDesc = object
{$ifdef UNICODE}TSecBufferDesc = record{$else}TSecBufferDesc = object{$endif}
public
ulVersion: Cardinal;
cBuffers: Cardinal;
pBuffers: PSecBuffer;
@@ -1116,7 +1116,7 @@ TComplexNumber = class(TPersistent)
end;
/// a record used by IComplexCalculator.EchoRecord
TConsultaNav = object
{$ifdef UNICODE}TConsultaNav = record{$else}TConsultaNav = object{$endif}
public
MaxRows, Row0, RowCount: int64;
IsSQLUpdateBack, EOF: boolean;
Oops, something went wrong.

0 comments on commit af47c68

Please sign in to comment.