You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.6 KiB

  1. unit uutlTypeInfo;
  2. {$mode objfpc}{$H+}
  3. {$ModeSwitch advancedrecords}
  4. interface
  5. uses
  6. Classes, SysUtils, variants;
  7. type
  8. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. TutlVariantType = (
  10. vtNull,
  11. // boolean
  12. vtBool,
  13. vtByteBool,
  14. vtWordBool,
  15. vtLongBool,
  16. // signed
  17. vtShortInt,
  18. vtSmallInt,
  19. vtLongInt,
  20. vtInt64,
  21. // unsigned
  22. vtByte,
  23. vtWord,
  24. vtLongWord,
  25. vtQuadWord,
  26. // floating point
  27. vtSingle,
  28. vtDouble,
  29. vtExtended,
  30. // characters
  31. vtAnsiChar,
  32. vtWideChar,
  33. // strings
  34. vtShortString,
  35. vtAnsiString,
  36. vtWideString,
  37. vtUnicodeString,
  38. vtUTF8String
  39. );
  40. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  41. TutlVariant = packed record
  42. private
  43. function GetVarType: TutlVariantType;
  44. public
  45. property VarType: TutlVariantType read GetVarType;
  46. private
  47. case fType: TutlVariantType of
  48. vtNull: ();
  49. // boolean
  50. vtBool: (fBool: Boolean);
  51. vtByteBool: (fByteBool: ByteBool);
  52. vtWordBool: (fWordBool: WordBool);
  53. vtLongBool: (fLongBool: LongBool);
  54. // signed
  55. vtShortInt: (fShortInt: ShortInt);
  56. vtSmallInt: (fSmallInt: SmallInt);
  57. vtLongInt: (fLongInt: LongInt);
  58. vtInt64: (fInt64: Int64);
  59. // unsigned
  60. vtByte: (fByte: Byte);
  61. vtWord: (fWord: Word);
  62. vtLongWord: (fLongWord: LongWord);
  63. vtQuadWord: (fQuadWord: QWord);
  64. // floating point
  65. vtSingle: (fFloat: Single);
  66. vtDouble: (fDouble: Double);
  67. vtExtended: (fExtended: Extended);
  68. // characters
  69. vtAnsiChar: (fAnsiChar: AnsiChar);
  70. vtWideChar: (fWideChar: WideChar);
  71. // strings
  72. vtShortString: (fShortString: ShortString);
  73. end;
  74. implementation
  75. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  76. //TutlVariant////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  77. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  78. function TutlVariant.GetVarType: TutlVariantType;
  79. begin
  80. result := fType;
  81. end;
  82. end.