objpash.inc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2011 by Jonas Maebe
  4. member of the Free Pascal development team.
  5. This file implements the helper routines for TObject
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************
  12. }
  13. type
  14. TObject = class(JLObject)
  15. strict private
  16. DestructorCalled: Boolean;
  17. public
  18. procedure Free;
  19. destructor Destroy; virtual;
  20. procedure finalize; override;
  21. end;
  22. TClass = class of TObject;
  23. TJClass = class of jlobject;
  24. const
  25. vtInteger = 0;
  26. vtBoolean = 1;
  27. vtChar = 2;
  28. {$ifndef FPUNONE}
  29. vtExtended = 3;
  30. {$endif}
  31. vtString = 4;
  32. vtPointer = 5;
  33. vtPChar = 6;
  34. vtObject = 7;
  35. vtClass = 8;
  36. vtWideChar = 9;
  37. vtPWideChar = 10;
  38. vtAnsiString = 11;
  39. vtCurrency = 12;
  40. vtVariant = 13;
  41. vtInterface = 14;
  42. vtWideString = 15;
  43. vtInt64 = 16;
  44. vtQWord = 17;
  45. vtUnicodeString = 18;
  46. type
  47. TVarRec = record
  48. VType: sizeint;
  49. Value: JLObject;
  50. procedure init(l: longint);
  51. procedure init(b: boolean);
  52. procedure init(c: ansichar);
  53. procedure init(w: widechar);
  54. procedure init(d: extended);
  55. procedure init(const s: shortstring);
  56. // pointer = object -> use constref to get different signature
  57. procedure init(constref p: pointer);
  58. procedure init(p: pchar);
  59. procedure init(p: JLObject);
  60. procedure init(c: TJClass);
  61. procedure init(p: pwidechar);
  62. procedure init(const a: ansistring);
  63. // currency = int64 -> use constref to get different signature
  64. procedure init(constref c: currency);
  65. // procedure init(const v: variant);
  66. // interface = object
  67. procedure init(const w: widestring);
  68. procedure init(i: int64);
  69. // unicodestring = widestring
  70. // qword = int64 -> extra parameter to solve signature problem
  71. procedure init(q: qword; unsigned: boolean = true);
  72. function VInteger: longint;
  73. function VBoolean: boolean;
  74. function VChar: ansichar;
  75. function VWideChar: widechar;
  76. function VExtended: PExtended;
  77. function VDouble: double;
  78. function VString: PShortString;
  79. function VPointer: pointer;
  80. function VPChar: PChar;
  81. function VObject: JLObject;
  82. function VClass: TJClass;
  83. function VPWideChar: PWideChar;
  84. function VAnsiString: Pointer;
  85. function VCurrency: PCurrency;
  86. // function VVariant: PVariant;
  87. function VInterface: JLObject;
  88. function VWideString: Pointer;
  89. function VInt64: PInt64;
  90. function VUnicodeString: Pointer;
  91. function VQWord: PQWord;
  92. end;