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)
  private
    FVarType : tvartype;
  protected
    function QueryInterface(const IID: TGuid; out Obj) : HRESULT;  Virtual;
    function _AddRef : LongInt;
    function _Release : LongInt;
    procedure SimplisticClear(var V: tvardata);
    procedure SimplisticCopy(var Dest: tvardata; const Source: tvardata; 
                            const Indirect: Boolean);
    procedure RaiseInvalidOp;
    procedure RaiseCastError;
    procedure RaiseDispError;
    function LeftPromotion(const V: tvardata; const Operation: tvarop; 
                          out RequiredVarType: tvartype) : Boolean;  Virtual;
    function RightPromotion(const V: tvardata; const Operation: tvarop; 
                           out RequiredVarType: tvartype) : Boolean
                           ;  Virtual;
    function OlePromotion(const V: tvardata; out RequiredVarType: tvartype)
                          : Boolean;  Virtual;
    procedure DispInvoke(Dest: pvardata; var Source: tvardata; 
                        CallDesc: pcalldesc; Params: Pointer);  Virtual;
    procedure VarDataInit(var Dest: tvardata);
    procedure VarDataClear(var Dest: tvardata);
    procedure VarDataCopy(var Dest: tvardata; const Source: tvardata);
    procedure VarDataCopyNoInd(var Dest: tvardata; const Source: tvardata);
    procedure VarDataCast(var Dest: tvardata; const Source: tvardata);
    procedure VarDataCastTo(var Dest: tvardata; const Source: tvardata; 
                           const aVarType: tvartype);  Overload;
    procedure VarDataCastTo(var Dest: tvardata; const aVarType: tvartype)
                           ;  Overload;
    procedure VarDataCastToOleStr(var Dest: tvardata);
    procedure VarDataFromStr(var V: tvardata; const Value: string);
    procedure VarDataFromOleStr(var V: tvardata; const Value: WideString);
    function VarDataToStr(const V: tvardata) : string;
    function VarDataIsEmptyParam(const V: tvardata) : Boolean;
    function VarDataIsByRef(const V: tvardata) : Boolean;
    function VarDataIsArray(const V: tvardata) : Boolean;
    function VarDataIsOrdinal(const V: tvardata) : Boolean;
    function VarDataIsFloat(const V: tvardata) : Boolean;
    function VarDataIsNumeric(const V: tvardata) : Boolean;
    function VarDataIsStr(const V: tvardata) : Boolean;
  public
    constructor Create;  Overload;
    constructor Create(RequestedVarType: tvartype);  Overload;
    destructor Destroy;  Override;
    function IsClear(const V: tvardata) : Boolean;  Virtual;
    procedure Cast(var Dest: tvardata; const Source: tvardata);  Virtual;
    procedure CastTo(var Dest: tvardata; const Source: tvardata; 
                    const aVarType: tvartype);  Virtual;
    procedure CastToOle(var Dest: tvardata; const Source: tvardata)
                       ;  Virtual;
    procedure Clear(var V: tvardata);  Virtual;  Abstract;
    procedure Copy(var Dest: tvardata; const Source: tvardata; 
                  const Indirect: Boolean);  Virtual;  Abstract;
    procedure BinaryOp(var Left: tvardata; const Right: tvardata; 
                      const Operation: tvarop);  Virtual;
    procedure UnaryOp(var Right: tvardata; const Operation: tvarop)
                     ;  Virtual;
    function CompareOp(const Left: tvardata; const Right: tvardata; 
                      const Operation: tvarop) : Boolean;  Virtual;
    procedure Compare(const Left: tvardata; const Right: tvardata; 
                     var Relationship: TVarCompareResult);  Virtual;
    VarType : tvartype;
  end
  ;

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.

Members

Member Type Visibility Description
BinaryOp Method public Perform a binary mathematical operation
Cast Method public Cast a custom variant to another type
CastTo Method public Cast a custom variant to another type
CastToOle Method public Cast variant value to OLE value
Clear Method public Clear a value
Compare Method public Comparison 2 custom variant values
CompareOp Method public Check result of a comparison between 2 custom variant values
Copy Method public Copy a custom variant value
Create Method public Instantiate a new custom variant type
Destroy Method public Unregister variant type
DispInvoke Method protected
FVarType Field private
IsClear Method public Is the custom value unassigned ?
LeftPromotion Method protected
OlePromotion Method protected
QueryInterface Method protected
RaiseCastError Method protected
RaiseDispError Method protected
RaiseInvalidOp Method protected
RightPromotion Method protected
SimplisticClear Method protected
SimplisticCopy Method protected
UnaryOp Method public Perform a unary mathematical operation
VarDataCast Method protected
VarDataCastTo Method protected
VarDataCastToOleStr Method protected
VarDataClear Method protected
VarDataCopy Method protected
VarDataCopyNoInd Method protected
VarDataFromOleStr Method protected
VarDataFromStr Method protected
VarDataInit Method protected
VarDataIsArray Method protected
VarDataIsByRef Method protected
VarDataIsEmptyParam Method protected
VarDataIsFloat Method protected
VarDataIsNumeric Method protected
VarDataIsOrdinal Method protected
VarDataIsStr Method protected
VarDataToStr Method protected
VarType Property public Registered type
_AddRef Method protected
_Release Method protected

Inheritance

Class Description
TCustomVariantType(IInterface) Base class for a custom variant type

See also

Name Description
#rtl.system.TVarRec Record describing an element in an array of const
tvartype Type with size of variant type.
tvartype Type with size of variant type.