TROComplexType
Overview
TROComplexType forms the base class for all struct types defined in your library.
Use Case
You will usually not instantiate instances of this class itself, but use the descendant classes that will be auto-generated in your _Intf unit for every struct defined in your RODL file. These descendant classes will contain properties for all fields you defined in your RODL.
Location
- Unit: uROTypes.pas
- Ancestry: TCollectionItem | TROComplexType
constructor Create reintroduce overload virtual
Creates a new instance.
constructor Create
constructor Create (TCollection) overload override
Creates a new instance with given parameter.
constructor Create(aCollection: TCollection)
Parameters:
- aCollection: collection
Assign override
Copies data from a given source.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
AssignTo override
Copies the properties of an object to a destination object.
procedure AssignTo(iDest: TPersistent)
Parameters:
- iDest: destination object.
Clone
Creates and returns a second copy of the struct.
The new instance will be a deep copy of the original struct, all nested members that are arrays, structs or binaries will be duplicated as part of the cloning process, so that the new instance and its members will be completely independent from the original class.
function Clone: TROComplexType
ContentAsJson
property ContentAsJson: UnicodeString read
ContentAsString
Returns the structure of the type in a string format.
property ContentAsString: string read
ContentAsXml
Returns the XML structure of the type in a string format.
property ContentAsXml: ROUTF8String read
FieldCount
property FieldCount: Integer read
FieldInfo
property FieldInfo[Index: Integer]: PTypeInfo read
FieldName
property FieldName[Index: Integer]: string read
FreeInternalProperties protected virtual
procedure FreeInternalProperties
GetAttributeCount virtual
Returns the number of custom attributes defined for the class.
class function GetAttributeCount: Integer
GetAttributeName virtual
Returns the name of custom attribute defined for the class, with the specified index.
class function GetAttributeName(aIndex: Integer): string
Parameters:
- aIndex: The index of attribute.
GetAttributeValue virtual
Returns the value of custom attribute defined for the class, with the specified index.
class function GetAttributeValue(aIndex: Integer): string
Parameters:
- aIndex: The index of attribute.
GetContentAsJson
function GetContentAsJson(aIncludeExtraInfo: Boolean): UnicodeString
Parameters:
- aIncludeExtraInfo:
GetContentAsXml
function GetContentAsXml(aOffset: Integer): ROUTF8String
Parameters:
- aOffset:
GetFieldNames
procedure GetFieldNames(aList: TStrings)
Parameters:
- aList:
GetFieldValue
function GetFieldValue(const aFieldName: string): Variant
Parameters:
- aFieldName:
ReadComplex virtual
Deserializes current class instance using provided serializer.
procedure ReadComplex(ASerializer: TObject)
Parameters:
- ASerializer: Data source (type TROSerializer).
SaveToJson protected virtual
procedure SaveToJson(const aRoot: TROJSONValue; aIncludeExtraInfo: Boolean)
Parameters:
- aRoot:
- aIncludeExtraInfo:
SaveToXml protected virtual
procedure SaveToXml(const aNode: TROConverterNode)
Parameters:
- aNode:
SetFieldValue
procedure SetFieldValue(const aFieldName: string; const aValue: Variant)
Parameters:
- aFieldName:
- aValue:
SmartAssign
Copies specific data from a given source.
procedure SmartAssign(Source: TPersistent; TypeKinds: TTypeKinds)
Parameters:
- Source: Instance whose properties will be copied
- TypeKinds: Specifies which properties should be copied
TryGetAttribute
class function TryGetAttribute(aName: string; out aValue: string): Boolean
Parameters:
- aName:
- aValue:
WriteComplex virtual
Serializes current class instance using provided serializer.
procedure WriteComplex(ASerializer: TObject)
Parameters:
- ASerializer: Data sink (type TROSerializer)
ContentAsJson
property ContentAsJson: UnicodeString read
ContentAsString
Returns the structure of the type in a string format.
property ContentAsString: string read
ContentAsXml
Returns the XML structure of the type in a string format.
property ContentAsXml: ROUTF8String read
FieldCount
property FieldCount: Integer read
FieldInfo
property FieldInfo[Index: Integer]: PTypeInfo read
FieldName
property FieldName[Index: Integer]: string read
GetAttributeCount virtual
Returns the number of custom attributes defined for the class.
class function GetAttributeCount: Integer
GetAttributeName virtual
Returns the name of custom attribute defined for the class, with the specified index.
class function GetAttributeName(aIndex: Integer): string
Parameters:
- aIndex: The index of attribute.
GetAttributeValue virtual
Returns the value of custom attribute defined for the class, with the specified index.
class function GetAttributeValue(aIndex: Integer): string
Parameters:
- aIndex: The index of attribute.
TryGetAttribute
class function TryGetAttribute(aName: string; out aValue: string): Boolean
Parameters:
- aName:
- aValue:
constructor Create reintroduce overload virtual
Creates a new instance.
constructor Create
constructor Create (TCollection) overload override
Creates a new instance with given parameter.
constructor Create(aCollection: TCollection)
Parameters:
- aCollection: collection
Assign override
Copies data from a given source.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
AssignTo override
Copies the properties of an object to a destination object.
procedure AssignTo(iDest: TPersistent)
Parameters:
- iDest: destination object.
Clone
Creates and returns a second copy of the struct.
The new instance will be a deep copy of the original struct, all nested members that are arrays, structs or binaries will be duplicated as part of the cloning process, so that the new instance and its members will be completely independent from the original class.
function Clone: TROComplexType
FreeInternalProperties protected virtual
procedure FreeInternalProperties
GetContentAsJson
function GetContentAsJson(aIncludeExtraInfo: Boolean): UnicodeString
Parameters:
- aIncludeExtraInfo:
GetContentAsXml
function GetContentAsXml(aOffset: Integer): ROUTF8String
Parameters:
- aOffset:
GetFieldNames
procedure GetFieldNames(aList: TStrings)
Parameters:
- aList:
GetFieldValue
function GetFieldValue(const aFieldName: string): Variant
Parameters:
- aFieldName:
ReadComplex virtual
Deserializes current class instance using provided serializer.
procedure ReadComplex(ASerializer: TObject)
Parameters:
- ASerializer: Data source (type TROSerializer).
SaveToJson protected virtual
procedure SaveToJson(const aRoot: TROJSONValue; aIncludeExtraInfo: Boolean)
Parameters:
- aRoot:
- aIncludeExtraInfo:
SaveToXml protected virtual
procedure SaveToXml(const aNode: TROConverterNode)
Parameters:
- aNode:
SetFieldValue
procedure SetFieldValue(const aFieldName: string; const aValue: Variant)
Parameters:
- aFieldName:
- aValue:
SmartAssign
Copies specific data from a given source.
procedure SmartAssign(Source: TPersistent; TypeKinds: TTypeKinds)
Parameters:
- Source: Instance whose properties will be copied
- TypeKinds: Specifies which properties should be copied
WriteComplex virtual
Serializes current class instance using provided serializer.
procedure WriteComplex(ASerializer: TObject)
Parameters:
- ASerializer: Data sink (type TROSerializer)