Windows C++ Library
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
WCL::VariantVector< T > Class Template Reference

A Wrapper Facade for a 1-dimension SAFEARRAY. More...

#include <VariantVector.hpp>

List of all members.

Public Types

typedef T * iterator
typedef const T * const_iterator

Public Member Functions

 VariantVector ()
 Default constructor.
 VariantVector (size_t nSize, VARTYPE eVarType=VT_VARIANT)
 Construction of a fixed size array.
 VariantVector (SAFEARRAY *pSafeArray, VARTYPE eVarType=VT_VARIANT, bool bOwner=true)
 Take ownership of an existing SAFEARRAY.
 ~VariantVector ()
 Destructor.
size_t Size () const
 Get the size of the vector.
const T & operator[] (size_t index) const
 Access the element at the given index.
T & operator[] (size_t index)
 Access the element at the given index.
const_iterator begin () const
 Get an iterator to the start of the vector.
iterator begin ()
 Get an iterator to the start of the vector.
const_iterator end () const
 Get an iterator to one past the end of the vector.
iterator end ()
 Get an iterator to one past the end of the vector.
SAFEARRAY * Detach ()
 Take ownership of the SAFEARRAY.

Private Types

typedef Core::Scoped< SAFEARRAY * > SafeArrayPtr
 The RAII type used to manage the SAFEARRAY.

Private Member Functions

void Unlock ()
 Unlock the underlying storage.
void Release ()
 Release the underlying SAFEARRAY.

Static Private Member Functions

static void DestroySafeArray (SAFEARRAY *pSafeArray)
 Helper function for destroying a SAFEARRAY as a Scoped<SAFEARRAY*>.

Private Attributes

size_t m_nSize
 The size of the vector.
SAFEARRAY * m_pSafeArray
 The underlying SAFEARRAY.
bool m_bOwner
 Flag to signal ownership of the underlying SAFEARRAY.
T * m_pData
 The SAFEARRAY underlying storage.

Detailed Description

template<typename T>
class WCL::VariantVector< T >

A Wrapper Facade for a 1-dimension SAFEARRAY.


Member Typedef Documentation

template<typename T>
typedef T* WCL::VariantVector< T >::iterator
template<typename T>
typedef const T* WCL::VariantVector< T >::const_iterator
template<typename T>
typedef Core::Scoped<SAFEARRAY*> WCL::VariantVector< T >::SafeArrayPtr [private]

The RAII type used to manage the SAFEARRAY.


Constructor & Destructor Documentation

template<typename T >
WCL::VariantVector< T >::VariantVector ( ) [inline]

Default constructor.

template<typename T >
WCL::VariantVector< T >::VariantVector ( size_t  nSize,
VARTYPE  eVarType = VT_VARIANT 
) [inline, explicit]

Construction of a fixed size array.

template<typename T >
WCL::VariantVector< T >::VariantVector ( SAFEARRAY *  pSafeArray,
VARTYPE  eVarType = VT_VARIANT,
bool  bOwner = true 
) [inline, explicit]

Take ownership of an existing SAFEARRAY.

template<typename T >
WCL::VariantVector< T >::~VariantVector ( ) [inline]

Destructor.


Member Function Documentation

template<typename T >
size_t WCL::VariantVector< T >::Size ( ) const [inline]

Get the size of the vector.

template<typename T >
const T & WCL::VariantVector< T >::operator[] ( size_t  index) const [inline]

Access the element at the given index.

template<typename T >
T & WCL::VariantVector< T >::operator[] ( size_t  index) [inline]

Access the element at the given index.

template<typename T >
VariantVector< T >::const_iterator WCL::VariantVector< T >::begin ( ) const [inline]

Get an iterator to the start of the vector.

template<typename T >
VariantVector< T >::iterator WCL::VariantVector< T >::begin ( ) [inline]

Get an iterator to the start of the vector.

template<typename T >
VariantVector< T >::const_iterator WCL::VariantVector< T >::end ( ) const [inline]

Get an iterator to one past the end of the vector.

template<typename T >
VariantVector< T >::iterator WCL::VariantVector< T >::end ( ) [inline]

Get an iterator to one past the end of the vector.

template<typename T >
SAFEARRAY * WCL::VariantVector< T >::Detach ( ) [inline]

Take ownership of the SAFEARRAY.

template<typename T >
void WCL::VariantVector< T >::Unlock ( ) [inline, private]

Unlock the underlying storage.

template<typename T >
void WCL::VariantVector< T >::Release ( ) [inline, private]

Release the underlying SAFEARRAY.

This also unlocks the storage first if required.

template<typename T >
void WCL::VariantVector< T >::DestroySafeArray ( SAFEARRAY *  pSafeArray) [inline, static, private]

Helper function for destroying a SAFEARRAY as a Scoped<SAFEARRAY*>.


Member Data Documentation

template<typename T>
size_t WCL::VariantVector< T >::m_nSize [private]

The size of the vector.

template<typename T>
SAFEARRAY* WCL::VariantVector< T >::m_pSafeArray [private]

The underlying SAFEARRAY.

template<typename T>
bool WCL::VariantVector< T >::m_bOwner [private]

Flag to signal ownership of the underlying SAFEARRAY.

template<typename T>
T* WCL::VariantVector< T >::m_pData [private]

The SAFEARRAY underlying storage.


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