The Variant class represents a container for any type.
A variant’s value can be changed at run time, possibly to a different type of value.
As standard, Variant can store values of type bool, char, double, long, string,
string list, time, date, void pointer, list of strings, and list of variants. However, an application can extend Variant’s capabilities by deriving from the class VariantData and using the VariantData form of the Variant constructor or assignment operator to assign this data to a variant. Actual values for user-defined types will need to be accessed via the VariantData object, unlike the case for basic data types where convenience functions such as GetLong can be used.
This class is useful for reducing the programming for certain tasks, such as an editor
for different data types, or a remote procedure call protocol.
An optional name member is associated with a Variant. This might be used, for example, in CORBA
or OLE automation classes, where named parameters are required.
Copy constructor.
Variant.new(%(arg-type)char% value, String name = "") Variant.new(%(arg-type)String% value, String name = "")Construction from a string value.
Variant.new(%(arg-type)char% value, String name = "")Construction from a character value.
Variant.new(%(arg-type)Integer% value, String name = "")Construction from an integer value. You may need to cast to (long) to
avoid confusion with other constructors (such as the bool constructor).
Construction from a boolean value.
Variant.new(%(arg-type)Float% value, String name = "")Construction from a double-precision floating point value.
Variant.new(%(arg-type)List% value, String name = "")Construction from a list of Variant objects. This constructor
copies value, the application is still responsible for
deleting value and its contents.
Construction from a void pointer.
Variant.new(%(arg-type)Object% value, String name = "")Construction from a Object pointer.
Variant.new(%(arg-type)VariantData% data, String name = "")Construction from user-defined data. The variant holds onto the data pointer.
Variant.new(%(arg-type)DateTime% val, String name = "")Construction from a DateTime.
Variant.new(%(arg-type)ArrayString% val, String name = "")Construction from an array of strings. This constructor copies value and its contents.
Variant.new(%(arg-type)DATE_STRUCT% val, String name = "")Construction from a odbc date value. Represented internally by a DateTime value.
Variant.new(%(arg-type)TIME_STRUCT% val, String name = "")Construction from a odbc time value. Represented internally by a DateTime value.
Variant.new(%(arg-type)TIMESTAMP_STRUCT% val, String name = "")Construction from a odbc timestamp value. Represented internally by a DateTime value.
destructor()Destructor.
Appends a value to the list.
Deletes the contents of the list.
Retrieves and converts the value of this variant to the type that value is.
Returns the number of elements in the list.
Deletes the zero-based item from the list.
Returns the string array value.
Returns the boolean value.
Returns the character value.
Returns a pointer to the internal variant data.
Returns the date value.
Returns the floating point value.
Returns the integer value.
Returns a constant reference to the variant name.
Gets the string value.
Returns the value type as a string. The built-in types are: bool, char, date, double, list, long, string, stringlist, time, void*.
If the variant is null, the value type returned is the string ``null" (not the empty string).
Gets the void pointer value.
Gets the Object pointer value.
Inserts a value at the front of the list.
Returns true if there is no data associated with this variant, false if there is data.
Returns true if type matches the type of the variant, false otherwise.
Returns true if the data is derived from the class described by type, false otherwise.
Makes the variant null by deleting the internal data.
Makes a string representation of the variant value (for any type).
Returns true if value matches an element in the list.
Makes an empty list. This differs from a null variant which has no data; a null list
is of type list, but the number of elements in the list is zero.
Sets the internal variant data, deleting the existing data if there is any.
Assignment operators.
Equality test operators.
Inequality test operators.
Returns the value at idx (zero-based).
Variant operator $[]$(%(arg-type)Integer% idx)Returns a reference to the value at idx (zero-based). This can be used
to change the value at this index.
Operator for implicit conversion to a char, using Variant#get_char.
Operator for implicit conversion to a double, using Variant#get_double.
Integer operator long()Operator for implicit conversion to a long, using Variant#get_long.
Operator for implicit conversion to a string, using Variant#make_string.
Operator for implicit conversion to a pointer to a void, using Variant#get_void_ptr.
Operator for implicit conversion to a pointer to a DateTime, using Variant#get_date_time.
[This page automatically generated from the Textile source at 2023-06-09 00:45:34 +0000]