-
Declaration:
- Function FindPropInfo(AClass:TClass;const PropName: string): PPropInfo;
Function FindPropInfo(Instance: TObject; const PropName: string): PPropInfo;
-
Description:
- FindPropInfo examines the published property information of a class and returns a pointer to
the property information for property PropName. The class to be examined can be specified in one
of two ways:
-
AClass
- a class pointer.
-
Instance
- an instance of the class to be investigated.
If the property does not exist, a EPropertyError exception will be raised. The GetPropInfo (844)
function has the same function as the FindPropInfo function, but returns Nil if the property does
not exist.
-
Errors:
- Specifying an invalid property name in PropName will result in an EPropertyError
exception.
-
See also:
- GetPropInfo (844), GetPropList (846), GetPropInfos (845)
Listing: typinfex/ex14.pp
-
Declaration:
- Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
-
Description:
- GetEnumName scans the type information for the enumeration type described by TypeInfo
and returns the name of the enumeration constant for the element with ordinal value equal
to Value.
If Value is out of range, the first element of the enumeration type is returned. The result is
lowercased, but this may change in the future.
This can be used in combination with GetOrdProp to stream a property of an enumerated
type.
-
Errors:
- No check is done to determine whether TypeInfo really points to the type information for
an enumerated type.
-
See also:
- GetOrdProp (843), GetEnumValue (837)
Listing: typinfex/ex9.pp
-
Declaration:
- Function GetEnumProp(Instance: TObject;const PropInfo: PPropInfo): string;
Function GetEnumProp(Instance: TObject;const PropName: string): string;
-
Description:
- GetEnumProp returns the value of an property of an enumerated type and returns the name
of the enumerated value for the objetc Instance. The property whose value must be returned
can be specified by its property info in PropInfo or by its name in PropName
-
Errors:
- No check is done to determine whether PropInfo really points to the property information
for an enumerated type. Specifying an invalid property name in PropName will result in an
EPropertyError exception.
-
See also:
- SetEnumProp (854) GetOrdProp (843), GetStrProp (849), GetInt64Prop (838),GetMethodProp
(839), GetSetProp (848), GetObjectProp (842), GetEnumProp (836)
Listing: typinfex/ex2.pp
-
Declaration:
- Function GetEnumValue(TypeInfo : PTypeInfo;const Name : string) : Integer;
-
Description:
- GetEnumValue scans the type information for the enumeration type described by TypeInfor
and returns the ordinal value for the element in the enumerated type that has identifier Name.
The identifier is searched in a case-insensitive manner.
This can be used to set the value of enumerated properties from a stream.
-
Errors:
- If Name is not found in the list of enumerated values, then -1 is returned. No check is done
whether TypeInfo points to the type information for an enumerated type.
-
See also:
- GetEnumName (835), SetOrdProp (857)
For an example, see GetEnumName (835).
-
Declaration:
- Function GetFloatProp(Instance : TObject;PropInfo : PPropInfo) : Extended;
Procedure SetFloatProp(Instance: TObject; const PropName: string; Value:
Extended);
-
Description:
- GetFloatProp returns the value of the float property described by PropInfo or with name
Propname for the object Instance. All float types are converted to extended.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
float property of Instance. Specifying an invalid property name in PropName will result in
an EPropertyError exception.
-
See also:
- SetFloatProp (855), GetOrdProp (843), GetStrProp (849), GetInt64Prop (838),GetMethodProp
(839), GetSetProp (848), GetObjectProp (842), GetEnumProp (836)
Listing: typinfex/ex4.pp
-
Declaration:
- Function GetInt64Prop(Instance: TObject; PropInfo: PPropInfo): Int64;
Function GetInt64Prop(Instance: TObject; const PropName: string): Int64;
-
Description:
- Publishing of Int64 properties is not yet supported by Free Pascal. This function is provided
for Delphi compatibility only at the moment.
GetInt64Prop returns the value of the property of type Int64 that is described by PropInfo
or with name Propname for the object Instance.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
Int64 property of Instance. Specifying an invalid property name in PropName will result in
an EPropertyError exception
-
See also:
- SetInt64Prop (855), GetOrdProp (843), GetStrProp (849), GetFloatProp (837), GetMethodProp
(839), GetSetProp (848), GetObjectProp (842), GetEnumProp (836)
Listing: typinfex/ex15.pp
-
Declaration:
- Function GetMethodProp(Instance : TObject;PropInfo : PPropInfo) : TMethod;
Function GetMethodProp(Instance: TObject; const PropName: string): TMethod;
-
Description:
- GetMethodProp returns the method the property described by PropInfo or with name
Propname for object Instance. The return type TMethod is defined in the SysUtils unit
as:
TMethod = packed record
Code, Data: Pointer;
end;
|
Data points to the instance of the class with the method Code.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid method
property of Instance. Specifying an invalid property name in PropName will result in an
EPropertyError exception
-
See also:
- SetMethodProp (856), GetOrdProp (843), GetStrProp (849), GetFloatProp (837), GetInt64Prop
(838), GetSetProp (848), GetObjectProp (842), GetEnumProp (836)
Listing: typinfex/ex6.pp
-
Declaration:
- Function GetObjectProp(Instance: TObject; const PropName: string): TObject;
Function GetObjectProp(Instance: TObject; const PropName: string;
MinClass:TClass): TObject;
Function GetObjectProp(Instance: TObject; PropInfo: PPropInfo; MinClass:
TClass): TObject;
-
Description:
- GetObjectProp returns the object which the property descroibed by PropInfo with name
Propname points to for object Instance.
If MinClass is specified, then if the object is not descendent of class MinClass, then Nil is
returned.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
method property of Instance. Specifying an invalid property name in PropName will result
in an EPropertyError exception.
-
See also:
- SetMethodProp (856), GetOrdProp (843), GetStrProp (849), GetFloatProp (837), GetInt64Prop
(838), GetSetProp (848), GetObjectProp (842), GetEnumProp (836)
Listing: typinfex/ex5.pp
-
Declaration:
- Function GetObjectPropClass(Instance: TObject; const PropName: string):
TClass;
-
Description:
- GetObjectPropClass returns the declared class of the property with name PropName. This
may not be the actual class of the property value.
-
Errors:
- No checking is done whether Instance is non-nil. Specifying an invalid property name in
PropName will result in an EPropertyError exception.
-
See also:
- SetMethodProp (856), GetOrdProp (843), GetStrProp (849), GetFloatProp (837), GetInt64Prop
(838)
For an example, see GetObjectProp (842).
-
Declaration:
- Function GetOrdProp(Instance : TObject;PropInfo : PPropInfo) : Longint;
Function GetOrdProp(Instance: TObject;const PropName: string): Longint;
-
Description:
- GetOrdProp returns the value of the ordinal property described by PropInfo or with name
PropName for the object Instance. The value is returned as a longint, which should be
typecasted to the needed type.
Ordinal properties that can be retrieved include:
-
Integers and subranges of integers
- The value of the integer will be returned.
-
Enumerated types and subranges of enumerated types
- The ordinal value of the
enumerated type will be returned.
-
Sets
- If the base type of the set has less than 31 possible values. If a bit is set in the return
value, then the corresponding element of the base ordinal class of the set type must be
included in the set.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid ordinal
property of Instance Specifying an invalid property name in PropName will result in an
EPropertyError exception.
-
See also:
- SetOrdProp (857), GetStrProp (849), GetFloatProp (837), GetInt64Prop (838),GetMethodProp (839),
GetSetProp (848), GetObjectProp (842), GetEnumProp (836)
Listing: typinfex/ex1.pp
-
Declaration:
- Function GetPropInfo(AClass: TClass; const PropName: string; AKinds:
TTypeKinds) : PPropInfo;
Function GetPropInfo(AClass: TClass; const PropName: string): PPropInfo;
Function GetPropInfo(Instance: TObject; const PropName: string): PPropInfo;
Function GetPropInfo(Instance: TObject; const PropName: string; AKinds:
TTypeKinds) : PPropInfo;
Function GetPropInfo(TypeInfo: PTypeInfo;const PropName: string) :
PPropInfo;
Function GetPropInfo(TypeInfo: PTypeInfo;const PropName: string; AKinds :
TTypeKinds) : PPropInfo;
-
Description:
- GetPropInfo returns a pointer to the TPropInfo record for a the PropName property of a class.
The class to examine can be specified in one of three ways:
-
Instance
- An instance of the class.
-
AClass
- A class pointer to the class.
-
TypeInfo
- A pointer to the type information of the class.
In each of these three ways, if AKinds is specified, if the property has TypeKind which is not
included in Akinds, Nil will be returned.
-
Errors:
- If the property PropName does not exist, Nil is returned.
-
See also:
- GetPropInfos (845),GetPropList (846)
For an example, see most of the other functions.
-
Declaration:
- Procedure GetPropInfos(TypeInfo: PTypeInfo;PropList: PPropList);
-
Description:
- GetPropInfos stores pointers to the property information of all published properties of a
class with class info TypeInfo in the list pointed to by Proplist. The PropList pointer
must point to a memory location that contains enough space to hold all properties of the
class and its parent classes.
-
Errors:
- No checks are done to see whether PropList points to a memory area that is big enough to
hold all pointers.
-
See also:
- GetPropInfo (844),GetPropList (846)
Listing: typinfex/ex12.pp
-
Declaration:
- Function GetPropList(TypeInfo : PTypeInfo; TypeKinds : TTypeKinds; PropList
: PPropList) : Integer;
-
Description:
- GetPropList stores pointers to property information of the class with class info TypeInfo
for properties of kind TypeKinds in the list pointed to by Proplist. PropList must contain
enough space to hold all properties.
The function returns the number of pointers that matched the criteria and were stored in
PropList.
-
Errors:
- No checks are done to see whether PropList points to a memory area that is big enough to
hold all pointers.
-
See also:
- GetPropInfos (845), GetPropInfo (844)
Listing: typinfex/ex13.pp
-
Declaration:
- Function GetPropValue(Instance: TObject; const PropName: string): Variant;
Function GetPropValue(Instance: TObject; const PropName: string;
PreferStrings: Boolean): Variant;
-
Description:
- Due to missing Variant support, GetPropValue is not yet implemented. The declaration
is provided for compatibility with Delphi.
-
Errors:
-
-
See also:
-
Declaration:
- Function GetSetProp(Instance: TObject; const PropInfo: PPropInfo; Brackets:
Boolean): string;
Function GetSetProp(Instance: TObject; const PropName: string): string;
Function GetSetProp(Instance: TObject; const PropName: string; Brackets:
Boolean): string;
-
Description:
- GetSetProp returns the contents of a set property as a string. The property to be returned
can be specified by it’s name in PropName or by its property information in PropInfo.
The returned set is a string representation of the elements in the set as returned by
SetToString (859). The Brackets option can be used to enclose the string representation in
square brackets.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
ordinal property of Instance Specifying an invalid property name in PropName will result
in an EPropertyError exception.
-
See also:
- SetSetProp (858), GetStrProp (849), GetFloatProp (837), GetInt64Prop (838),GetMethodProp
(839)
Listing: typinfex/ex7.pp
-
Declaration:
- Function GetStrProp(Instance : TObject; PropInfo : PPropInfo) : Ansistring;
Function GetStrProp(Instance: TObject; const PropName: string): string;
-
Description:
- GetStrProp returns the value of the string property described by PropInfo or with name
PropName for object Instance.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
string property of Instance. Specifying an invalid property name in PropName will result in
an EPropertyError exception.
-
See also:
- SetStrProp (859), GetOrdProp (843), GetFloatProp (837), GetInt64Prop (838),GetMethodProp
(839)
Listing: typinfex/ex3.pp
-
Declaration:
- Function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
-
Description:
- GetTypeData returns a pointer to the TTypeData record that follows after the TTypeInfo
record pointed to by TypeInfo. It essentially skips the Kind and Name fields in the TTypeInfo
record.
-
Errors:
- None.
-
See also:
-
Declaration:
- Function GetVariantProp(Instance : TObject;PropInfo : PPropInfo): Variant;
-
Description:
- Due to mising Variant support, the GetVariantProp function is not yet implemented.
Provided for Delphi compatibility only.
-
Errors:
-
-
See also:
- SetVariantProp (860)
-
Declaration:
- Function IsPublishedProp(AClass: TClass; const PropName: string): Boolean;
Function IsPublishedProp(Instance: TObject; const PropName: string):
Boolean;
-
Description:
- IsPublishedProp returns true if a class has a published property with name PropName. The class
can be specfied in one of two ways:
-
AClass
- A class pointer to the class.
-
Instance
- An instance of the class.
-
Errors:
- 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.
-
See also:
- IsStoredProp (852), PropIsType (853)
Listing: typinfex/ex10.pp
-
Declaration:
- Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean;
Function IsStoredProp(Instance: TObject; const PropName: string): Boolean;
-
Description:
- IsStoredProp returns True if the Stored modifier evaluates to True for the property
described by PropInfo or with name PropName for object Instance. It returns False
otherwise. If the function returns True, this indicates that the property should be written
when streaming the object Instance.
If there was no stored modifier in the declaration of the property, True will be returned.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
property of Instance. Specifying an invalid property name in PropName will result in an
EPropertyError exception.
-
See also:
- IsPublishedProp (851), PropIsType (853)
Listing: typinfex/ex11.pp
-
Declaration:
- Function PropIsType(AClass: TClass; const PropName: string; TypeKind:
TTypeKind): Boolean;
Function PropIsType(Instance: TObject; const PropName: string; TypeKind:
TTypeKind): Boolean;
-
Description:
- 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:
-
AClass
- A class pointer.
-
Instance
- An instance of the class.
-
Errors:
- 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.
-
See also:
- IsPublishedProp (851), IsStoredProp (852), PropType (854)
Listing: typinfex/ex16.pp
-
Declaration:
- Function PropType(AClass: TClass; const PropName: string): TTypeKind;
Function PropType(Instance: TObject; const PropName: string): TTypeKind;
-
Description:
- Proptype returns the type of the property PropName for a class. The class to be examined can be
specified in one of 2 ways:
-
AClass
- A class pointer.
-
Instance
- An instance of the class.
-
Errors:
- 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.
-
See also:
- IsPublishedProp (851), IsStoredProp (852), PropIsType (853)
Listing: typinfex/ex17.pp
-
Declaration:
- Procedure SetEnumProp(Instance: TObject; const PropInfo: PPropInfo; const
Value: string);
Procedure SetEnumProp(Instance: TObject; const PropName: string; const
Value: string);
-
Description:
- SetEnumProp sets the property described by PropInfo or with name PropName to Value.
Value must be a string with the name of the enumerate value, i.e. it can be used as an
argument to GetEnumValue (837).
-
Errors:
- No checks are done to ensure Instance or PropInfo are valid pointers. Specifying an invalid
property name in PropName will result in an EPropertyError exception.
-
See also:
- GetEnumProp (836), SetStrProp (859), SetFloatProp (855), SetInt64Prop
(855),SetMethodProp (856).
For an example, see GetEnumProp (836).
-
Declaration:
- Procedure SetFloatProp(Instance : TObject; PropInfo : PPropInfo; Value :
Extended);
Procedure SetFloatProp(Instance: TObject; const PropName: string; Value:
Extended);
-
Description:
- SetFloatProp assigns Value to the property described by PropInfo or with name Propname
for the object Instance.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
float property of Instance. Specifying an invalid property name in PropName will result in
an EPropertyError exception.
-
See also:
- GetFloatProp (837), SetOrdProp (857), SetStrProp (859), SetInt64Prop (855),SetMethodProp
(856)
For an example, see GetFloatProp (837).
-
Declaration:
- Procedure SetInt64Prop(Instance: TObject; PropInfo: PPropInfo; const Value:
Int64);
Procedure SetInt64Prop(Instance: TObject; const PropName: string; const
Value: Int64);
-
Description:
- SetInt64Prop assigns Value to the property of type Int64 that is described by PropInfo
or with name Propname for the object Instance.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
Int64 property of Instance. Specifying an invalid property name in PropName will result in
an EPropertyError exception.
-
See also:
- GetInt64Prop (838), GetMethodProp (839), SetOrdProp (857), SetStrProp (859), SetFloatProp
(855)
For an example, see GetInt64Prop (838).
-
Declaration:
- Procedure SetMethodProp(Instance : TObject;PropInfo : PPropInfo; const
Value : TMethod);
Procedure SetMethodProp(Instance: TObject; const PropName: string; const
Value: TMethod);
-
Description:
- SetMethodProp assigns Value to the method the property described by PropInfo or with
name Propname for object Instance.
The type TMethod of the Value parameter is defined in the SysUtils unit as:
TMethod = packed record
Code, Data: Pointer;
end;
|
Data should point to the instance of the class with the method Code.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid method
property of Instance. Specifying an invalid property name in PropName will result in an
EPropertyError exception.
-
See also:
- GetMethodProp (839), SetOrdProp (857), SetStrProp (859), SetFloatProp (855), SetInt64Prop
(855)
For an example, see GetMethodProp (839).
-
Declaration:
- Procedure SetObjectProp(Instance: TObject; PropInfo: PPropInfo; Value:
TObject);
Procedure SetObjectProp(Instance: TObject; const PropName: string; Value:
TObject);
-
Description:
- SetObjectProp assigns Value to the the object property described by PropInfo or with
name Propname for the object Instance.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
method property of Instance. Specifying an invalid property name in PropName will result
in an EPropertyError exception.
-
See also:
- GetObjectProp (842), SetOrdProp (857), SetStrProp (859), SetFloatProp (855), SetInt64Prop
(855), SetMethodProp (856)
For an example, see GetObjectProp (842).
-
Declaration:
- Procedure SetOrdProp(Instance : TObject; PropInfo : PPropInfo; Value :
Longint);
Procedure SetOrdProp(Instance: TObject; const PropName: string; Value:
Longint);
-
Description:
- SetOrdProp assigns Value to the the ordinal property described by PropInfo or with name
Propname for the object Instance.
Ordinal properties that can be set include:
-
Integers and subranges of integers
- The actual value of the integer must be passed.
-
Enumerated types and subranges of enumerated types
- The ordinal value of the
enumerated type must be passed.
-
Subrange types
- of integers or enumerated types. Here the ordinal value must be passed.
-
Sets
- If the base type of the set has less than 31 possible values. For each possible value; the
corresponding bit of Value must be set.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid ordinal
property of Instance. No range checking is performed. Specifying an invalid property name in
PropName will result in an EPropertyError exception.
-
See also:
- GetOrdProp (843), SetStrProp (859), SetFloatProp (855), SetInt64Prop (855),SetMethodProp
(856)
For an example, see GetOrdProp (843).
-
Declaration:
- Procedure SetPropValue(Instance: TObject; const PropName: string; const
Value: Variant);
-
Description:
- Due to missing Variant support, this function is not yet implemented; it is provided for
Delphi compatibility only.
-
Errors:
-
-
See also:
-
Declaration:
- Procedure SetSetProp(Instance: TObject; const PropInfo: PPropInfo; const
Value: string);
Procedure SetSetProp(Instance: TObject; const PropName: string; const Value:
string);
-
Description:
- SetSetProp sets the property specified by PropInfo or PropName for object Instance to
Value. Value is a string which contains a comma-separated list of values, each value being a
string-representation of the enumerated value that should be included in the set. The value
should be accepted by the StringToSet (861) function.
The value can be formed using the SetToString (859) function.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
ordinal property of Instance. No range checking is performed. Specifying an invalid property
name in PropName will result in an EPropertyError exception.
-
See also:
- GetSetProp (848), SetOrdProp (857), SetStrProp (859), SetFloatProp (855), SetInt64Prop
(855),SetMethodProp (856), SetToString (859), StringToSet (861)
For an example, see GetSetProp (848).
-
Declaration:
- procedure SetStrProp(Instance : TObject; PropInfo : PPropInfo; const Value
: Ansistring);
Procedure SetStrProp(Instance: TObject; const PropName: string; const Value:
AnsiString);
-
Description:
- SetStrProp assigns Value to the string property described by PropInfo or with name
Propname for object Instance.
-
Errors:
- No checking is done whether Instance is non-nil, or whether PropInfo describes a valid
string property of Instance. Specifying an invalid property name in PropName will result in
an EPropertyError exception.
-
See also:
- GetStrProp (849), SetOrdProp (857), SetFloatProp (855), SetInt64Prop (855),SetMethodProp
(856)
For an example, see GetStrProp (849)
-
Declaration:
- function SetToString(PropInfo: PPropInfo; Value: Integer) : String;
function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean)
: String;
-
Description:
- SetToString takes an integer representation of a set (as received e.g. by GetOrdProp) and
turns it into a string representing the elements in the set, based on the type information
found in the PropInfo property information. By default, the string representation is not
surrounded by square brackets. Setting the Brackets parameter to True will surround the
string representation with brackets.
The function returns the string representation of the set.
-
Errors:
- No checking is done to see whether PropInfo points to valid property information.
-
See also:
- GetEnumName (835), GetEnumValue (837), StringToSet (861)
Listing: typinfex/ex18.pp
-
Declaration:
- Procedure SetVariantProp(Instance : TObject; PropInfo : PPropInfo; Const
Value: Variant);
Procedure SetVariantProp(Instance: TObject; const PropName: string; const
Value: Variant);
-
Description:
- Due to missing Variant support, this function is not yet implemented. Provided for Delphi
compatibility only.
-
Errors:
-
-
See also:
-
Declaration:
- function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
-
Description:
- StringToSet converts the string representation of a set in Value to a integer representation
of the set, using the property information found in PropInfo. This property information
should point to the property information of a set property. The function returns the integer
representation of the set. (i.e, the set value, typecast to an integer)
The string representation can be surrounded with square brackets, and must consist of the
names of the elements of the base type of the set. The base type of the set should be an
enumerated type. The elements should be separated by commas, and may be surrounded by
spaces. each of the names will be fed to the GetEnumValue (837) function.
-
Errors:
- No checking is done to see whether PropInfo points to valid property information. If a
wrong name is given for an enumerated value, then an EPropertyError will be raised.
-
See also:
- GetEnumName (835), GetEnumValue (837), SetToString (859)
For an example, see SetToString (859).