variant Class Reference
[COM Utility Library]

#include <comstl/util/variant.hpp>

List of all members.


Detailed Description

Facade for the COM VARIANT type.

Remarks:
comstl::variant publicly derives from VARIANT as a measure of expedience, rather than as an act of design sophistication. Any manual manipulation of the instances, or their member variables, is at the user's risk. Notwithstanding, this is helped by the fact that comstl::variant declares no member variables and no virtual member functions - for most compilers this means that the Empty Derived Optimisation (see Section 12.4 of Imperfect C++) will apply.
Examples:

by_project/comstl/comstl.cpp.


Public Types

typedef variant class_type
 Member Types.
typedef bool bool_type
typedef size_t size_type

Public Member Functions

 variant ()
 Conversion.
 variant (VARIANT const &rhs)
 Copying constructor.
 variant (class_type const &rhs)
 Copy constructor.
class_typeoperator= (class_type const &rhs)
 Copy assignment operator.
 variant (bool b)
 Conversion constructor.
 variant (stlsoft::sint8_t i)
 Conversion constructor.
 variant (stlsoft::uint8_t i)
 Conversion constructor.
 variant (stlsoft::sint16_t i)
 Conversion constructor.
 variant (stlsoft::uint16_t i)
 Conversion constructor.
 variant (stlsoft::sint32_t i)
 Conversion constructor.
 variant (stlsoft::uint32_t i)
 Conversion constructor.
 variant (float r)
 Conversion constructor.
 variant (double r)
 Conversion constructor.
 variant (CY cy)
 Conversion constructor.
 variant (DECIMAL const &dec)
 Conversion constructor.
 variant (LPUNKNOWN punk, bool_type bAddRef)
 variant (LPDISPATCH pdisp, bool_type bAddRef)
 variant (char const *s, int len=-1)
 variant (wchar_t const *s, int len=-1)
 variant (VARIANT const &var, VARTYPE vt)
 ~variant () throw ()
 Releases any resources associated with the underlying VARIANT.
void clear ()
 Clears the variant.
HRESULT try_conversion_copy (VARIANT const &var, VARTYPE vt)
 Operations.
HRESULT try_convert (VARTYPE vt)
class_typeconvert (VARTYPE vt)
HRESULT QueryInterface (REFIID riid, void **ppv) const
 Returns a pointer to a specified interface on an object to which a client currently holds an interface pointer.
template<typename I>
HRESULT QueryInterfaceValue (I **ppi)
 Returns a pointer to a specified interface on an object to which a client currently holds an interface pointer.
void swap (class_type &rhs)
 Swaps the contents with another instance.
bool_type equal (class_type const &rhs) const
 Comparison.
bool_type equal (VARIANT const &rhs) const

Member Typedef Documentation

Member Types.


Constructor & Destructor Documentation

variant (  ) 

Conversion.

Default constructor Initialises the instance

Postcondition:
assert(VT_EMPTY == this->vt)
Exceptions:
- Does not throw an exception

variant ( VARIANT const &  rhs  ) 

Copying constructor.

Initialises the instance with a copy of the given VARIANT

Postcondition:
assert(rhs == *this)
Exceptions:
comstl::com_exception If the copy fails

variant ( class_type const &  rhs  ) 

Copy constructor.

Postcondition:
assert(rhs == *this)
Exceptions:
comstl::com_exception If the copy fails

variant ( bool  b  ) 

Conversion constructor.

Initialises the instance with the given boolean value

Postcondition:
assert(VT_BOOL == this->vt)

assert(b == (VARIANT_TRUE == this->boolVal))

Exceptions:
- Does not throw an exception

Conversion constructor.

Initialises the instance with the given 8-bit signed integer value

Postcondition:
assert(VT_I1 == this->vt)

assert(i == this->cVal)

Exceptions:
- Does not throw an exception

Conversion constructor.

Initialises the instance with the given 8-bit unsigned integer value

Postcondition:
assert(VT_UI1 == this->vt)

assert(i == this->bVal)

Exceptions:
- Does not throw an exception

Conversion constructor.

Initialises the instance with the given 16-bit signed integer value

Postcondition:
assert(VT_I2 == this->vt)

assert(i == this->iVal)

Exceptions:
- Does not throw an exception

Conversion constructor.

Initialises the instance with the given 16-bit unsigned integer value

Postcondition:
assert(VT_UI2 == this->vt)

assert(i == this->uiVal)

Exceptions:
- Does not throw an exception

Conversion constructor.

Initialises the instance with the given 32-bit signed integer value

Postcondition:
assert(VT_I4 == this->vt)

assert(i == this->lVal)

Exceptions:
- Does not throw an exception

Conversion constructor.

Initialises the instance with the given 32-bit unsigned integer value

Postcondition:
assert(VT_UI4 == this->vt)

assert(i == this->ulVal)

Exceptions:
- Does not throw an exception

variant ( float  r  ) 

Conversion constructor.

Initialises the instance with the given float value

Postcondition:
assert(VT_R4 == this->vt)

assert(r == this->fltVal)

Exceptions:
- Does not throw an exception

variant ( double  r  ) 

Conversion constructor.

Initialises the instance with the given double value

Postcondition:
assert(VT_R8 == this->vt)

assert(r == this->dblVal)

Exceptions:
- Does not throw an exception

variant ( CY  cy  ) 

Conversion constructor.

Initialises the instance with the given currency (CY) value

Postcondition:
assert(VT_CY == this->vt)

assert(r == this->cyVal)

Exceptions:
- Does not throw an exception

variant ( DECIMAL const &  dec  ) 

Conversion constructor.

Initialises the instance with the given DECIMAL value

Postcondition:
assert(VT_DECIMAL == this->vt)

assert(dec == this->decVal)

Exceptions:
- Does not throw an exception

~variant (  )  throw () [inline]

Releases any resources associated with the underlying VARIANT.


Member Function Documentation

class_type& operator= ( class_type const &  rhs  ) 

Copy assignment operator.

Postcondition:
assert(rhs == *this)
Exceptions:
comstl::com_exception If the copy fails

void clear (  ) 

Clears the variant.

Postcondition:
assert(VT_EMPTY == this->vt)

HRESULT try_conversion_copy ( VARIANT const &  var,
VARTYPE  vt 
)

Operations.

HRESULT QueryInterface ( REFIID  riid,
void **  ppv 
) const

Returns a pointer to a specified interface on an object to which a client currently holds an interface pointer.

Returns:
An HRESULT code indicating the success of the operation.
Return values:
<code>S_OK</code> The interface is supported: *ppv will hold the pointer to the requested interface
<code>E_INTERFACE</code> The interface is not supported: the value of *ppv is undefined.
Precondition:
NULL != ppv

HRESULT QueryInterfaceValue ( I **  ppi  )  [inline]

Returns a pointer to a specified interface on an object to which a client currently holds an interface pointer.

Returns:
An HRESULT code indicating the success of the operation.
Return values:
<code>S_OK</code> The interface is supported: *ppi will hold the pointer to the requested interface
<code>E_INTERFACE</code> The interface is not supported: the value of *ppi is undefined.
Precondition:
NULL != ppi

void swap ( class_type rhs  ) 

Swaps the contents with another instance.

bool_type equal ( class_type const &  rhs  )  const

Comparison.


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:58:27 2010 for STLSoft by  doxygen 1.5.6