Version: 3.1.0
wxVariantData Class Referenceabstract

#include <wx/variant.h>

+ Inheritance diagram for wxVariantData:

Detailed Description

The wxVariantData class is used to implement a new type for wxVariant.

Derive from wxVariantData, and override the pure virtual functions.

wxVariantData is reference counted, but you don't normally have to care about this, as wxVariant manages the count automatically. However, in case your application needs to take ownership of wxVariantData, be aware that the object is created with a reference count of 1, and passing it to wxVariant will not increase this. In other words, IncRef() needs to be called only if you both take ownership of wxVariantData and pass it to a wxVariant. Also note that the destructor is protected, so you can never explicitly delete a wxVariantData instance. Instead, DecRef() will delete the object automatically when the reference count reaches zero.

Library:  wxBase
Category:  Data Structures
See also
wxVariant, wxGetVariantCast()

Public Member Functions

 wxVariantData ()
 Default constructor. More...
 
virtual wxVariantDataClone () const
 This function can be overridden to clone the data. More...
 
void DecRef ()
 Decreases reference count. More...
 
virtual bool Eq (wxVariantData &data) const =0
 Returns true if this object is equal to data. More...
 
virtual bool GetAny (wxAny *any) const
 Converts value to wxAny, if possible. More...
 
virtual wxString GetType () const =0
 Returns the string type of the data. More...
 
virtual wxClassInfoGetValueClassInfo ()
 If the data is a wxObject returns a pointer to the objects wxClassInfo structure, if the data isn't a wxObject the method returns NULL. More...
 
void IncRef ()
 Increases reference count. More...
 
virtual bool Read (istream &stream)
 Reads the data from stream. More...
 
virtual bool Read (wxString &string)
 Reads the data from string. More...
 
virtual bool Write (ostream &stream) const
 Writes the data to stream. More...
 
virtual bool Write (wxString &string) const
 Writes the data to string. More...
 

Constructor & Destructor Documentation

wxVariantData::wxVariantData ( )

Default constructor.

Member Function Documentation

virtual wxVariantData* wxVariantData::Clone ( ) const
virtual

This function can be overridden to clone the data.

You must implement this function in order for wxVariant::Unshare() to work for your data. This function is implemented for all built-in data types.

Reimplemented in wxVariantDataSafeArray, wxVariantDataErrorCode, and wxVariantDataCurrency.

void wxVariantData::DecRef ( )

Decreases reference count.

If the count reaches zero, the object is automatically deleted.

Note
The destructor of wxVariantData is protected, so delete cannot be used as normal. Instead, DecRef() should be called.
virtual bool wxVariantData::Eq ( wxVariantData data) const
pure virtual

Returns true if this object is equal to data.

Implemented in wxVariantDataSafeArray, wxVariantDataErrorCode, and wxVariantDataCurrency.

virtual bool wxVariantData::GetAny ( wxAny any) const
virtual

Converts value to wxAny, if possible.

Return true if successful.

virtual wxString wxVariantData::GetType ( ) const
pure virtual

Returns the string type of the data.

Implemented in wxVariantDataSafeArray, wxVariantDataErrorCode, and wxVariantDataCurrency.

virtual wxClassInfo* wxVariantData::GetValueClassInfo ( )
virtual

If the data is a wxObject returns a pointer to the objects wxClassInfo structure, if the data isn't a wxObject the method returns NULL.

void wxVariantData::IncRef ( )

Increases reference count.

Note that initially wxVariantData has reference count of 1.

virtual bool wxVariantData::Read ( istream &  stream)
virtual

Reads the data from stream.

virtual bool wxVariantData::Read ( wxString string)
virtual

Reads the data from string.

virtual bool wxVariantData::Write ( ostream &  stream) const
virtual

Writes the data to stream.

virtual bool wxVariantData::Write ( wxString string) const
virtual

Writes the data to string.

Reimplemented in wxVariantDataSafeArray, wxVariantDataErrorCode, and wxVariantDataCurrency.