Version: 3.2.5
wxVariantDataCurrency Class Reference

#include <wx/msw/ole/oleutils.h>

+ Inheritance diagram for wxVariantDataCurrency:

Detailed Description

This class represents a thin wrapper for Microsoft Windows CURRENCY type.

It is used for converting between wxVariant and OLE VARIANT with type set to VT_CURRENCY. When wxVariant stores wxVariantDataCurrency, it returns "currency" as its type.

An example of setting and getting CURRENCY value to and from wxVariant:

CURRENCY cy;
wxVariant variant;
// set wxVariant to currency type
if ( SUCCEEDED(VarCyFromR8(123.45, &cy)) ) // set cy to 123.45
{
variant.SetData(new wxVariantDataCurrency(cy));
// or instead of the line above you could write:
// wxVariantDataCurrency wxCy;
// wxCy.SetValue(cy);
// variant.SetData(wxCy.Clone());
}
// get CURRENCY value from wxVariant
if ( variant.GetType() == "currency" )
{
wxCy = wxDynamicCastVariantData(variant.GetData(), wxVariantDataCurrency);
cy = wxCy->GetValue();
}
This class represents a thin wrapper for Microsoft Windows CURRENCY type.
Definition: oleutils.h:80
CURRENCY GetValue() const
Returns the stored CURRENCY value.
wxVariantDataCurrency()
Default constructor initializes the object to 0.0.
The wxVariant class represents a container for any type.
Definition: variant.h:163
void SetData(wxVariantData *data)
Sets the internal variant data, deleting the existing data if there is any.
wxString GetType() const
Returns the value type as a string.
wxVariantData * GetData() const
Returns a pointer to the internal variant data.
Availability:  only available for the wxMSW port.
Since
2.9.5

Library:  wxCore
Category:  Data Structures
See also
wxAutomationObject, wxVariant, wxVariantData, wxVariantDataErrorCode

Public Member Functions

 wxVariantDataCurrency ()
 Default constructor initializes the object to 0.0. More...
 
 wxVariantDataCurrency (CURRENCY value)
 Constructor from CURRENCY. More...
 
CURRENCY GetValue () const
 Returns the stored CURRENCY value. More...
 
void SetValue (CURRENCY value)
 Sets the stored value to value. More...
 
virtual bool Eq (wxVariantData &data) const
 Returns true if data is of wxVariantDataCurency type and contains the same CURRENCY value. More...
 
virtual bool Write (wxString &str) const
 Fills the provided string with the textual representation of this object. More...
 
wxVariantDataClone () const
 Returns a copy of itself. More...
 
virtual wxString GetType () const
 Returns "currency". More...
 
virtual bool GetAsAny (wxAny *any) const
 Converts the value of this object to wxAny. More...
 
- Public Member Functions inherited from wxVariantData
 wxVariantData ()
 Default constructor. More...
 
void DecRef ()
 Decreases reference count. More...
 
virtual bool GetAny (wxAny *any) const
 Converts value to wxAny, if possible. 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...
 

Constructor & Destructor Documentation

◆ wxVariantDataCurrency() [1/2]

wxVariantDataCurrency::wxVariantDataCurrency ( )

Default constructor initializes the object to 0.0.

◆ wxVariantDataCurrency() [2/2]

wxVariantDataCurrency::wxVariantDataCurrency ( CURRENCY  value)

Constructor from CURRENCY.

Member Function Documentation

◆ Clone()

wxVariantData* wxVariantDataCurrency::Clone ( ) const
virtual

Returns a copy of itself.

Reimplemented from wxVariantData.

◆ Eq()

virtual bool wxVariantDataCurrency::Eq ( wxVariantData data) const
virtual

Returns true if data is of wxVariantDataCurency type and contains the same CURRENCY value.

Implements wxVariantData.

◆ GetAsAny()

virtual bool wxVariantDataCurrency::GetAsAny ( wxAny any) const
virtual

Converts the value of this object to wxAny.

◆ GetType()

virtual wxString wxVariantDataCurrency::GetType ( ) const
virtual

Returns "currency".

Implements wxVariantData.

◆ GetValue()

CURRENCY wxVariantDataCurrency::GetValue ( ) const

Returns the stored CURRENCY value.

◆ SetValue()

void wxVariantDataCurrency::SetValue ( CURRENCY  value)

Sets the stored value to value.

◆ Write()

virtual bool wxVariantDataCurrency::Write ( wxString str) const
virtual

Fills the provided string with the textual representation of this object.

The implementation of this method uses VarBstrFromCy() Windows API function with LOCALE_USER_DEFAULT.

Reimplemented from wxVariantData.