STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Property Helpers
[ATLSTL]

This set of get_/put_ accessor template functions simplify the writing of COM object accessor methods. More...

Functions

template<typename C, typename T> HRESULT get_MemberValue (C *const cls, T *ret, T C::*mem)
 Inline retrieval of member variable value.

template<typename C, class T> HRESULT get_MemberValue (C *const cls, T **ret, T *C::*mem)
 Ghost overload to prevent use of get_MemberValue with pointer types.

template<typename C> HRESULT get_MemberValue (C *const cls, BSTR *ret, CComBSTR C::*mem)
 Inline retrieval of a CComBSTR member variable value.

template<typename C> HRESULT get_MemberValue (C *const cls, VARIANT *ret, CComVariant C::*mem)
 Inline retrieval of a VARIANT member variable value.

template<typename C, typename T> HRESULT put_MemberValue (C *const cls, T const &newVal, T C::*mem)
 Inline assignment of a member variable value.

template<typename C> HRESULT put_MemberValue (C *const cls, BSTR newVal, CComBSTR C::*mem)
 Inline assignment of a CComBSTR member variable value.

template<typename C> HRESULT put_MemberValue (C *const cls, CComBSTR const &newVal, CComBSTR C::*mem)
 Inline assignment of a CComBSTR member variable value.

template<typename C> HRESULT put_MemberValue (C *const cls, CComVariant const &newVal, CComVariant C::*mem)
 Inline assignment of a CComVariant member variable value.


Detailed Description

This set of get_/put_ accessor template functions simplify the writing of COM object accessor methods.


Function Documentation

HRESULT get_MemberValue C *const    cls,
VARIANT *    ret,
CComVariant C::*    mem
[inline]
 

Inline retrieval of a VARIANT member variable value.

This function takes a pointer to a class, a pointer to a return value and a pointer to a VARIANT member of the given class, and retrieves the value of the member into the VARIANT return value.

Parameters:
cls  Pointer to the class instance
ret  Pointer to the VARIANT return value
mem  Pointer to the VARIANT member variable
Returns:
An HRESULT code indicating whether the access succeeded or failed
Return values:
E_POINTER  ret was a null pointer
DISP_E_ARRAYISLOCKED  The variant contains an array that is locked.
DISP_E_BADVARTYPE  The source and destination have an invalid variant type (usually uninitialized).
E_OUTOFMEMORY  Memory could not be allocated for the copy.
E_INVALIDARG  One of the arguments is invalid.
S_OK  The value was retrieved successfully

HRESULT get_MemberValue C *const    cls,
BSTR *    ret,
CComBSTR C::*    mem
[inline]
 

Inline retrieval of a CComBSTR member variable value.

This function takes a pointer to a class, a pointer to a return value and a pointer to a CComBSTR member of the given class, and retrieves the value of the member into the BSTR return value.

Parameters:
cls  Pointer to the class instance
ret  Pointer to the BSTR return value
mem  Pointer to the CComBSTR member variable
Returns:
An HRESULT code indicating whether the access succeeded or failed
Return values:
E_POINTER  ret was a null pointer
E_OUTOFMEMORY  Not enough memory to create a copy for the returned value
S_OK  The value was retrieved successfully

HRESULT get_MemberValue C *const    cls,
T **    ret,
T *C::*    mem
[inline]
 

Ghost overload to prevent use of get_MemberValue with pointer types.

This version is overloaded to deal with pointer types, and is not implemented so as to prevent the generic version being used with such types.

Although this is inconvenient, there is no other way to prevent the use of free functions. In such circumstances, the shorthand of get_memberValue() must be eschewed for full and congnisant implementation.

Note:
This is deemed worth the inconvenience since using the generic version would like lead to code that violated COM's memory rules

HRESULT get_MemberValue C *const    cls,
T *    ret,
T C::*    mem
[inline]
 

Inline retrieval of member variable value.

This function takes a pointer to a class, a pointer to a return value and a pointer to member of the given class, and retrieves the value of the member into the return value.

Note:
This generic version should only be used for built-in types, or those which have value semantics.
Parameters:
cls  Pointer to the class instance
ret  Pointer to the return value
mem  Pointer to the member variable
Returns:
An HRESULT code indicating whether the access succeeded or failed
Return values:
E_POINTER  ret was a null pointer
S_OK  The value was retrieved successfully

HRESULT put_MemberValue C *const    cls,
CComVariant const &    newVal,
CComVariant C::*    mem
[inline]
 

Inline assignment of a CComVariant member variable value.

This function takes a pointer to a class, a new CComVariant value and a pointer to CComVariant member of the given class, and assigns the new value to the member.

Parameters:
cls  Pointer to the class instance
newVal  The new CComVariant value
mem  Pointer to the CComVariant member variable
Return values:
S_OK  The value was assigned successfully

HRESULT put_MemberValue C *const    cls,
CComBSTR const &    newVal,
CComBSTR C::*    mem
[inline]
 

Inline assignment of a CComBSTR member variable value.

This function takes a pointer to a class, a new CComBSTR value and a pointer to CComBSTR member of the given class, and assigns the new value to the member.

Parameters:
cls  Pointer to the class instance
newVal  The new CComBSTR value
mem  Pointer to the CComBSTR member variable
Return values:
S_OK  The value was assigned successfully

HRESULT put_MemberValue C *const    cls,
BSTR    newVal,
CComBSTR C::*    mem
[inline]
 

Inline assignment of a CComBSTR member variable value.

This function takes a pointer to a class, a new BSTR value and a pointer to CComBSTR member of the given class, and assigns the new value to the member.

Parameters:
cls  Pointer to the class instance
newVal  The new BSTR value
mem  Pointer to the CComBSTR member variable
Return values:
S_OK  The value was assigned successfully

HRESULT put_MemberValue C *const    cls,
T const &    newVal,
T C::*    mem
[inline]
 

Inline assignment of a member variable value.

This function takes a pointer to a class, a new value and a pointer to member of the given class, and assigns the new value to the member.

Note:
This generic version should only be used for built-in types, or those which have value semantics.
Parameters:
cls  Pointer to the class instance
newVal  The new value
mem  Pointer to the member variable
Return values:
S_OK  The value was assigned successfully

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004