[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Variants' (#rtl)

# TCustomVariantType

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for a custom variant type

## Declaration

Source position: variants.pp line 161

`type TCustomVariantType = class(TObject, IInterface)`
`public`
`constructor Create();` |  | Instantiate a new custom variant type
`destructor Destroy; override;` |  | Unregister variant type
`function IsClear(); virtual;` |  | Is the custom value unassigned ?
`procedure Cast(); virtual;` |  | Cast a custom variant to another type
`procedure CastTo(); virtual;` |  | Cast a custom variant to another type
`procedure CastToOle(); virtual;` |  | Cast variant value to OLE value
`procedure Clear(); virtual; abstract;` |  | Clear a value
`procedure Copy(); virtual; abstract;` |  | Copy a custom variant value
`procedure BinaryOp(); virtual;` |  | Perform a binary mathematical operation
`procedure UnaryOp(); virtual;` |  | Perform a unary mathematical operation
`function CompareOp(); virtual;` |  | Check result of a comparison between 2 custom variant values
`procedure Compare(); virtual;` |  | Comparison 2 custom variant values
`property VarType: tvartype; [r]` |  | Registered type
`end;`

## Inheritance

`TCustomVariantType,IInterface` |  | Base class for a custom variant type
`TObject` |  | Base class of all classes.

## Description

TCustomVariantType is used as a base class to implement custom variants. To define a custom variant type, a descendent of TCustomVariant must be made, and the appropriate methods must be overridden and implemented according to the specifications of the new type. Typically this means defining how your new type maps to another variant or a basic type.

Note that the TCustomVariantType descendent does not hold the data of the variant: it just describes how a variant record (TVarRec) that contains the new type's data can be examined or manipulated.

## See also

#rtl.system.TVarRec |  | Record describing an element in an array of const

Documentation generated on: May 14 2021