Check the type of a published property.
Source position: typinfo.pp line 1223
function PropIsType( |
Instance: TObject; |
const PropName: string; |
TypeKind: TTypeKind |
):Boolean; |
AClass: TClass; |
const PropName: string; |
TypeKind: TTypeKind |
):Boolean; |
PropIsType returns True if the property with name PropName has type TypeKind. It returns False otherwise. The class to be examined can be specified in one of two ways:
No checks are done to ensure Instance or AClass are valid pointers.Specifying an invalid property name in PropName will result in an EPropertyError exception.
|
Check whether a published property exists. |
|
|
Check whether a property is stored. |
|
|
Return the type of a property. |
program example16; { This program demonstrates the PropIsType function } {$mode objfpc} uses rttiobj,typinfo; Var O : TMyTestObject; begin O:=TMyTestObject.Create; Writeln('Property tests : '); Write('PropIsType(O,BooleanField,tkBool) : '); Writeln(PropIsType(O,'BooleanField',tkBool)); Write('PropIsType(Class,BooleanField,tkBool) : '); Writeln(PropIsType(O.ClassType,'BooleanField',tkBool)); Write('PropIsType(O,ByteField,tkString) : '); Writeln(PropisType(O,'ByteField',tkString)); Write('PropIsType(Class,ByteField,tkString) : '); Writeln(PropIsType(O.ClassType,'ByteField',tkString)); O.Free; end.