|
- unit uutlTypeInfo;
-
- {$mode objfpc}{$H+}
- {$ModeSwitch advancedrecords}
-
- interface
-
- uses
- Classes, SysUtils, variants;
-
- type
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TutlVariantType = (
- vtNull,
-
- // boolean
- vtBool,
- vtByteBool,
- vtWordBool,
- vtLongBool,
-
- // signed
- vtShortInt,
- vtSmallInt,
- vtLongInt,
- vtInt64,
-
- // unsigned
- vtByte,
- vtWord,
- vtLongWord,
- vtQuadWord,
-
- // floating point
- vtSingle,
- vtDouble,
- vtExtended,
-
- // characters
- vtAnsiChar,
- vtWideChar,
-
- // strings
- vtShortString,
- vtAnsiString,
- vtWideString,
- vtUnicodeString,
- vtUTF8String
- );
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TutlVariant = packed record
- private
- function GetVarType: TutlVariantType;
-
- public
- property VarType: TutlVariantType read GetVarType;
-
- private
- case fType: TutlVariantType of
- vtNull: ();
-
- // boolean
- vtBool: (fBool: Boolean);
- vtByteBool: (fByteBool: ByteBool);
- vtWordBool: (fWordBool: WordBool);
- vtLongBool: (fLongBool: LongBool);
-
- // signed
- vtShortInt: (fShortInt: ShortInt);
- vtSmallInt: (fSmallInt: SmallInt);
- vtLongInt: (fLongInt: LongInt);
- vtInt64: (fInt64: Int64);
-
- // unsigned
- vtByte: (fByte: Byte);
- vtWord: (fWord: Word);
- vtLongWord: (fLongWord: LongWord);
- vtQuadWord: (fQuadWord: QWord);
-
- // floating point
- vtSingle: (fFloat: Single);
- vtDouble: (fDouble: Double);
- vtExtended: (fExtended: Extended);
-
- // characters
- vtAnsiChar: (fAnsiChar: AnsiChar);
- vtWideChar: (fWideChar: WideChar);
-
- // strings
- vtShortString: (fShortString: ShortString);
- end;
-
- implementation
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //TutlVariant////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TutlVariant.GetVarType: TutlVariantType;
- begin
- result := fType;
- end;
-
- end.
|