OleVariant

OleVariant is a C++Builder implementation of the Object Pascal intrinsic type OleVariant.

Header

sysvari.h

Description

OleVariant is a special descendant of the Variant class that is used to represent COM interfaces or data that is passed over a COM interface. OleVariant inherits from Variant as a protected class so that it can prevent operations on AnsiString objects, which are not compatible with COM.

The syntax for using OleVariant is the same as that for using the Variant class. Like the Variant class, OleVariant has the following characteristics:

OleVariants can contain integer values, real values, string values, boolean values, date-and-time values, and Automation objects. In addition, OleVariants can contain arrays of varying size and dimension with elements of any of these types.
The special OleVariant value Unassigned is used to indicate that a OleVariant has not yet been assigned a value, and the special OleVariant value Null is used to indicate unknown or missing data.
A OleVariant can be combined with other OleVariants and it can be constructed from any of the following data types. The compiler automatically performs the necessary type conversions.

• short WordBool
• int Byte
• float Variant
• double WideString
• Currency wchar_t*
• TDateTime Ole2::IDispatch*
• bool Ole2::IUnknown*



When an OleVariant contains an Automation object, the OleVariant can be used to get and set properties of the object, and to invoke methods on the object.

OleVariant variables are always initialized to be Unassigned when they are first created. This is true whether a OleVariant variable is global, local, or part of a structure such as an array.

Note that while OleVariants offer great flexibility, they also consume more memory than regular variables, and operations on OleVariants are substantially slower than operations on statically typed values.

Note: Use only the operators declared within OleVariant. The compiler will ignore any operators you overload yourself.
Note: For binary operators, if one operand is of type OleVariant, the other operand is automatically converted to type OleVariant.

Comments

Popular posts from this blog

TClientDataSet::AppendData and TClientDataSet::BeforeGetRecords

cdecl, _cdecl, __cdecl