typinfo.pp 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Florian Klaempfl
  5. member of the Free Pascal development team
  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. { This unit provides the same Functionality as the TypInfo Unit }
  13. { of Delphi }
  14. unit typinfo;
  15. interface
  16. {$MODE objfpc}
  17. uses SysUtils;
  18. // temporary types:
  19. type
  20. PShortString =^ShortString;
  21. PByte =^Byte;
  22. PWord =^Word;
  23. PLongint =^Longint;
  24. PBoolean =^Boolean;
  25. PSingle =^Single;
  26. PDouble =^Double;
  27. PExtended =^Extended;
  28. PComp =^Comp;
  29. {$ifdef HASFIXED}
  30. PFixed16 =^Fixed16;
  31. {$endif HASFIXED}
  32. { Doesn't exist ?
  33. PFIxed32 = ^Fixed32;
  34. }
  35. Variant = Pointer;
  36. {$MINENUMSIZE 1 this saves a lot of memory }
  37. // if you change one of the following enumeration types
  38. // you have also to change the compiler in an appropriate way !
  39. TTypeKind = (tkUnknown,tkInteger,tkChar,tkEnumeration,
  40. tkFloat,tkSet,tkMethod,tkSString,tkLString,tkAString,
  41. tkWString,tkVariant,tkArray,tkRecord,tkInterface,
  42. tkClass,tkObject,tkWChar,tkBool,tkInt64,tkQWord,
  43. tkDynArray,tkInterfaceRaw);
  44. TTOrdType = (otSByte,otUByte,otSWord,otUWord,otSLong,otULong);
  45. TFloatType = (ftSingle,ftDouble,ftExtended,ftComp,ftCurr,
  46. ftFixed16,ftFixed32);
  47. TMethodKind = (mkProcedure,mkFunction,mkConstructor,mkDestructor,
  48. mkClassProcedure, mkClassFunction);
  49. TParamFlags = set of (pfVar,pfConst,pfArray,pfAddress,pfReference,pfOut);
  50. TIntfFlags = set of (ifHasGuid,ifDispInterface,ifDispatch);
  51. {$MINENUMSIZE DEFAULT}
  52. const
  53. ptField = 0;
  54. ptStatic = 1;
  55. ptVirtual = 2;
  56. ptConst = 3;
  57. tkString = tkSString;
  58. type
  59. TTypeKinds = set of TTypeKind;
  60. {$PACKRECORDS 1}
  61. TTypeInfo = record
  62. Kind : TTypeKind;
  63. Name : ShortString;
  64. // here the type data follows as TTypeData record
  65. end;
  66. PTypeInfo = ^TTypeInfo;
  67. PPTypeInfo = ^PTypeInfo;
  68. PTypeData = ^TTypeData;
  69. TTypeData = packed record
  70. case TTypeKind of
  71. tkUnKnown,tkLString,tkWString,tkAString,tkVariant:
  72. ();
  73. tkInteger,tkChar,tkEnumeration,tkWChar:
  74. (OrdType : TTOrdType;
  75. case TTypeKind of
  76. tkInteger,tkChar,tkEnumeration,tkBool,tkWChar : (
  77. MinValue,MaxValue : Longint;
  78. case TTypeKind of
  79. tkEnumeration:
  80. (
  81. BaseType : PTypeInfo;
  82. NameList : ShortString)
  83. );
  84. tkSet:
  85. (CompType : PTypeInfo)
  86. );
  87. tkFloat:
  88. (FloatType : TFloatType);
  89. tkSString:
  90. (MaxLength : Byte);
  91. tkClass:
  92. (ClassType : TClass;
  93. ParentInfo : PTypeInfo;
  94. PropCount : SmallInt;
  95. UnitName : ShortString
  96. // here the properties follow as array of TPropInfo
  97. );
  98. tkMethod:
  99. (MethodKind : TMethodKind;
  100. ParamCount : Byte;
  101. ParamList : array[0..1023] of Char
  102. {in reality ParamList is a array[1..ParamCount] of:
  103. record
  104. Flags : TParamFlags;
  105. ParamName : ShortString;
  106. TypeName : ShortString;
  107. end;
  108. followed by
  109. ResultType : ShortString}
  110. );
  111. tkInt64:
  112. (MinInt64Value, MaxInt64Value: Int64);
  113. tkQWord:
  114. (MinQWordValue, MaxQWordValue: QWord);
  115. tkInterface,
  116. tkInterfaceRaw:
  117. (
  118. IntfParent: PPTypeInfo;
  119. IID: PGUID;
  120. IIDStr: ShortString;
  121. IntfUnit: ShortString;
  122. );
  123. end;
  124. // unsed, just for completeness
  125. TPropData = packed record
  126. PropCount : Word;
  127. PropList : record end;
  128. end;
  129. PPropInfo = ^TPropInfo;
  130. TPropInfo = packed record
  131. PropType : PTypeInfo;
  132. GetProc : Pointer;
  133. SetProc : Pointer;
  134. StoredProc : Pointer;
  135. Index : Integer;
  136. Default : Longint;
  137. NameIndex : SmallInt;
  138. // contains the type of the Get/Set/Storedproc, see also ptxxx
  139. // bit 0..1 GetProc
  140. // 2..3 SetProc
  141. // 4..5 StoredProc
  142. // 6 : true, constant index property
  143. PropProcs : Byte;
  144. Name : ShortString;
  145. end;
  146. TProcInfoProc = Procedure(PropInfo : PPropInfo) of object;
  147. PPropList = ^TPropList;
  148. TPropList = array[0..65535] of PPropInfo;
  149. const
  150. tkAny = [Low(TTypeKind)..High(TTypeKind)];
  151. tkMethods = [tkMethod];
  152. tkProperties = tkAny-tkMethods-[tkUnknown];
  153. { general property handling }
  154. // just skips the id and the name
  155. Function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
  156. // searches in the property PropName
  157. Function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string) : PPropInfo;
  158. Function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string; AKinds : TTypeKinds) : PPropInfo;
  159. Function GetPropInfo(Instance: TObject; const PropName: string; AKinds: TTypeKinds) : PPropInfo;
  160. Function GetPropInfo(Instance: TObject; const PropName: string): PPropInfo;
  161. Function GetPropInfo(AClass: TClass; const PropName: string; AKinds: TTypeKinds) : PPropInfo;
  162. Function GetPropInfo(AClass: TClass; const PropName: string): PPropInfo;
  163. Procedure GetPropInfos(TypeInfo : PTypeInfo;PropList : PPropList);
  164. Function GetPropList(TypeInfo : PTypeInfo;TypeKinds : TTypeKinds;
  165. PropList : PPropList) : Integer;
  166. // Same as GetPropInfo, but raises an exception if not found.
  167. Function FindPropInfo(Instance: TObject; const PropName: string): PPropInfo;
  168. Function FindPropInfo(AClass:TClass;const PropName: string): PPropInfo;
  169. // returns true, if PropInfo is a stored property
  170. Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean;
  171. { subroutines to read/write properties }
  172. Function GetOrdProp(Instance : TObject;PropInfo : PPropInfo) : Longint;
  173. Procedure SetOrdProp(Instance : TObject;PropInfo : PPropInfo;
  174. Value : Longint);
  175. Function GetStrProp(Instance : TObject;PropInfo : PPropInfo) : Ansistring;
  176. Procedure SetStrProp(Instance : TObject;PropInfo : PPropInfo;
  177. const Value : Ansistring);
  178. Function GetFloatProp(Instance : TObject;PropInfo : PPropInfo) : Extended;
  179. Procedure SetFloatProp(Instance : TObject;PropInfo : PPropInfo;
  180. Value : Extended);
  181. Function GetVariantProp(Instance : TObject;PropInfo : PPropInfo): Variant;
  182. Procedure SetVariantProp(Instance : TObject;PropInfo : PPropInfo;
  183. const Value: Variant);
  184. Function GetMethodProp(Instance : TObject;PropInfo : PPropInfo) : TMethod;
  185. Procedure SetMethodProp(Instance : TObject;PropInfo : PPropInfo;
  186. const Value : TMethod);
  187. Function GetInt64Prop(Instance: TObject; PropInfo: PPropInfo): Int64;
  188. Procedure SetInt64Prop(Instance: TObject; PropInfo: PPropInfo;
  189. const Value: Int64);
  190. { misc. stuff }
  191. Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
  192. Function GetEnumValue(TypeInfo : PTypeInfo;const Name : string) : Integer;
  193. function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean) : String;
  194. function SetToString(PropInfo: PPropInfo; Value: Integer) : String;
  195. function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
  196. { Easy access methods, appeared in Delphi 5 }
  197. Function IsPublishedProp(Instance: TObject; const PropName: string): Boolean;
  198. Function IsPublishedProp(AClass: TClass; const PropName: string): Boolean;
  199. Function PropIsType(Instance: TObject; const PropName: string; TypeKind: TTypeKind): Boolean;
  200. Function PropIsType(AClass: TClass; const PropName: string; TypeKind: TTypeKind): Boolean;
  201. Function PropType(Instance: TObject; const PropName: string): TTypeKind;
  202. Function PropType(AClass: TClass; const PropName: string): TTypeKind;
  203. Function IsStoredProp(Instance: TObject; const PropName: string): Boolean;
  204. Function GetOrdProp(Instance: TObject; const PropName: string): Longint;
  205. Procedure SetOrdProp(Instance: TObject; const PropName: string; Value: Longint);
  206. Function GetEnumProp(Instance: TObject; const PropName: string): string;
  207. Function GetEnumProp(Instance: TObject; const PropInfo: PPropInfo): string;
  208. Procedure SetEnumProp(Instance: TObject; const PropName: string;const Value: string);
  209. Procedure SetEnumProp(Instance: TObject; const PropInfo: PPropInfo;const Value: string);
  210. // Default false
  211. Function GetSetProp(Instance: TObject; const PropName: string): string;
  212. Function GetSetProp(Instance: TObject; const PropName: string; Brackets: Boolean): string;
  213. Function GetSetProp(Instance: TObject; const PropInfo: PPropInfo; Brackets: Boolean): string;
  214. Procedure SetSetProp(Instance: TObject; const PropName: string; const Value: string);
  215. Procedure SetSetProp(Instance: TObject; const PropInfo: PPropInfo; const Value: string);
  216. // Default nil
  217. Function GetObjectProp(Instance: TObject; const PropName: string): TObject;
  218. Function GetObjectProp(Instance: TObject; const PropName: string; MinClass: TClass): TObject;
  219. Procedure SetObjectProp(Instance: TObject; const PropName: string; Value: TObject);
  220. Function GetObjectPropClass(Instance: TObject; const PropName: string): TClass;
  221. Function GetStrProp(Instance: TObject; const PropName: string): string;
  222. Procedure SetStrProp(Instance: TObject; const PropName: string; const Value: string);
  223. Function GetFloatProp(Instance: TObject; const PropName: string): Extended;
  224. Procedure SetFloatProp(Instance: TObject; const PropName: string; Value: Extended);
  225. Function GetVariantProp(Instance: TObject; const PropName: string): Variant;
  226. Procedure SetVariantProp(Instance: TObject; const PropName: string; const Value: Variant);
  227. Function GetMethodProp(Instance: TObject; const PropName: string): TMethod;
  228. Procedure SetMethodProp(Instance: TObject; const PropName: string; const Value: TMethod);
  229. Function GetInt64Prop(Instance: TObject; const PropName: string): Int64;
  230. Procedure SetInt64Prop(Instance: TObject; const PropName: string; const Value: Int64);
  231. // Default True
  232. Function GetPropValue(Instance: TObject; const PropName: string): Variant;
  233. Function GetPropValue(Instance: TObject; const PropName: string; PreferStrings: Boolean): Variant;
  234. Procedure SetPropValue(Instance: TObject; const PropName: string; const Value: Variant);
  235. const
  236. BooleanIdents: array[Boolean] of String = ('False', 'True');
  237. DotSep: String = '.';
  238. Type
  239. EPropertyError = Class(Exception);
  240. Implementation
  241. ResourceString
  242. SErrPropertyNotFound = 'Unknown property: "%s"';
  243. SErrUnknownEnumValue = 'Unknown enumeration value: "%s"';
  244. type
  245. PMethod = ^TMethod;
  246. { ---------------------------------------------------------------------
  247. Auxiliary methods
  248. ---------------------------------------------------------------------}
  249. Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
  250. Var PS : PShortString;
  251. PT : PTypeData;
  252. begin
  253. PT:=GetTypeData(TypeInfo);
  254. // ^.BaseType);
  255. // If PT^.MinValue<0 then Value:=Ord(Value<>0); {map to 0/1}
  256. PS:=@PT^.NameList;
  257. While Value>0 Do
  258. begin
  259. PS:=PShortString(pointer(PS)+PByte(PS)^+1);
  260. Dec(Value);
  261. end;
  262. Result:=PS^;
  263. end;
  264. Function GetEnumValue(TypeInfo : PTypeInfo;const Name : string) : Integer;
  265. Var PS : PShortString;
  266. PT : PTypeData;
  267. Count : longint;
  268. begin
  269. If Length(Name)=0 then exit(-1);
  270. PT:=GetTypeData(TypeInfo);
  271. Count:=0;
  272. Result:=-1;
  273. PS:=@PT^.NameList;
  274. While (Result=-1) and (PByte(PS)^<>0) do
  275. begin
  276. If CompareText(PS^, Name) = 0 then
  277. Result:=Count;
  278. PS:=PShortString(pointer(PS)+PByte(PS)^+1);
  279. Inc(Count);
  280. end;
  281. end;
  282. Function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean) : String;
  283. Var
  284. I : Integer;
  285. PTI : PTypeInfo;
  286. begin
  287. PTI:=GetTypeData(PropInfo^.PropType)^.CompType;
  288. Result:='';
  289. For I:=0 to SizeOf(Integer)*8-1 do
  290. begin
  291. if ((Value and 1)<>0) then
  292. begin
  293. If Result='' then
  294. Result:=GetEnumName(PTI,i)
  295. else
  296. Result:=Result+','+GetEnumName(PTI,I);
  297. end;
  298. Value:=Value shr 1;
  299. end;
  300. if Brackets then
  301. Result:='['+Result+']';
  302. end;
  303. Function SetToString(PropInfo: PPropInfo; Value: Integer) : String;
  304. begin
  305. Result:=SetToString(PropInfo,Value,False);
  306. end;
  307. Const
  308. SetDelim = ['[',']',',',' '];
  309. Function GetNextElement(Var S : String) : String;
  310. Var
  311. J : Integer;
  312. begin
  313. J:=1;
  314. Result:='';
  315. If Length(S)>0 then
  316. begin
  317. While (J<=Length(S)) and Not (S[j] in SetDelim) do
  318. Inc(j);
  319. Result:=Copy(S,1,j-1);
  320. Delete(S,1,j);
  321. end;
  322. end;
  323. Function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
  324. Var
  325. S,T : String;
  326. I : Integer;
  327. PTI : PTypeInfo;
  328. begin
  329. Result:=0;
  330. PTI:=GetTypeData(PropInfo^.PropType)^.Comptype;
  331. S:=Value;
  332. I:=1;
  333. If Length(S)>0 then
  334. begin
  335. While (I<=Length(S)) and (S[i] in SetDelim) do
  336. Inc(I);
  337. Delete(S,1,i-1);
  338. end;
  339. While (S<>'') do
  340. begin
  341. T:=GetNextElement(S);
  342. if T<>'' then
  343. begin
  344. I:=GetEnumValue(PTI,T);
  345. if (I<0) then
  346. raise EPropertyError.CreateFmt(SErrUnknownEnumValue, [T]);
  347. Result:=Result or (1 shl i);
  348. end;
  349. end;
  350. end;
  351. Function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
  352. begin
  353. GetTypeData:=PTypeData(pointer(TypeInfo)+2+PByte(pointer(TypeInfo)+1)^);
  354. end;
  355. { ---------------------------------------------------------------------
  356. Low-level calling of methods.
  357. ---------------------------------------------------------------------}
  358. {$ASMMODE ATT}
  359. Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt): Int64; assembler;
  360. asm
  361. movl S,%esi
  362. movl Address,%edi
  363. // ? Indexed Function
  364. movl Index,%eax
  365. testl %eax,%eax
  366. je .LINoPush
  367. movl IValue,%eax
  368. pushl %eax
  369. .LINoPush:
  370. push %esi
  371. call %edi
  372. // now the result is in EDX:EAX
  373. end;
  374. Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IValue : Longint) : Integer;assembler;
  375. asm
  376. movl S,%esi
  377. movl Address,%edi
  378. // Push value to set
  379. movl Value,%eax
  380. pushl %eax
  381. // ? Indexed Procedure
  382. movl Index,%eax
  383. testl %eax,%eax
  384. je .LIPNoPush
  385. movl IValue,%eax
  386. pushl %eax
  387. .LIPNoPush:
  388. pushl %esi
  389. call %edi
  390. end;
  391. Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint) : Extended;assembler;
  392. asm
  393. movl S,%esi
  394. movl Address,%edi
  395. // ? Indexed Function
  396. movl Index,%eax
  397. testl %eax,%eax
  398. je .LINoPush
  399. movl IValue,%eax
  400. pushl %eax
  401. .LINoPush:
  402. push %esi
  403. call %edi
  404. //
  405. end;
  406. Function CallExtendedProc(s : Pointer;Address : Pointer;Value : Extended; INdex,IVAlue : Longint) : Integer;assembler;
  407. asm
  408. movl S,%esi
  409. movl Address,%edi
  410. // Push value to set
  411. leal Value,%eax
  412. pushl (%eax)
  413. pushl 4(%eax)
  414. pushl 8(%eax)
  415. // ? Indexed Procedure
  416. movl Index,%eax
  417. testl %eax,%eax
  418. je .LIPNoPush
  419. movl IValue,%eax
  420. pushl %eax
  421. .LIPNoPush:
  422. push %esi
  423. call %edi
  424. end;
  425. Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint) : Boolean;assembler;
  426. asm
  427. movl S,%esi
  428. movl Address,%edi
  429. // ? Indexed Function
  430. movl Index,%eax
  431. testl %eax,%eax
  432. je .LBNoPush
  433. movl IValue,%eax
  434. pushl %eax
  435. .LBNoPush:
  436. push %esi
  437. call %edi
  438. end;
  439. // Assembler Functions can't have short stringreturn values.
  440. // So we make a Procedure with var parameter.
  441. // That's not true (FK)
  442. Procedure CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint;
  443. Var Res: Shortstring);assembler;
  444. asm
  445. movl S,%esi
  446. movl Address,%edi
  447. // ? Indexed Function
  448. movl Index,%eax
  449. testl %eax,%eax
  450. jnz .LSSNoPush
  451. movl IValue,%eax
  452. pushl %eax
  453. // the result is stored in an invisible parameter
  454. pushl Res
  455. .LSSNoPush:
  456. push %esi
  457. call %edi
  458. end;
  459. Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortString; INdex,IVAlue : Longint);assembler;
  460. asm
  461. movl S,%esi
  462. movl Address,%edi
  463. // Push value to set
  464. movl Value,%eax
  465. pushl %eax
  466. // ? Indexed Procedure
  467. movl Index,%eax
  468. testl %eax,%eax
  469. je .LSSPNoPush
  470. movl IValue,%eax
  471. pushl %eax
  472. .LSSPNoPush:
  473. pushl %esi
  474. call %edi
  475. end;
  476. { ---------------------------------------------------------------------
  477. Basic Type information functions.
  478. ---------------------------------------------------------------------}
  479. Function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string) : PPropInfo;
  480. var
  481. hp : PTypeData;
  482. i : longint;
  483. p : string;
  484. begin
  485. P:=UpCase(PropName);
  486. while Assigned(TypeInfo) do
  487. begin
  488. // skip the name
  489. hp:=GetTypeData(Typeinfo);
  490. // the class info rtti the property rtti follows immediatly
  491. Result:=PPropInfo(pointer(@hp^.UnitName)+Length(hp^.UnitName)+1+SizeOF(Word));
  492. for i:=1 to hp^.PropCount do
  493. begin
  494. // found a property of that name ?
  495. if Upcase(Result^.Name)=P then
  496. exit;
  497. // skip to next property
  498. Result:=PPropInfo(pointer(@Result^.Name)+byte(Result^.Name[0])+1);
  499. end;
  500. // parent class
  501. Typeinfo:=hp^.ParentInfo;
  502. end;
  503. Result:=Nil;
  504. end;
  505. Function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string; Akinds : TTypeKinds) : PPropInfo;
  506. begin
  507. Result:=GetPropInfo(TypeInfo,PropName);
  508. If (Akinds<>[]) then
  509. If (Result<>Nil) then
  510. If Not (Result^.PropType^.Kind in AKinds) then
  511. Result:=Nil;
  512. end;
  513. Function GetPropInfo(AClass: TClass; const PropName: string; AKinds: TTypeKinds) : PPropInfo;
  514. begin
  515. Result:=GetPropInfo(PTypeInfo(AClass.ClassInfo),PropName,AKinds);
  516. end;
  517. Function GetPropInfo(Instance: TObject; const PropName: string; AKinds: TTypeKinds) : PPropInfo;
  518. begin
  519. Result:=GetPropInfo(Instance.ClassType,PropName,AKinds);
  520. end;
  521. Function GetPropInfo(Instance: TObject; const PropName: string): PPropInfo;
  522. begin
  523. Result:=GetPropInfo(Instance,PropName,[]);
  524. end;
  525. Function GetPropInfo(AClass: TClass; const PropName: string): PPropInfo;
  526. begin
  527. Result:=GetPropInfo(AClass,PropName,[]);
  528. end;
  529. Function FindPropInfo(Instance: TObject; const PropName: string): PPropInfo;
  530. begin
  531. result:=GetPropInfo(Instance, PropName);
  532. if Result=nil then
  533. Raise EPropertyError.CreateFmt(SErrPropertyNotFound, [PropName]);
  534. end;
  535. Function FindPropInfo(AClass:TClass;const PropName: string): PPropInfo;
  536. begin
  537. result:=GetPropInfo(AClass,PropName);
  538. if result=nil then
  539. Raise EPropertyError.CreateFmt(SErrPropertyNotFound, [PropName]);
  540. end;
  541. Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean;
  542. begin
  543. case (PropInfo^.PropProcs shr 4) and 3 of
  544. ptfield:
  545. IsStoredProp:=PBoolean(Pointer(Instance)+Longint(PropInfo^.StoredProc))^;
  546. ptstatic:
  547. IsStoredProp:=CallBooleanFunc(Instance,PropInfo^.StoredProc,0,0);
  548. ptvirtual:
  549. IsStoredProp:=CallBooleanFunc(Instance,ppointer(Pointer(Instance.ClassType)+Longint(PropInfo^.StoredProc))^,0,0);
  550. ptconst:
  551. IsStoredProp:=LongBool(PropInfo^.StoredProc);
  552. end;
  553. end;
  554. Procedure GetPropInfos(TypeInfo : PTypeInfo;PropList : PPropList);
  555. {
  556. Store Pointers to property information in the list pointed
  557. to by proplist. PRopList must contain enough space to hold ALL
  558. properties.
  559. }
  560. Type PWord = ^Word;
  561. Var TD : PTypeData;
  562. TP : PPropInfo;
  563. Count : Longint;
  564. begin
  565. TD:=GetTypeData(TypeInfo);
  566. // Get this objects TOTAL published properties count
  567. TP:=(@TD^.UnitName+Length(TD^.UnitName)+1);
  568. Count:=PWord(TP)^;
  569. // Now point TP to first propinfo record.
  570. Inc(Longint(TP),SizeOF(Word));
  571. While Count>0 do
  572. begin
  573. PropList^[0]:=TP;
  574. Inc(Longint(PropList),SizeOf(Pointer));
  575. // Point to TP next propinfo record.
  576. // Located at Name[Length(Name)+1] !
  577. TP:=PPropInfo(pointer(@TP^.Name)+PByte(@TP^.Name)^+1);
  578. Dec(Count);
  579. end;
  580. // recursive call for parent info.
  581. If TD^.Parentinfo<>Nil then
  582. GetPropInfos (TD^.ParentInfo,PropList);
  583. end;
  584. Procedure InsertProp (PL : PProplist;PI : PPropInfo; Count : longint);
  585. Var I : Longint;
  586. begin
  587. I:=0;
  588. While (I<Count) and (PI^.Name>PL^[I]^.Name) do Inc(I);
  589. If I<Count then
  590. Move(PL^[I], PL^[I+1], (Count - I) * SizeOf(Pointer));
  591. PL^[I]:=PI;
  592. end;
  593. Function GetPropList(TypeInfo : PTypeInfo;TypeKinds : TTypeKinds;
  594. PropList : PPropList) : Integer;
  595. {
  596. Store Pointers to property information OF A CERTAIN KIND in the list pointed
  597. to by proplist. PRopList must contain enough space to hold ALL
  598. properties.
  599. }
  600. Var TempList : PPropList;
  601. PropInfo : PPropinfo;
  602. I,Count : longint;
  603. begin
  604. Result:=0;
  605. Count:=GetTypeData(TypeInfo)^.Propcount;
  606. If Count>0 then
  607. begin
  608. GetMem(TempList,Count*SizeOf(Pointer));
  609. Try
  610. GetPropInfos(TypeInfo,TempList);
  611. For I:=0 to Count-1 do
  612. begin
  613. PropInfo:=TempList^[i];
  614. If PropInfo^.PropType^.Kind in TypeKinds then
  615. begin
  616. InsertProp(PropList,PropInfo,Result);
  617. Inc(Result);
  618. end;
  619. end;
  620. finally
  621. FreeMem(TempList,Count*SizeOf(Pointer));
  622. end;
  623. end;
  624. end;
  625. Procedure SetIndexValues (P: PPRopInfo; Var Index,IValue : Longint);
  626. begin
  627. Index:=((P^.PropProcs shr 6) and 1);
  628. If Index<>0 then
  629. IValue:=P^.Index
  630. else
  631. IValue:=0;
  632. end;
  633. { ---------------------------------------------------------------------
  634. Property access functions
  635. ---------------------------------------------------------------------}
  636. { ---------------------------------------------------------------------
  637. Ordinal properties
  638. ---------------------------------------------------------------------}
  639. Function GetOrdProp(Instance : TObject;PropInfo : PPropInfo) : Longint;
  640. var
  641. value,Index,Ivalue : longint;
  642. TypeInfo: PTypeInfo;
  643. begin
  644. SetIndexValues(PropInfo,Index,Ivalue);
  645. case (PropInfo^.PropProcs) and 3 of
  646. ptfield:
  647. Value:=PLongint(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  648. ptstatic:
  649. Value:=CallIntegerFunc(Instance,PropInfo^.GetProc,Index,IValue);
  650. ptvirtual:
  651. Value:=CallIntegerFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,IValue);
  652. end;
  653. { cut off unnecessary stuff }
  654. TypeInfo := PropInfo^.PropType;
  655. case TypeInfo^.Kind of
  656. tkChar, tkBool:
  657. Value:=Value and $ff;
  658. tkWChar:
  659. Value:=Value and $ffff;
  660. tkInteger:
  661. case GetTypeData(TypeInfo)^.OrdType of
  662. otSWord,otUWord:
  663. Value:=Value and $ffff;
  664. otSByte,otUByte:
  665. Value:=Value and $ff;
  666. end;
  667. end;
  668. GetOrdProp:=Value;
  669. end;
  670. Procedure SetOrdProp(Instance : TObject;PropInfo : PPropInfo;
  671. Value : Longint);
  672. var
  673. Index,IValue : Longint;
  674. DataSize: Integer;
  675. begin
  676. if PropInfo^.PropType^.Kind <> tkClass then
  677. { cut off unnecessary stuff }
  678. case GetTypeData(PropInfo^.PropType)^.OrdType of
  679. otSWord,otUWord:
  680. begin
  681. Value:=Value and $ffff;
  682. DataSize := 2;
  683. end;
  684. otSByte,otUByte:
  685. begin
  686. Value:=Value and $ff;
  687. DataSize := 1;
  688. end;
  689. else
  690. DataSize := 4;
  691. end
  692. else
  693. DataSize := 4;
  694. SetIndexValues(PropInfo,Index,Ivalue);
  695. case (PropInfo^.PropProcs shr 2) and 3 of
  696. ptfield:
  697. case DataSize of
  698. 1: PByte(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Byte(Value);
  699. 2: PWord(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Word(Value);
  700. 4: PLongint(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  701. end;
  702. ptstatic:
  703. CallIntegerProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
  704. ptvirtual:
  705. CallIntegerProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,Value,Index,IValue);
  706. end;
  707. end;
  708. Function GetOrdProp(Instance: TObject; const PropName: string): Longint;
  709. begin
  710. Result:=GetOrdProp(Instance,FindPropInfo(Instance,PropName));
  711. end;
  712. Procedure SetOrdProp(Instance: TObject; const PropName: string; Value: Longint);
  713. begin
  714. SetOrdProp(Instance,FindPropInfo(Instance,PropName),Value);
  715. end;
  716. Function GetEnumProp(Instance: TObject; Const PropInfo: PPropInfo): string;
  717. begin
  718. Result:=GetEnumName(PropInfo^.PropType, GetOrdProp(Instance, PropInfo));
  719. end;
  720. Function GetEnumProp(Instance: TObject; const PropName: string): string;
  721. begin
  722. Result:=GetEnumProp(Instance,FindPropInfo(Instance,PropName));
  723. end;
  724. Procedure SetEnumProp(Instance: TObject; const PropName: string; const Value: string);
  725. begin
  726. SetEnumProp(Instance,FindPropInfo(Instance,PropName),Value);
  727. end;
  728. Procedure SetEnumProp(Instance: TObject; Const PropInfo : PPropInfo; const Value: string);
  729. Var
  730. PV : Longint;
  731. begin
  732. If PropInfo<>Nil then
  733. begin
  734. PV:=GetEnumValue(PropInfo^.PropType, Value);
  735. if (PV<0) then
  736. raise EPropertyError.CreateFmt(SErrUnknownEnumValue, [Value]);
  737. SetOrdProp(Instance, PropInfo,PV);
  738. end;
  739. end;
  740. { ---------------------------------------------------------------------
  741. Set properties
  742. ---------------------------------------------------------------------}
  743. Function GetSetProp(Instance: TObject; const PropName: string): string;
  744. begin
  745. Result:=GetSetProp(Instance,PropName,False);
  746. end;
  747. Function GetSetProp(Instance: TObject; const PropName: string; Brackets: Boolean): string;
  748. begin
  749. Result:=GetSetProp(Instance,FindPropInfo(Instance,PropName),Brackets);
  750. end;
  751. Function GetSetProp(Instance: TObject; const PropInfo: PPropInfo; Brackets: Boolean): string;
  752. begin
  753. Result:=SetToString(PropInfo,GetOrdProp(Instance,PropInfo),Brackets);
  754. end;
  755. Procedure SetSetProp(Instance: TObject; const PropName: string; const Value: string);
  756. begin
  757. SetSetProp(Instance,FindPropInfo(Instance,PropName),Value);
  758. end;
  759. Procedure SetSetProp(Instance: TObject; const PropInfo: PPropInfo; const Value: string);
  760. begin
  761. SetOrdProp(Instance,PropInfo,StringToSet(PropInfo,Value));
  762. end;
  763. { ---------------------------------------------------------------------
  764. Object properties
  765. ---------------------------------------------------------------------}
  766. Function GetObjectProp(Instance: TObject; const PropName: string): TObject;
  767. begin
  768. Result:=GetObjectProp(Instance,PropName,Nil);
  769. end;
  770. Function GetObjectProp(Instance: TObject; const PropName: string; MinClass: TClass): TObject;
  771. begin
  772. end;
  773. Procedure SetObjectProp(Instance: TObject; const PropName: string; Value: TObject);
  774. begin
  775. end;
  776. Function GetObjectPropClass(Instance: TObject; const PropName: string): TClass;
  777. begin
  778. end;
  779. { ---------------------------------------------------------------------
  780. String properties
  781. ---------------------------------------------------------------------}
  782. Function GetStrProp(Instance: TObject; PropInfo: PPropInfo): AnsiString;
  783. var
  784. Index, IValue: LongInt;
  785. ShortResult: ShortString;
  786. begin
  787. SetIndexValues(PropInfo, Index, IValue);
  788. case Propinfo^.PropType^.Kind of
  789. tkSString:
  790. case (PropInfo^.PropProcs) and 3 of
  791. ptField:
  792. Result := PShortString(Pointer(Instance) + LongWord(PropInfo^.GetProc))^;
  793. ptStatic:
  794. begin
  795. CallSStringFunc(Instance, PropInfo^.GetProc, Index, IValue, ShortResult);
  796. Result := ShortResult;
  797. end;
  798. ptVirtual:
  799. begin
  800. CallSStringFunc(Instance, PPointer(Pointer(Instance.ClassType) +
  801. LongWord(PropInfo^.GetProc))^, Index, IValue, ShortResult);
  802. Result := ShortResult;
  803. end;
  804. end;
  805. tkAString:
  806. case (PropInfo^.PropProcs) and 3 of
  807. ptField:
  808. Result := PAnsiString(Pointer(Instance) + LongWord(PropInfo^.GetProc))^;
  809. ptStatic:
  810. Pointer(Result) := Pointer(LongWord(CallIntegerFunc(Instance, PropInfo^.GetProc, Index, IValue)));
  811. ptVirtual:
  812. Pointer(Result) := Pointer(LongWord(CallIntegerFunc(Instance,
  813. PPointer(Pointer(Instance.ClassType) + LongWord(PropInfo^.GetProc))^, Index, IValue)));
  814. end;
  815. else
  816. // Property is neither of type AnsiString nor of type ShortString
  817. SetLength(Result, 0);
  818. end;
  819. end;
  820. Procedure SetAStrProp(Instance : TObject;PropInfo : PPropInfo;
  821. const Value : AnsiString);
  822. {
  823. Dirty trick based on fact that AnsiString is just a pointer,
  824. hence can be treated like an integer type.
  825. }
  826. var
  827. Index,Ivalue : Longint;
  828. begin
  829. SetIndexValues(PropInfo,Index,IValue);
  830. case (PropInfo^.PropProcs shr 2) and 3 of
  831. ptfield:
  832. PAnsiString(Pointer(Instance) + Longint(PropInfo^.SetProc))^ := Value;
  833. ptstatic:
  834. CallIntegerProc(Instance,PropInfo^.SetProc,Longint(Pointer(Value)),Index,IValue);
  835. ptvirtual:
  836. CallIntegerProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,Longint(Pointer(Value)),Index,IValue);
  837. end;
  838. end;
  839. Procedure SetSStrProp(Instance : TObject;PropInfo : PPropInfo;
  840. const Value : ShortString);
  841. Var Index,IValue: longint;
  842. begin
  843. SetIndexValues(PRopInfo,Index,IValue);
  844. case (PropInfo^.PropProcs shr 2) and 3 of
  845. ptfield:
  846. PShortString(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  847. ptstatic:
  848. CallSStringProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
  849. ptvirtual:
  850. CallSStringProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,Value,Index,IValue);
  851. end;
  852. end;
  853. Procedure SetStrProp(Instance : TObject;PropInfo : PPropInfo;
  854. const Value : AnsiString);
  855. begin
  856. Case Propinfo^.PropType^.Kind of
  857. tkSString : SetSStrProp(Instance,PropInfo,Value);
  858. tkAString : SetAStrProp(Instance,Propinfo,Value);
  859. end;
  860. end;
  861. Function GetStrProp(Instance: TObject; const PropName: string): string;
  862. begin
  863. end;
  864. Procedure SetStrProp(Instance: TObject; const PropName: string; const Value: string);
  865. begin
  866. end;
  867. { ---------------------------------------------------------------------
  868. Float properties
  869. ---------------------------------------------------------------------}
  870. Function GetFloatProp(Instance : TObject;PropInfo : PPropInfo) : Extended;
  871. var
  872. Index,Ivalue : longint;
  873. Value : Extended;
  874. begin
  875. SetIndexValues(PropInfo,Index,Ivalue);
  876. case (PropInfo^.PropProcs) and 3 of
  877. ptfield:
  878. Case GetTypeData(PropInfo^.PropType)^.FloatType of
  879. ftSingle:
  880. Value:=PSingle(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  881. ftDouble:
  882. Value:=PDouble(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  883. ftExtended:
  884. Value:=PExtended(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  885. ftcomp:
  886. Value:=PComp(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  887. { Uncommenting this code results in a internal error!!
  888. ftFixed16:
  889. Value:=PFixed16(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  890. ftfixed32:
  891. Value:=PFixed32(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  892. }
  893. end;
  894. ptstatic:
  895. Value:=CallExtendedFunc(Instance,PropInfo^.GetProc,Index,IValue);
  896. ptvirtual:
  897. Value:=CallExtendedFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,IValue);
  898. end;
  899. Result:=Value;
  900. end;
  901. Procedure SetFloatProp(Instance : TObject;PropInfo : PPropInfo;
  902. Value : Extended);
  903. Var IValue,Index : longint;
  904. begin
  905. SetIndexValues(PropInfo,Index,Ivalue);
  906. case (PropInfo^.PropProcs shr 2) and 3 of
  907. ptfield:
  908. Case GetTypeData(PropInfo^.PropType)^.FloatType of
  909. ftSingle:
  910. PSingle(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  911. ftDouble:
  912. PDouble(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  913. ftExtended:
  914. PExtended(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  915. ftcomp:
  916. PComp(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Comp(Value);
  917. { Uncommenting this code results in a internal error!!
  918. ftFixed16:
  919. PFixed16(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  920. ftfixed32:
  921. PFixed32(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
  922. }
  923. end;
  924. ptstatic:
  925. CallExtendedProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
  926. ptvirtual:
  927. CallExtendedProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,Value,Index,IValue);
  928. end;
  929. end;
  930. Function GetFloatProp(Instance: TObject; const PropName: string): Extended;
  931. begin
  932. end;
  933. Procedure SetFloatProp(Instance: TObject; const PropName: string; Value: Extended);
  934. begin
  935. end;
  936. { ---------------------------------------------------------------------
  937. Variant properties
  938. ---------------------------------------------------------------------}
  939. Function GetVariantProp(Instance : TObject;PropInfo : PPropInfo): Variant;
  940. begin
  941. {!!!!!!!!!!!}
  942. Result:=nil;
  943. end;
  944. Procedure SetVariantProp(Instance : TObject;PropInfo : PPropInfo;
  945. const Value: Variant);
  946. begin
  947. {!!!!!!!!!!!}
  948. end;
  949. Function GetVariantProp(Instance: TObject; const PropName: string): Variant;
  950. begin
  951. {!!!!!!!!!!!}
  952. end;
  953. Procedure SetVariantProp(Instance: TObject; const PropName: string; const Value: Variant);
  954. begin
  955. {!!!!!!!!!!!}
  956. end;
  957. { ---------------------------------------------------------------------
  958. Method properties
  959. ---------------------------------------------------------------------}
  960. Function GetMethodProp(Instance : TObject;PropInfo : PPropInfo) : TMethod;
  961. var
  962. value: PMethod;
  963. Index,Ivalue : longint;
  964. begin
  965. SetIndexValues(PropInfo,Index,Ivalue);
  966. case (PropInfo^.PropProcs) and 3 of
  967. ptfield:
  968. Value:=PMethod(Pointer(Instance)+Longint(PropInfo^.GetProc));
  969. ptstatic:
  970. Value:=PMethod(LongInt(CallIntegerFunc(Instance,PropInfo^.GetProc,Index,IValue)));
  971. ptvirtual:
  972. Value:=PMethod(LongInt(CallIntegerFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,IValue)));
  973. end;
  974. GetMethodProp:=Value^;
  975. end;
  976. Procedure SetMethodProp(Instance : TObject;PropInfo : PPropInfo;
  977. const Value : TMethod);
  978. var
  979. Index,IValue : Longint;
  980. begin
  981. SetIndexValues(PropInfo,Index,Ivalue);
  982. case (PropInfo^.PropProcs shr 2) and 3 of
  983. ptfield:
  984. PMethod(Pointer(Instance)+Longint(PropInfo^.SetProc))^ := Value;
  985. ptstatic:
  986. CallIntegerProc(Instance,PropInfo^.SetProc,Integer(@Value), Index, IValue);
  987. ptvirtual:
  988. CallIntegerProc(Instance,
  989. PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,
  990. Integer(@Value), Index, IValue);
  991. end;
  992. end;
  993. Function GetMethodProp(Instance: TObject; const PropName: string): TMethod;
  994. begin
  995. end;
  996. Procedure SetMethodProp(Instance: TObject; const PropName: string; const Value: TMethod);
  997. begin
  998. end;
  999. { ---------------------------------------------------------------------
  1000. Int64 properties
  1001. ---------------------------------------------------------------------}
  1002. Function GetInt64Prop(Instance: TObject; PropInfo: PPropInfo): Int64;
  1003. var
  1004. Index, IValue: LongInt;
  1005. begin
  1006. SetIndexValues(PropInfo,Index,Ivalue);
  1007. case PropInfo^.PropProcs and 3 of
  1008. ptfield:
  1009. Result := PInt64(Pointer(Instance)+Longint(PropInfo^.GetProc))^;
  1010. ptstatic:
  1011. Result := CallIntegerFunc(Instance, PropInfo^.GetProc, Index, IValue);
  1012. ptvirtual:
  1013. Result := CallIntegerFunc(Instance,
  1014. PPointer(Pointer(Instance.ClassType) + LongInt(PropInfo^.GetProc))^,
  1015. Index, IValue);
  1016. end;
  1017. end;
  1018. procedure SetInt64Prop(Instance: TObject; PropInfo: PPropInfo;
  1019. const Value: Int64);
  1020. begin
  1021. // !!!: Implement me!
  1022. end;
  1023. Function GetInt64Prop(Instance: TObject; const PropName: string): Int64;
  1024. begin
  1025. end;
  1026. Procedure SetInt64Prop(Instance: TObject; const PropName: string; const Value: Int64);
  1027. begin
  1028. end;
  1029. { ---------------------------------------------------------------------
  1030. All properties through variant.
  1031. ---------------------------------------------------------------------}
  1032. Function GetPropValue(Instance: TObject; const PropName: string): Variant;
  1033. begin
  1034. Result:=GetPropValue(Instance,PropName,True);
  1035. end;
  1036. Function GetPropValue(Instance: TObject; const PropName: string; PreferStrings: Boolean): Variant;
  1037. begin
  1038. end;
  1039. Procedure SetPropValue(Instance: TObject; const PropName: string; const Value: Variant);
  1040. begin
  1041. end;
  1042. { ---------------------------------------------------------------------
  1043. Easy access methods that appeared in Delphi 5
  1044. ---------------------------------------------------------------------}
  1045. Function IsPublishedProp(Instance: TObject; const PropName: string): Boolean;
  1046. begin
  1047. end;
  1048. Function IsPublishedProp(AClass: TClass; const PropName: string): Boolean;
  1049. begin
  1050. end;
  1051. Function PropIsType(Instance: TObject; const PropName: string; TypeKind: TTypeKind): Boolean;
  1052. begin
  1053. end;
  1054. Function PropIsType(AClass: TClass; const PropName: string; TypeKind: TTypeKind): Boolean;
  1055. begin
  1056. end;
  1057. Function PropType(Instance: TObject; const PropName: string): TTypeKind;
  1058. begin
  1059. end;
  1060. Function PropType(AClass: TClass; const PropName: string): TTypeKind;
  1061. begin
  1062. end;
  1063. Function IsStoredProp(Instance: TObject; const PropName: string): Boolean;
  1064. begin
  1065. end;
  1066. end.
  1067. {
  1068. $Log$
  1069. Revision 1.9 2001-07-06 14:56:06 peter
  1070. * merged more D5/D6 stuff from v10
  1071. Revision 1.8 2001/06/27 21:37:38 peter
  1072. * v10 merges
  1073. Revision 1.7 2001/02/15 22:40:22 sg
  1074. * Fixed SetOrdProp for class instance properties (merged from fixbranch)
  1075. Revision 1.6 2000/12/13 23:28:17 sg
  1076. * Merged bugfix for bug 1273 from fixbranch
  1077. * Fixed typo in SetFloatProp
  1078. * Rewrote GetStrProp, now all AnsiString will be correctly
  1079. reference counted
  1080. Revision 1.5 2000/11/25 18:36:55 sg
  1081. * (Final) fix for AnsiString reference counter problem in SetStrProp
  1082. Revision 1.4 2000/11/04 16:28:26 florian
  1083. * interfaces support
  1084. Revision 1.3 2000/07/17 08:37:58 sg
  1085. * Fixed GetEnumValue (bug #1049, reported by Neil Graham)
  1086. Revision 1.2 2000/07/13 11:33:52 michael
  1087. + removed logs
  1088. }