|
@@ -2,7 +2,7 @@
|
|
% The TYPINFO unit
|
|
% The TYPINFO unit
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
\chapter{The TYPINFO unit}
|
|
\chapter{The TYPINFO unit}
|
|
-
|
|
|
|
|
|
+\FPCexampledir{typinfex}
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
% Constants, Types and variables
|
|
% Constants, Types and variables
|
|
\section{Constants, Types and variables}
|
|
\section{Constants, Types and variables}
|
|
@@ -188,96 +188,222 @@ TPropList = array[0..65535] of PPropInfo;
|
|
% Functions and procedures
|
|
% Functions and procedures
|
|
\section{Functions and Procedures}
|
|
\section{Functions and Procedures}
|
|
|
|
|
|
-\begin{function}{GetTypeData}
|
|
|
|
|
|
+\begin{function}{FindPropInfo}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
|
|
|
|
|
|
+Function FindPropInfo(AClass:TClass;const PropName: string): PPropInfo;\\
|
|
|
|
+Function FindPropInfo(Instance: TObject; const PropName: string): PPropInfo;
|
|
\Description
|
|
\Description
|
|
-\var{GetTypeData} returns a pointer to the \var{TTypeData} record that
|
|
|
|
-follows after the \var{TTypeInfo} record pointed to by \var{TypeInfo}.
|
|
|
|
-It essentially skips the \var{Kind} and \var{Name} fields in the
|
|
|
|
-\var{TTypeInfo} record.
|
|
|
|
|
|
+\var{FindPropInfo} examines the published property information of a class and
|
|
|
|
+returns a pointer to the property information for property \var{PropName}.
|
|
|
|
+The class to be examined can be specified in one of two ways:
|
|
|
|
+\begin{description}
|
|
|
|
+\item[AClass] a class pointer.
|
|
|
|
+\item[Instance] an instance of the class to be investigated.
|
|
|
|
+\end{description}
|
|
|
|
+If the property does not exist, a \var{EPropertyError} exception will be
|
|
|
|
+raised. The \seef{GetPropInfo} function has the same function as the
|
|
|
|
+\var{FindPropInfo} function, but returns \var{Nil} if the property does not
|
|
|
|
+exist.
|
|
\Errors
|
|
\Errors
|
|
-None.
|
|
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
|
|
+\seef{GetPropInfo}, \seef{GetPropList}, \seep{GetPropInfos}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+\FPCexample{ex14}
|
|
|
|
|
|
-\begin{function}{GetPropInfo}
|
|
|
|
|
|
+\begin{function}{GetEnumName}
|
|
\Declaration
|
|
\Declaration
|
|
-function GetPropInfo(TypeInfo: PTypeInfo;
|
|
|
|
- const PropName: string) : PPropInfo;
|
|
|
|
|
|
+Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
|
|
\Description
|
|
\Description
|
|
-\var{GetPropInfo} returns a pointer to the \var{TPropInfo} record for a the \var{PropName}
|
|
|
|
-property of a class that has \var{TypeInfo} as class info.
|
|
|
|
|
|
+\var{GetEnumName} scans the type information for the enumeration type
|
|
|
|
+described by \var{TypeInfo} and returns the name of the enumeration
|
|
|
|
+constant for the element with ordinal value equal to \var{Value}.
|
|
|
|
+
|
|
|
|
+If \var{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 \var{GetOrdProp} to stream a property
|
|
|
|
+of an enumerated type.
|
|
\Errors
|
|
\Errors
|
|
-If the property \var{PropName} does not exist, \var{Nil} is returned.
|
|
|
|
|
|
+No check is done to determine whether \var{TypeInfo} really points to the
|
|
|
|
+type information for an enumerated type.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seep{GetPropInfos},\seef{GetPropList}
|
|
|
|
|
|
+\seef{GetOrdProp}, \seef{GetEnumValue}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+\FPCexample{ex9}
|
|
|
|
|
|
-\begin{procedure}{GetPropInfos}
|
|
|
|
|
|
+\begin{function}{GetEnumProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Procedure GetPropInfos(TypeInfo: PTypeInfo;PropList: PPropList);
|
|
|
|
|
|
+Function GetEnumProp(Instance: TObject;const PropInfo: PPropInfo): string;\\
|
|
|
|
+Function GetEnumProp(Instance: TObject;const PropName: string): string;
|
|
\Description
|
|
\Description
|
|
-\var{GetPropInfos} stores pointers to the property information of all published
|
|
|
|
-properties of a class with class info \var{TypeInfo} in the list pointed to by
|
|
|
|
-\var{Proplist}. The \var{PropList} pointer must point to a memory location that
|
|
|
|
-contains enough space to hold all properties of the class and its parent classes.
|
|
|
|
|
|
+\var{GetEnumProp} returns the value of an property of an enumerated type
|
|
|
|
+and returns the name of the enumerated value for the objetc \var{Instance}.
|
|
|
|
+The property whose value must be returned can be specified by its property
|
|
|
|
+info in \var{PropInfo} or by its name in \var{PropName}
|
|
\Errors
|
|
\Errors
|
|
-No checks are done to see whether \var{PropList} points to a memory area that
|
|
|
|
-is big enough to hold all pointers.
|
|
|
|
|
|
+No check is done to determine whether \var{PropInfo} really points to the
|
|
|
|
+property information for an enumerated type.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetPropInfo},\seef{GetPropList}
|
|
|
|
-\end{procedure}
|
|
|
|
|
|
+\seep{SetEnumProp} \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
+\seef{GetInt64Prop},\seef{GetMethodProp}, \seef{GetSetProp},
|
|
|
|
+\seef{GetObjectProp}, \seef{GetEnumProp}
|
|
|
|
+\end{function}
|
|
|
|
|
|
|
|
+\FPCexample{ex2}
|
|
|
|
|
|
-\begin{function}{GetPropList}
|
|
|
|
|
|
+\begin{function}{GetEnumValue}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetPropList(TypeInfo : PTypeInfo;
|
|
|
|
- TypeKinds : TTypeKinds;
|
|
|
|
- PropList : PPropList) : Integer;
|
|
|
|
|
|
+Function GetEnumValue(TypeInfo : PTypeInfo;const Name : string) : Integer;
|
|
\Description
|
|
\Description
|
|
-\var{GetPropList} stores pointers to property information of the class with class
|
|
|
|
-info \var{TypeInfo} for properties of kind \var{TypeKinds} in the list pointed to
|
|
|
|
-by \var{Proplist}. \var{PropList} must contain enough space to hold all properties.
|
|
|
|
|
|
+\var{GetEnumValue} scans the type information for the enumeration type
|
|
|
|
+described by \var{TypeInfor} and returns the ordinal value for the element
|
|
|
|
+in the enumerated type that has identifier \var{Name}. The identifier is
|
|
|
|
+searched in a case-insensitive manner.
|
|
|
|
|
|
-The function returns the number of pointers that matched the criteria and were stored
|
|
|
|
-in \var{PropList}.
|
|
|
|
|
|
+This can be used to set the value of enumerated properties from a stream.
|
|
\Errors
|
|
\Errors
|
|
-No checks are done to see whether \var{PropList} points to a memory area that is big enough
|
|
|
|
-to hold all pointers.
|
|
|
|
|
|
+If \var{Name} is not found in the list of enumerated values, then -1 is
|
|
|
|
+returned. No check is done whether \var{TypeInfo} points to the type information
|
|
|
|
+for an enumerated type.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seep{GetPropInfos}, \seef{GetPropInfo}
|
|
|
|
|
|
+\seef{GetEnumName}, \seep{SetOrdProp}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+For an example, see \seef{GetEnumName}.
|
|
|
|
|
|
-\begin{function}{IsStoredProp}
|
|
|
|
|
|
+\begin{function}{GetFloatProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean;
|
|
|
|
|
|
+Function GetFloatProp(Instance : TObject;PropInfo : PPropInfo) : Extended;\\
|
|
|
|
+Procedure SetFloatProp(Instance: TObject; const PropName: string; Value: Extended);
|
|
\Description
|
|
\Description
|
|
-\var{IsStoredProp} returns \var{True} if the \var{Stored} modifier evaluates
|
|
|
|
-to \var{True} for the property described by \var{PropInfo} for object
|
|
|
|
-\var{Instance}. It returns \var{False} otherwise. If the function returns
|
|
|
|
-\var{True}, this indicates that the property should be written when
|
|
|
|
-streaming the object \var{Instance}.
|
|
|
|
|
|
+\var{GetFloatProp} returns the value of the float property described by
|
|
|
|
+\var{PropInfo} or with name \var{Propname} for the object \var{Instance}.
|
|
|
|
+All float types are converted
|
|
|
|
+to extended.
|
|
|
|
+\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
+\var{PropInfo} describes a valid float property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seep{SetFloatProp}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
+\seef{GetInt64Prop},\seef{GetMethodProp}, \seef{GetSetProp},
|
|
|
|
+\seef{GetObjectProp}, \seef{GetEnumProp}
|
|
|
|
+\end{function}
|
|
|
|
+
|
|
|
|
+\FPCexample{ex4}
|
|
|
|
+
|
|
|
|
+\begin{function}{GetInt64Prop}
|
|
|
|
+\Declaration
|
|
|
|
+Function GetInt64Prop(Instance: TObject; PropInfo: PPropInfo): Int64;\\
|
|
|
|
+Function GetInt64Prop(Instance: TObject; const PropName: string): Int64;
|
|
|
|
+\Description
|
|
|
|
+{\em Publishing of Int64 properties is not yet supported by \fpc. This
|
|
|
|
+function is provided for Delphi compatibility only at the moment.}
|
|
|
|
+
|
|
|
|
+\var{GetInt64Prop} returns the value of the property of type
|
|
|
|
+\var{Int64} that is described by \var{PropInfo} or with name \var{Propname}
|
|
|
|
+for the object \var{Instance}.
|
|
|
|
|
|
-If there was no \var{stored} modifier in the declaration of the property,
|
|
|
|
-\var{True} will be returned.
|
|
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
-\var{PropInfo} describes a valid property of \var{Instance}.
|
|
|
|
|
|
+\var{PropInfo} describes a valid \var{Int64} property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception
|
|
|
|
+\SeeAlso
|
|
|
|
+\seep{SetInt64Prop}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
+\seef{GetFloatProp}, \seef{GetMethodProp}, \seef{GetSetProp},
|
|
|
|
+\seef{GetObjectProp}, \seef{GetEnumProp}
|
|
|
|
+\end{function}
|
|
|
|
+
|
|
|
|
+\FPCexample{ex15}
|
|
|
|
+
|
|
|
|
+\begin{function}{GetMethodProp}
|
|
|
|
+\Declaration
|
|
|
|
+Function GetMethodProp(Instance : TObject;PropInfo : PPropInfo) : TMethod;\\
|
|
|
|
+Function GetMethodProp(Instance: TObject; const PropName: string): TMethod;
|
|
|
|
+\Description
|
|
|
|
+\var{GetMethodProp} returns the method the property described by
|
|
|
|
+\var{PropInfo} or with name \var{Propname} for object \var{Instance}.
|
|
|
|
+The return type \var{TMethod} is defined in the \file{SysUtils} unit as:
|
|
|
|
+\begin{verbatim}
|
|
|
|
+TMethod = packed record
|
|
|
|
+ Code, Data: Pointer;
|
|
|
|
+end;
|
|
|
|
+\end{verbatim}
|
|
|
|
+\var{Data} points to the instance of the class with the method \var{Code}.
|
|
|
|
+
|
|
|
|
+\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
+\var{PropInfo} describes a valid method property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception
|
|
|
|
+\SeeAlso
|
|
|
|
+\seep{SetMethodProp}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
+\seef{GetFloatProp}, \seef{GetInt64Prop}, \seef{GetSetProp},
|
|
|
|
+\seef{GetObjectProp}, \seef{GetEnumProp}
|
|
|
|
+\end{function}
|
|
|
|
+
|
|
|
|
+\FPCexample{ex6}
|
|
|
|
+
|
|
|
|
+\begin{function}{GetObjectProp}
|
|
|
|
+\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
|
|
|
|
+\var{GetObjectProp} returns the object which the property descroibed by
|
|
|
|
+\var{PropInfo} with name \var{Propname} points to for object \var{Instance}.
|
|
|
|
+
|
|
|
|
+If \var{MinClass} is specified, then if the object is not descendent of
|
|
|
|
+class \var{MinClass}, then \var{Nil} is returned.
|
|
|
|
+
|
|
|
|
+\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
+\var{PropInfo} describes a valid method property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seep{SetMethodProp}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
+\seef{GetFloatProp}, \seef{GetInt64Prop}, \seef{GetSetProp},
|
|
|
|
+\seef{GetObjectProp}, \seef{GetEnumProp}
|
|
|
|
+\end{function}
|
|
|
|
+
|
|
|
|
+\FPCexample{ex5}
|
|
|
|
+
|
|
|
|
+\begin{function}{GetObjectPropClass}
|
|
|
|
+\Declaration
|
|
|
|
+Function GetObjectPropClass(Instance: TObject; const PropName: string): TClass;
|
|
|
|
+\Description
|
|
|
|
+\var{GetObjectPropClass} returns the declared class of the property with name
|
|
|
|
+\var{PropName}. This may not be the actual class of the property value.
|
|
|
|
+\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
|
|
+\seep{SetMethodProp}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
+\seef{GetFloatProp}, \seef{GetInt64Prop}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+For an example, see \seef{GetObjectProp}.
|
|
|
|
|
|
\begin{function}{GetOrdProp}
|
|
\begin{function}{GetOrdProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetOrdProp(Instance : TObject;PropInfo : PPropInfo) : Longint;
|
|
|
|
|
|
+Function GetOrdProp(Instance : TObject;PropInfo : PPropInfo) : Longint;\\
|
|
|
|
+Function GetOrdProp(Instance: TObject;const PropName: string): Longint;
|
|
\Description
|
|
\Description
|
|
\var{GetOrdProp} returns the value of the ordinal property described by
|
|
\var{GetOrdProp} returns the value of the ordinal property described by
|
|
-\var{PropInfo} for the object \var{Instance}. The value is returned as a
|
|
|
|
-longint, which should be typecasted to the needed type.
|
|
|
|
|
|
+\var{PropInfo} or with name \var{PropName} for the object \var{Instance}.
|
|
|
|
+The value is returned as a longint, which should be typecasted to the
|
|
|
|
+needed type.
|
|
|
|
|
|
Ordinal properties that can be retrieved include:
|
|
Ordinal properties that can be retrieved include:
|
|
\begin{description}
|
|
\begin{description}
|
|
@@ -292,157 +418,315 @@ base ordinal class of the set type must be included in the set.
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
\var{PropInfo} describes a valid ordinal property of \var{Instance}
|
|
\var{PropInfo} describes a valid ordinal property of \var{Instance}
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
\seep{SetOrdProp}, \seef{GetStrProp}, \seef{GetFloatProp},
|
|
\seep{SetOrdProp}, \seef{GetStrProp}, \seef{GetFloatProp},
|
|
-\seef{GetInt64Prop},\seef{GetMethodProp}
|
|
|
|
-
|
|
|
|
|
|
+\seef{GetInt64Prop},\seef{GetMethodProp}, \seef{GetSetProp},
|
|
|
|
+\seef{GetObjectProp}, \seef{GetEnumProp}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+\FPCexample{ex1}
|
|
|
|
|
|
-\begin{procedure}{SetOrdProp}
|
|
|
|
|
|
+\begin{function}{GetPropInfo}
|
|
\Declaration
|
|
\Declaration
|
|
-Procedure SetOrdProp(Instance : TObject;PropInfo : PPropInfo; Value : Longint);
|
|
|
|
|
|
+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
|
|
\Description
|
|
-\var{SetOrdProp} assigns \var{Value} to the the ordinal property described by
|
|
|
|
-\var{PropInfo} for the object \var{Instance}.
|
|
|
|
-
|
|
|
|
-Ordinal properties that can be set include:
|
|
|
|
|
|
+\var{GetPropInfo} returns a pointer to the \var{TPropInfo} record for a the
|
|
|
|
+\var{PropName} property of a class. The class to examine can be specified
|
|
|
|
+in one of three ways:
|
|
\begin{description}
|
|
\begin{description}
|
|
-\item[Integers and subranges of integers] The actual value of the integer must be
|
|
|
|
-passed.
|
|
|
|
-\item[Enumerated types and subranges of enumerated types] The ordinal value
|
|
|
|
-of the enumerated type must be passed.
|
|
|
|
-\item[Subrange types] of integers or enumerated types. Here the ordinal
|
|
|
|
-value must be passed.
|
|
|
|
-\item[Sets] If the base type of the set has less than 31 possible values.
|
|
|
|
-For each possible value; the corresponding bit of \var{Value} must be set.
|
|
|
|
|
|
+\item[Instance] An instance of the class.
|
|
|
|
+\item[AClass] A class pointer to the class.
|
|
|
|
+\item[TypeInfo] A pointer to the type information of the class.
|
|
\end{description}
|
|
\end{description}
|
|
|
|
+In each of these three ways, if \var{AKinds} is specified, if the property
|
|
|
|
+has \var{TypeKind} which is not included in \var{Akinds}, \var{Nil} will be
|
|
|
|
+returned.
|
|
\Errors
|
|
\Errors
|
|
-No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
-\var{PropInfo} describes a valid ordinal property of \var{Instance}.
|
|
|
|
-No range checking is performed.
|
|
|
|
|
|
+If the property \var{PropName} does not exist, \var{Nil} is returned.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetOrdProp}, \seep{SetStrProp}, \seep{SetFloatProp},
|
|
|
|
-\seep{SetInt64Prop},\seep{SetMethodProp}
|
|
|
|
-\end{procedure}
|
|
|
|
|
|
+\seep{GetPropInfos},\seef{GetPropList}
|
|
|
|
+\end{function}
|
|
|
|
|
|
|
|
+for an example, see most of the other functions.
|
|
|
|
|
|
-\begin{function}{GetStrProp}
|
|
|
|
|
|
+
|
|
|
|
+\begin{procedure}{GetPropInfos}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetStrProp(Instance : TObject;PropInfo : PPropInfo) : Ansistring;
|
|
|
|
|
|
+Procedure GetPropInfos(TypeInfo: PTypeInfo;PropList: PPropList);
|
|
\Description
|
|
\Description
|
|
-\var{GetStrProp} returns the value of the string property described by
|
|
|
|
-\var{PropInfo} for object \var{Instance}.
|
|
|
|
|
|
+\var{GetPropInfos} stores pointers to the property information of all published
|
|
|
|
+properties of a class with class info \var{TypeInfo} in the list pointed to by
|
|
|
|
+\var{Proplist}. The \var{PropList} pointer must point to a memory location that
|
|
|
|
+contains enough space to hold all properties of the class and its parent classes.
|
|
\Errors
|
|
\Errors
|
|
-No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
-\var{PropInfo} describes a valid string property of \var{Instance}.
|
|
|
|
|
|
+No checks are done to see whether \var{PropList} points to a memory area that
|
|
|
|
+is big enough to hold all pointers.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seep{SetStrProp}, \seef{GetOrdProp}, \seef{GetFloatProp},
|
|
|
|
-\seef{GetInt64Prop},\seef{GetMethodProp}
|
|
|
|
-\end{function}
|
|
|
|
|
|
+\seef{GetPropInfo},\seef{GetPropList}
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
-\begin{procedure}{SetStrProp}
|
|
|
|
|
|
+\FPCexample{ex12}
|
|
|
|
+
|
|
|
|
+\begin{function}{GetPropList}
|
|
\Declaration
|
|
\Declaration
|
|
- procedure SetStrProp(Instance : TObject;PropInfo : PPropInfo;
|
|
|
|
- const Value : Ansistring);
|
|
|
|
|
|
+Function GetPropList(TypeInfo : PTypeInfo;
|
|
|
|
+ TypeKinds : TTypeKinds;
|
|
|
|
+ PropList : PPropList) : Integer;
|
|
\Description
|
|
\Description
|
|
-\var{GetStrProp} assigns \var{Value} to the string property described by
|
|
|
|
-\var{PropInfo} for object \var{Instance}.
|
|
|
|
|
|
+\var{GetPropList} stores pointers to property information of the class with class
|
|
|
|
+info \var{TypeInfo} for properties of kind \var{TypeKinds} in the list pointed to
|
|
|
|
+by \var{Proplist}. \var{PropList} must contain enough space to hold all properties.
|
|
|
|
+
|
|
|
|
+The function returns the number of pointers that matched the criteria and were stored
|
|
|
|
+in \var{PropList}.
|
|
\Errors
|
|
\Errors
|
|
-No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
-\var{PropInfo} describes a valid string property of \var{Instance}.
|
|
|
|
|
|
+No checks are done to see whether \var{PropList} points to a memory area that is big enough
|
|
|
|
+to hold all pointers.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetStrProp}, \seep{SetOrdProp}, \seep{SetFloatProp},
|
|
|
|
-\seep{SetInt64Prop},\seep{SetMethodProp}
|
|
|
|
|
|
+\seep{GetPropInfos}, \seef{GetPropInfo}
|
|
|
|
+\end{function}
|
|
|
|
|
|
|
|
+\FPCexample{ex13}
|
|
|
|
|
|
-\end{procedure}
|
|
|
|
|
|
+\begin{function}{GetPropValue}
|
|
|
|
+\Declaration
|
|
|
|
+Function GetPropValue(Instance: TObject; const PropName: string): Variant;\\
|
|
|
|
+Function GetPropValue(Instance: TObject; const PropName: string; PreferStrings: Boolean): Variant;
|
|
|
|
+\Description
|
|
|
|
+Due to missing \var{Variant} support, \var{GetPropValue} is not yet implemented.
|
|
|
|
+The declaration is provided for compatibility with Delphi.
|
|
|
|
+\Errors
|
|
|
|
+\SeeAlso
|
|
|
|
+\end{function}
|
|
|
|
|
|
-\begin{function}{GetFloatProp}
|
|
|
|
|
|
+\begin{function}{GetSetProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetFloatProp(Instance : TObject;PropInfo : PPropInfo) : Extended;
|
|
|
|
|
|
+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
|
|
\Description
|
|
-\var{GetFloatProp} returns the value of the float property described by
|
|
|
|
-\var{PropInfo} for the object \var{Instance}. All float types are converted
|
|
|
|
-to extended.
|
|
|
|
|
|
+\var{GetSetProp} returns the contents of a set property as a string.
|
|
|
|
+The property to be returned can be specified by it's name in \var{PropName}
|
|
|
|
+or by its property information in \var{PropInfo}.
|
|
|
|
+
|
|
|
|
+The returned set is a string representation of the elements in the set as
|
|
|
|
+returned by \seef{SetToString}. The \var{Brackets} option can be used to
|
|
|
|
+enclose the string representation in square brackets.
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
-\var{PropInfo} describes a valid float property of \var{Instance}.
|
|
|
|
|
|
+\var{PropInfo} describes a valid ordinal property of \var{Instance}
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seep{SetFloatProp}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
|
|
+\seep{SetSetProp}, \seef{GetStrProp}, \seef{GetFloatProp},
|
|
\seef{GetInt64Prop},\seef{GetMethodProp}
|
|
\seef{GetInt64Prop},\seef{GetMethodProp}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+\FPCexample{ex7}
|
|
|
|
|
|
-\begin{procedure}{SetFloatProp}
|
|
|
|
|
|
+\begin{function}{GetStrProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Procedure SetFloatProp(Instance : TObject;
|
|
|
|
- PropInfo : PPropInfo;
|
|
|
|
- Value : Extended);
|
|
|
|
|
|
+Function GetStrProp(Instance : TObject;
|
|
|
|
+ PropInfo : PPropInfo) : Ansistring;\\
|
|
|
|
+Function GetStrProp(Instance: TObject;
|
|
|
|
+ const PropName: string): string;
|
|
\Description
|
|
\Description
|
|
-\var{SetFloatProp} assigns \var{Value} to the property described by
|
|
|
|
-\var{PropInfo} for the object \var{Instance}.
|
|
|
|
|
|
+\var{GetStrProp} returns the value of the string property described by
|
|
|
|
+\var{PropInfo} or with name \var{PropName} for object \var{Instance}.
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
-\var{PropInfo} describes a valid float property of \var{Instance}.
|
|
|
|
|
|
+\var{PropInfo} describes a valid string property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetFloatProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
|
|
-\seep{SetInt64Prop},\seep{SetMethodProp}
|
|
|
|
|
|
+\seep{SetStrProp}, \seef{GetOrdProp}, \seef{GetFloatProp},
|
|
|
|
+\seef{GetInt64Prop},\seef{GetMethodProp}
|
|
|
|
+\end{function}
|
|
|
|
|
|
-\end{procedure}
|
|
|
|
|
|
+\FPCexample{ex3}
|
|
|
|
|
|
|
|
+\begin{function}{GetTypeData}
|
|
|
|
+\Declaration
|
|
|
|
+Function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
|
|
|
|
+\Description
|
|
|
|
+\var{GetTypeData} returns a pointer to the \var{TTypeData} record that
|
|
|
|
+follows after the \var{TTypeInfo} record pointed to by \var{TypeInfo}.
|
|
|
|
+It essentially skips the \var{Kind} and \var{Name} fields in the
|
|
|
|
+\var{TTypeInfo} record.
|
|
|
|
+\Errors
|
|
|
|
+None.
|
|
|
|
+\SeeAlso
|
|
|
|
+\end{function}
|
|
|
|
|
|
\begin{function}{GetVariantProp}
|
|
\begin{function}{GetVariantProp}
|
|
\Declaration
|
|
\Declaration
|
|
Function GetVariantProp(Instance : TObject;PropInfo : PPropInfo): Variant;
|
|
Function GetVariantProp(Instance : TObject;PropInfo : PPropInfo): Variant;
|
|
\Description
|
|
\Description
|
|
-Not yet implemented. Provided for Delphi compatibility only.
|
|
|
|
|
|
+Due to mising Variant support, the \var{GetVariantProp} function is not
|
|
|
|
+yet implemented. Provided for Delphi compatibility only.
|
|
\Errors
|
|
\Errors
|
|
\SeeAlso
|
|
\SeeAlso
|
|
|
|
+\seep{SetVariantProp}
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
|
|
+\begin{function}{IsPublishedProp}
|
|
|
|
+\Declaration
|
|
|
|
+Function IsPublishedProp(AClass: TClass; const PropName: string): Boolean;\\
|
|
|
|
+Function IsPublishedProp(Instance: TObject; const PropName: string): Boolean;
|
|
|
|
+\Description
|
|
|
|
+\var{IsPublishedProp} returns true if a class has a published property with
|
|
|
|
+name \var{PropName}. The class can be specfied in one of two ways:
|
|
|
|
+\begin{description}
|
|
|
|
+\item[AClass] A class pointer to the class.
|
|
|
|
+\item[Instance] An instance of the class.
|
|
|
|
+\end{description}
|
|
|
|
+\Errors
|
|
|
|
+No checks are done to ensure \var{Instance} or \var{AClass} are valid
|
|
|
|
+pointers. Specifying an invalid property name in \var{PropName} will result
|
|
|
|
+in an \var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seef{IsStoredProp}, \seef{PropIsType}
|
|
|
|
+\end{function}
|
|
|
|
|
|
-\begin{procedure}{SetVariantProp}
|
|
|
|
|
|
+\begin{function}{IsStoredProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Procedure SetVariantProp(Instance : TObject;
|
|
|
|
- PropInfo : PPropInfo;
|
|
|
|
- Const Value: Variant);
|
|
|
|
|
|
+Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean;\\
|
|
|
|
+Function IsStoredProp(Instance: TObject; const PropName: string): Boolean;
|
|
\Description
|
|
\Description
|
|
-Not yet implemented. Provided for Delphi compatibility only.
|
|
|
|
|
|
+\var{IsStoredProp} returns \var{True} if the \var{Stored} modifier evaluates
|
|
|
|
+to \var{True} for the property described by \var{PropInfo} or with name
|
|
|
|
+\var{PropName} for object \var{Instance}.
|
|
|
|
+It returns \var{False} otherwise. If the function returns
|
|
|
|
+\var{True}, this indicates that the property should be written when
|
|
|
|
+streaming the object \var{Instance}.
|
|
|
|
+
|
|
|
|
+If there was no \var{stored} modifier in the declaration of the property,
|
|
|
|
+\var{True} will be returned.
|
|
\Errors
|
|
\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
+\var{PropInfo} describes a valid property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\end{procedure}
|
|
|
|
|
|
+\seef{IsPublishedProp}, \seef{PropIsType}
|
|
|
|
+\end{function}
|
|
|
|
|
|
|
|
+\begin{function}{PropIsType}
|
|
|
|
+\Declaration
|
|
|
|
+Function PropIsType(AClass: TClass;
|
|
|
|
+ const PropName: string; TypeKind: TTypeKind): Boolean;\\
|
|
|
|
+Function PropIsType(Instance: TObject;
|
|
|
|
+ const PropName: string; TypeKind: TTypeKind): Boolean;
|
|
|
|
+\Description
|
|
|
|
+\var{PropIsType} returns \var{True} if the property with name \var{PropName}
|
|
|
|
+has type \var{TypeKind}. It returns \var{False} otherwise. The class to be
|
|
|
|
+examined can be specified in one of two ways:
|
|
|
|
+\begin{description}
|
|
|
|
+\item[AClass] A class pointer.
|
|
|
|
+\item[Instance] An instance of the class.
|
|
|
|
+\end{description}
|
|
|
|
+\Errors
|
|
|
|
+No checks are done to ensure \var{Instance} or \var{AClass} are valid
|
|
|
|
+pointers.Specifying an invalid property name in \var{PropName} will result
|
|
|
|
+in an \var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seef{IsPublishedProp}, \seef{IsStoredProp}, \seef{PropType}
|
|
|
|
+\end{function}
|
|
|
|
|
|
-\begin{function}{GetMethodProp}
|
|
|
|
|
|
+\begin{function}{PropType}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetMethodProp(Instance : TObject;PropInfo : PPropInfo) : TMethod;
|
|
|
|
|
|
+Function PropType(AClass: TClass; const PropName: string): TTypeKind;\\
|
|
|
|
+Function PropType(Instance: TObject; const PropName: string): TTypeKind;
|
|
\Description
|
|
\Description
|
|
-\var{GetMethodProp} returns the method the property described by
|
|
|
|
-\var{PropInfo} for object \var{Instance}.
|
|
|
|
-The return type \var{TMethod} is defined in the \file{SysUtils} unit as:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-TMethod = packed record
|
|
|
|
- Code, Data: Pointer;
|
|
|
|
-end;
|
|
|
|
-\end{verbatim}
|
|
|
|
-\var{Data} points to the instance of the class with the method \var{Code}.
|
|
|
|
|
|
+\var{Proptype} returns the type of the property \var{PropName} for a class.
|
|
|
|
+The class to be examined can be specified in one of 2 ways:
|
|
|
|
+\begin{description}
|
|
|
|
+\item[AClass] A class pointer.
|
|
|
|
+\item[Instance] An instance of the class.
|
|
|
|
+\end{description}
|
|
|
|
+\Errors
|
|
|
|
+No checks are done to ensure \var{Instance} or \var{AClass} are valid
|
|
|
|
+pointers. Specifying an invalid property name in \var{PropName} will result
|
|
|
|
+in an \var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seef{IsPublishedProp}, \seef{IsStoredProp}, \seef{PropIsType}
|
|
|
|
+\end{function}
|
|
|
|
+
|
|
|
|
+\begin{procedure}{SetEnumProp}
|
|
|
|
+\Declaration
|
|
|
|
+Procedure SetEnumProp(Instance: TObject; const PropInfo: PPropInfo;
|
|
|
|
+ const Value: string);\\
|
|
|
|
+Procedure SetEnumProp(Instance: TObject; const PropName: string;
|
|
|
|
+ const Value: string);
|
|
|
|
+\Description
|
|
|
|
+\var{SetEnumProp} sets the property described by \var{PropInfo} or with name
|
|
|
|
+\var{PropName} to \var{Value}. \var{Value} must be a string with the name
|
|
|
|
+of the enumerate value, i.e. it can be used as an argument to
|
|
|
|
+\seef{GetEnumValue}.
|
|
|
|
+\Errors
|
|
|
|
+No checks are done to ensure \var{Instance} or \var{PropInfo} are valid
|
|
|
|
+pointers. Specifying an invalid property name in \var{PropName} will result
|
|
|
|
+in an \var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seef{GetEnumProp}, \seep{SetStrProp}, \seep{SetFloatProp},
|
|
|
|
+\seep{SetInt64Prop},\seep{SetMethodProp}.
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
|
|
+\begin{procedure}{SetFloatProp}
|
|
|
|
+\Declaration
|
|
|
|
+Procedure SetFloatProp(Instance : TObject;
|
|
|
|
+ PropInfo : PPropInfo;
|
|
|
|
+ Value : Extended);\\
|
|
|
|
+Procedure SetFloatProp(Instance: TObject;
|
|
|
|
+ const PropName: string;
|
|
|
|
+ Value: Extended);
|
|
|
|
+\Description
|
|
|
|
+\var{SetFloatProp} assigns \var{Value} to the property described by
|
|
|
|
+\var{PropInfo} or with name \var{Propname} for the object \var{Instance}.
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
-\var{PropInfo} describes a valid method property of \var{Instance}.
|
|
|
|
|
|
+\var{PropInfo} describes a valid float property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seep{SetMethodProp}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
-\seef{GetFloatProp}, \seef{GetInt64Prop}
|
|
|
|
-\end{function}
|
|
|
|
|
|
+\seef{GetFloatProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
|
|
+\seep{SetInt64Prop},\seep{SetMethodProp}
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
|
|
+\begin{procedure}{SetInt64Prop}
|
|
|
|
+\Declaration
|
|
|
|
+Procedure SetInt64Prop(Instance: TObject; PropInfo: PPropInfo; const Value: Int64);\\
|
|
|
|
+Procedure SetInt64Prop(Instance: TObject; const PropName: string; const Value: Int64);
|
|
|
|
+\Description
|
|
|
|
+\var{SetInt64Prop} assigns \var{Value} to the property of type
|
|
|
|
+\var{Int64} that is described by \var{PropInfo} or with name \var{Propname}
|
|
|
|
+for the object \var{Instance}.
|
|
|
|
+\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
+\var{PropInfo} describes a valid \var{Int64} property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seef{GetInt64Prop}, \seef{GetMethodProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
|
|
+\seep{SetFloatProp}
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
\begin{procedure}{SetMethodProp}
|
|
\begin{procedure}{SetMethodProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Procedure SetMethodProp(Instance : TObject;PropInfo : PPropInfo; const Value : TMethod);
|
|
|
|
|
|
+Procedure SetMethodProp(Instance : TObject;PropInfo : PPropInfo; const Value :
|
|
|
|
+TMethod);\\
|
|
|
|
+Procedure SetMethodProp(Instance: TObject; const PropName: string; const Value: TMethod);
|
|
\Description
|
|
\Description
|
|
\var{SetMethodProp} assigns \var{Value} to the method the property described
|
|
\var{SetMethodProp} assigns \var{Value} to the method the property described
|
|
-by \var{PropInfo} for object \var{Instance}.
|
|
|
|
|
|
+by \var{PropInfo} or with name \var{Propname} for object \var{Instance}.
|
|
|
|
|
|
The type \var{TMethod} of the \var{Value} parameter is defined in the
|
|
The type \var{TMethod} of the \var{Value} parameter is defined in the
|
|
\file{SysUtils} unit as:
|
|
\file{SysUtils} unit as:
|
|
@@ -456,77 +740,133 @@ end;
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
\var{PropInfo} describes a valid method property of \var{Instance}.
|
|
\var{PropInfo} describes a valid method property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
\seef{GetMethodProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
\seef{GetMethodProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
\seep{SetFloatProp}, \seep{SetInt64Prop}
|
|
\seep{SetFloatProp}, \seep{SetInt64Prop}
|
|
\end{procedure}
|
|
\end{procedure}
|
|
|
|
|
|
-\begin{function}{GetInt64Prop}
|
|
|
|
|
|
+\begin{procedure}{SetObjectProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetInt64Prop(Instance: TObject; PropInfo: PPropInfo): Int64;
|
|
|
|
|
|
+Procedure SetObjectProp(Instance: TObject;
|
|
|
|
+ PropInfo: PPropInfo; Value: TObject);\\
|
|
|
|
+Procedure SetObjectProp(Instance: TObject;
|
|
|
|
+ const PropName: string; Value: TObject);
|
|
\Description
|
|
\Description
|
|
-\var{GetInt64Prop} returns the value of the property of type
|
|
|
|
-\var{Int64} that is described by \var{PropInfo} for the object
|
|
|
|
-\var{Instance}.
|
|
|
|
-
|
|
|
|
|
|
+\var{SetObjectProp} assigns \var{Value} to the the object property described by
|
|
|
|
+\var{PropInfo} or with name \var{Propname} for the object \var{Instance}.
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
-\var{PropInfo} describes a valid \var{Int64} property of \var{Instance}.
|
|
|
|
|
|
+\var{PropInfo} describes a valid method property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seep{SetInt64Prop}, \seef{GetOrdProp}, \seef{GetStrProp},
|
|
|
|
-\seef{GetFloatProp}, \seef{GetMethodProp}
|
|
|
|
-
|
|
|
|
-\end{function}
|
|
|
|
|
|
+\seef{GetObjectProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
|
|
+\seep{SetFloatProp}, \seep{SetInt64Prop}, \seep{SetMethodProp}
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
-\begin{procedure}{SetInt64Prop}
|
|
|
|
|
|
+\begin{procedure}{SetOrdProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Procedure SetInt64Prop(Instance: TObject; PropInfo: PPropInfo; const Value: Int64);
|
|
|
|
|
|
+Procedure SetOrdProp(Instance : TObject; PropInfo : PPropInfo;
|
|
|
|
+ Value : Longint);\\
|
|
|
|
+Procedure SetOrdProp(Instance: TObject; const PropName: string;
|
|
|
|
+ Value: Longint);
|
|
\Description
|
|
\Description
|
|
-\var{SetInt64Prop} assigns \var{Value} to the property of type
|
|
|
|
-\var{Int64} that is described by \var{PropInfo} for the object
|
|
|
|
-\var{Instance}.
|
|
|
|
|
|
+\var{SetOrdProp} assigns \var{Value} to the the ordinal property described by
|
|
|
|
+\var{PropInfo} or with name \var{Propname} for the object \var{Instance}.
|
|
|
|
+
|
|
|
|
+Ordinal properties that can be set include:
|
|
|
|
+\begin{description}
|
|
|
|
+\item[Integers and subranges of integers] The actual value of the integer must be
|
|
|
|
+passed.
|
|
|
|
+\item[Enumerated types and subranges of enumerated types] The ordinal value
|
|
|
|
+of the enumerated type must be passed.
|
|
|
|
+\item[Subrange types] of integers or enumerated types. Here the ordinal
|
|
|
|
+value must be passed.
|
|
|
|
+\item[Sets] If the base type of the set has less than 31 possible values.
|
|
|
|
+For each possible value; the corresponding bit of \var{Value} must be set.
|
|
|
|
+\end{description}
|
|
\Errors
|
|
\Errors
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
No checking is done whether \var{Instance} is non-nil, or whether
|
|
-\var{PropInfo} describes a valid \var{Int64} property of \var{Instance}.
|
|
|
|
|
|
+\var{PropInfo} describes a valid ordinal property of \var{Instance}.
|
|
|
|
+No range checking is performed.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetInt64Prop}, \seef{GetMethodProp}, \seep{SetOrdProp}, \seep{SetStrProp},
|
|
|
|
-\seep{SetFloatProp}
|
|
|
|
|
|
+\seef{GetOrdProp}, \seep{SetStrProp}, \seep{SetFloatProp},
|
|
|
|
+\seep{SetInt64Prop},\seep{SetMethodProp}
|
|
\end{procedure}
|
|
\end{procedure}
|
|
|
|
|
|
-\begin{function}{GetEnumName}
|
|
|
|
|
|
+\begin{procedure}{SetPropValue}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
|
|
|
|
|
|
+Procedure SetPropValue(Instance: TObject;
|
|
|
|
+ const PropName: string; const Value: Variant);
|
|
\Description
|
|
\Description
|
|
-\var{GetEnumName} scans the type information for the enumeration type
|
|
|
|
-desribed by \var{TypeInfo} and returns the name of the enumeration
|
|
|
|
-constant for the element with ordinal value equal to \var{Value}.
|
|
|
|
|
|
+\Errors
|
|
|
|
+\SeeAlso
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
-If \var{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.
|
|
|
|
|
|
+\begin{procedure}{SetSetProp}
|
|
|
|
+\Declaration
|
|
|
|
+Procedure SetSetProp(Instance: TObject;
|
|
|
|
+ const PropInfo: PPropInfo; const Value: string);\\
|
|
|
|
+Procedure SetSetProp(Instance: TObject;
|
|
|
|
+ const PropName: string; const Value: string);
|
|
|
|
+\Description
|
|
|
|
+\Errors
|
|
|
|
+\SeeAlso
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
-This can be used in combination with \var{GetOrdProp} to stream a property
|
|
|
|
-of an enumerated type.
|
|
|
|
|
|
+\begin{procedure}{SetStrProp}
|
|
|
|
+\Declaration
|
|
|
|
+procedure SetStrProp(Instance : TObject; PropInfo : PPropInfo;
|
|
|
|
+ const Value : Ansistring);\\
|
|
|
|
+Procedure SetStrProp(Instance: TObject; const PropName: string;
|
|
|
|
+ const Value: AnsiString);
|
|
|
|
+\Description
|
|
|
|
+\var{SetStrProp} assigns \var{Value} to the string property described by
|
|
|
|
+\var{PropInfo} or with name \var{Propname} for object \var{Instance}.
|
|
|
|
+\Errors
|
|
|
|
+No checking is done whether \var{Instance} is non-nil, or whether
|
|
|
|
+\var{PropInfo} describes a valid string property of \var{Instance}.
|
|
|
|
+Specifying an invalid property name in \var{PropName} will result in an
|
|
|
|
+\var{EPropertyError} exception.
|
|
|
|
+\SeeAlso
|
|
|
|
+\seef{GetStrProp}, \seep{SetOrdProp}, \seep{SetFloatProp},
|
|
|
|
+\seep{SetInt64Prop},\seep{SetMethodProp}
|
|
|
|
+\end{procedure}
|
|
|
|
+
|
|
|
|
+\begin{function}{SetToString}
|
|
|
|
+\Declaration
|
|
|
|
+function SetToString(PropInfo: PPropInfo;
|
|
|
|
+ Value: Integer) : String;\\
|
|
|
|
+function SetToString(PropInfo: PPropInfo;
|
|
|
|
+ Value: Integer; Brackets: Boolean) : String;
|
|
|
|
+\Description
|
|
\Errors
|
|
\Errors
|
|
-No check is done whether \var{TypeInfo} points to the type information
|
|
|
|
-for an enumerated type.
|
|
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetOrdProp}, \seef{GetEnumValue}
|
|
|
|
\end{function}
|
|
\end{function}
|
|
|
|
|
|
-\begin{function}{GetEnumValue}
|
|
|
|
|
|
+\begin{procedure}{SetVariantProp}
|
|
\Declaration
|
|
\Declaration
|
|
-Function GetEnumValue(TypeInfo : PTypeInfo;const Name : string) : Integer;
|
|
|
|
|
|
+Procedure SetVariantProp(Instance : TObject;
|
|
|
|
+ PropInfo : PPropInfo;
|
|
|
|
+ Const Value: Variant);\\
|
|
|
|
+Procedure SetVariantProp(Instance: TObject;
|
|
|
|
+ const PropName: string;
|
|
|
|
+ const Value: Variant);
|
|
\Description
|
|
\Description
|
|
-\var{GetEnumValue} scans the type information for the enumeration type
|
|
|
|
-described by \var{TypeInfor} and returns the ordinal value for the element
|
|
|
|
-in the enumerated type that has identifier \var{Name}. The identifier is
|
|
|
|
-searched in a case-insensitive manner.
|
|
|
|
|
|
+Not yet implemented. Provided for Delphi compatibility only.
|
|
|
|
+\Errors
|
|
|
|
+\SeeAlso
|
|
|
|
+\end{procedure}
|
|
|
|
|
|
-This can be used to set the value of enumerated properties from a stream.
|
|
|
|
|
|
+
|
|
|
|
+\begin{function}{StringToSet}
|
|
|
|
+\Declaration
|
|
|
|
+function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
|
|
|
|
+\Description
|
|
\Errors
|
|
\Errors
|
|
-If \var{Name} is not found in the list of enumerated values, then -1 is
|
|
|
|
-returned. No check is done whether \var{TypeInfo} points to the type information
|
|
|
|
-for an enumerated type.
|
|
|
|
\SeeAlso
|
|
\SeeAlso
|
|
-\seef{GetEnumName}, \seep{SetOrdProp}
|
|
|
|
\end{function}
|
|
\end{function}
|