.\" This is a wxWidgets manpage page generated from the XML docs .TH wxVariant 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxVariant \- A class for storing arbitrary types that may change at run-time .SH DESCRIPTION The wxVariant 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, wxVariant 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 wxVariant's capabilities by deriving from the class wxVariantData and using the wxVariantData form of the wxVariant constructor or assignment operator to assign this data to a variant. Actual values for user-defined types will need to be accessed via the wxVariantData 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 wxVariant. This might be used, for example, in CORBA or OLE automation classes, where named parameters are required. .SH "PARENTS" wxObject .SH "INCLUDE FILES" wx/variant.h .SH MEMBERS .SS wxVariant () Default constructor. .SS wxVariant (const wxVariant& variant) Copy constructor. .SS wxVariant (const char* valueconst wxString& name = ``") .SS wxVariant (const wxString& valueconst wxString& name = ``") Construction from a string value. .SS wxVariant (char valueconst wxString& name = ``") Construction from a character value. .SS wxVariant (long valueconst wxString& name = ``") Construction from an integer value. You may need to cast to (long) to avoid confusion with other constructors (such as the bool constructor). .SS wxVariant (bool valueconst wxString& name = ``") Construction from a boolean value. .SS wxVariant (double valueconst wxString& name = ``") Construction from a double-precision floating point value. .SS wxVariant (const wxList& valueconst wxString& name = ``") Construction from a list of wxVariant objects. This constructor copies value , the application is still responsible for deleting value and its contents. .SS wxVariant (void* valueconst wxString& name = ``") Construction from a void pointer. .SS wxVariant (wxObject* valueconst wxString& name = ``") Construction from a wxObject pointer. .SS wxVariant (wxVariantData* dataconst wxString& name = ``") Construction from user-defined data. The variant holds onto the data pointer. .SS wxVariant (wxDateTime& valconst wxString& name = ``") Construction from a wxDateTime . .SS wxVariant (wxArrayString& valconst wxString& name = ``") Construction from an array of strings. This constructor copies value and its contents. .SS wxVariant (DATE_STRUCT* valconst wxString& name = ``") Construction from a odbc date value. Represented internally by a wxDateTime value. .SS wxVariant (TIME_STRUCT* valconst wxString& name = ``") Construction from a odbc time value. Represented internally by a wxDateTime value. .SS wxVariant (TIMESTAMP_STRUCT* valconst wxString& name = ``") Construction from a odbc timestamp value. Represented internally by a wxDateTime value. .SS ~wxVariant () Destructor. .SS void Append (const wxVariant& value) Appends a value to the list. .SS void ClearList () Deletes the contents of the list. .SS bool Convert (long* value) .SS bool Convert (bool* value) .SS bool Convert (double* value) .SS bool Convert (wxString* value) .SS bool Convert (char* value) .SS bool Convert (wxDateTime* value) Retrieves and converts the value of this variant to the type that value is. .SS int GetCount () Returns the number of elements in the list. .SS bool Delete (int item) Deletes the zero-based item from the list. .SS wxArrayString GetArrayString () Returns the string array value. .SS bool GetBool () Returns the boolean value. .SS char GetChar () Returns the character value. .SS wxVariantData* GetData () Returns a pointer to the internal variant data. .SS wxDateTime GetDateTime () Returns the date value. .SS double GetDouble () Returns the floating point value. .SS long GetLong () Returns the integer value. .SS const wxString& GetName () Returns a constant reference to the variant name. .SS wxString GetString () Gets the string value. .SS wxString GetType () 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). .SS void* GetVoidPtr () Gets the void pointer value. .SS void* GetWxObjectPtr () Gets the wxObject pointer value. .SS void Insert (const wxVariant& value) Inserts a value at the front of the list. .SS bool IsNull () Returns true if there is no data associated with this variant, false if there is data. .SS bool IsType (const wxString& type) Returns true if type matches the type of the variant, false otherwise. .SS bool IsValueKindOf (const wxClassInfo* type) Returns true if the data is derived from the class described by type , false otherwise. .SS void MakeNull () Makes the variant null by deleting the internal data. .SS wxString MakeString () Makes a string representation of the variant value (for any type). .SS bool Member (const wxVariant& value) Returns true if value matches an element in the list. .SS void NullList () 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. .SS void SetData (wxVariantData* data) Sets the internal variant data, deleting the existing data if there is any. .SS void operator = (const wxVariant& value) .SS void operator = (wxVariantData* value) .SS void operator = (const wxString& value) .SS void operator = (const char* value) .SS void operator = (char value) .SS void operator = (const long value) .SS void operator = (const bool value) .SS void operator = (const double value) .SS void operator = (void* value) .SS void operator = (const wxList& value) .SS void operator = (const wxDateTime& value) .SS void operator = (const wxArrayString& value) .SS void operator = (const DATE_STRUCT* value) .SS void operator = (const TIME_STRUCT* value) .SS void operator = (const TIMESTAMP_STRUCT* value) Assignment operators. .SS bool operator == (const wxVariant& value) .SS bool operator == (const wxString& value) .SS bool operator == (const char* value) .SS bool operator == (char value) .SS bool operator == (const long value) .SS bool operator == (const bool value) .SS bool operator == (const double value) .SS bool operator == (void* value) .SS bool operator == (const wxList& value) .SS bool operator == (const wxArrayString& value) .SS bool operator == (const wxDateTime& value) Equality test operators. .SS bool operator != (const wxVariant& value) .SS bool operator != (const wxString& value) .SS bool operator != (const char* value) .SS bool operator != (char value) .SS bool operator != (const long value) .SS bool operator != (const bool value) .SS bool operator != (const double value) .SS bool operator != (void* value) .SS bool operator != (const wxList& value) .SS bool operator != (const wxArrayString& value) .SS bool operator != (const wxDateTime& value) Inequality test operators. .SS wxVariant operator [] (size_t idx) Returns the value at idx (zero-based). .SS wxVariant& operator [] (size_t idx) Returns a reference to the value at idx (zero-based). This can be used to change the value at this index. .SS char operator char () Operator for implicit conversion to a char, using wxVariant::GetChar . .SS double operator double () Operator for implicit conversion to a double, using wxVariant::GetDouble . .SS long operator long () Operator for implicit conversion to a long, using wxVariant::GetLong . .SS wxString operator wxString () Operator for implicit conversion to a string, using wxVariant::MakeString . .SS void* operator void* () Operator for implicit conversion to a pointer to a void, using wxVariant::GetVoidPtr . .SS void* operator wxDateTime () Operator for implicit conversion to a pointer to a wxDateTime , using wxVariant::GetDateTime . .SH "SEE ALSO" wxObject wxVariantData .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.