RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomVariantType.Copy Method

Copies the data from a Variant of this custom type.

Pascal
procedure Copy(var Dest: TVarData; const Source: TVarData; const Indirect: Boolean); virtual; abstract;
C++
virtual __fastcall Copy(TVarData Dest, const TVarData Source, const Boolean Indirect) = 0;

Override Copy to enable the custom Variant type to be copied (assigned) to another Variant.  

Dest is the TVarData record from the Variant whose value is to be a copy of the source Variant. 

Source is the TVarData record from a Variant of this custom type that is to be copied to Dest. 

Indirect indicates whether the copy is direct or indirect. When Indirect is true, the source TVarData record contains an indirect reference to its data (the VarDataIsByRef method should return true for Source). When making an indirect copy, it is not necessary to reallocate records or objects, because the Variant does not "own" the data, it merely points to it. When making a direct copy, Copy must allocate new memory for any allocated records or objects, so that Dest can "own" its own copy of the data. 

In TCustomVariantType, Copy is an abstract method. Descendant classes must override this method to provide an implementation. 

 

VarDataCopy 

VarDataCopyNoInd 

SimplisticCopy 

VarDataIsByRef 

Copying and Clearing Custom Variants

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!