00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00050 #ifndef ATLSTL_INCL_ATLSTL_AUTOMATION_HPP_PROPERTY_METHOD_HELPERS
00051 #define ATLSTL_INCL_ATLSTL_AUTOMATION_HPP_PROPERTY_METHOD_HELPERS
00052
00053 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00054 # define ATLSTL_VER_ATLSTL_AUTOMATION_HPP_PROPERTY_METHOD_HELPERS_MAJOR 4
00055 # define ATLSTL_VER_ATLSTL_AUTOMATION_HPP_PROPERTY_METHOD_HELPERS_MINOR 0
00056 # define ATLSTL_VER_ATLSTL_AUTOMATION_HPP_PROPERTY_METHOD_HELPERS_REVISION 3
00057 # define ATLSTL_VER_ATLSTL_AUTOMATION_HPP_PROPERTY_METHOD_HELPERS_EDIT 69
00058 #endif
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 #ifndef ATLSTL_INCL_ATLSTL_HPP_ATLSTL
00076 # include <atlstl/atlstl.hpp>
00077 #endif
00078
00079 #if defined(STLSOFT_COMPILER_IS_BORLAND)
00080 # error No recognised Borland compiler generates correct code when used with these functions
00081 #endif
00082
00083
00084
00085
00086
00087 #ifndef _ATLSTL_NO_NAMESPACE
00088 # if defined(_STLSOFT_NO_NAMESPACE) || \
00089 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00090
00091 namespace atlstl
00092 {
00093 # else
00094
00095
00096 namespace stlsoft
00097 {
00098
00099 namespace atlstl_project
00100 {
00101
00102 # endif
00103 #endif
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00134 template <class C, ss_typename_param_k T>
00135 inline HRESULT get_MemberValue(C *const cls, T *ret, T C::*mem)
00136 {
00137 return (ret == 0) ? E_POINTER : (*ret = cls->*mem, S_OK);
00138 }
00139
00154 template <class C, ss_typename_param_k T>
00155 inline HRESULT get_MemberValue(C *const cls, T **ret, T *C::*mem);
00156
00173 template <class C>
00174 inline HRESULT get_MemberValue(C *const cls, BSTR *ret, CComBSTR C::*mem)
00175 {
00176 return (ret == 0) ? E_POINTER : (*ret = (cls->*mem).Copy(), (*ret != 0 ? S_OK : E_OUTOFMEMORY));
00177 }
00178
00198 template <class C>
00199 inline HRESULT get_MemberValue(C *const cls, VARIANT *ret, CComVariant C::*mem)
00200 {
00201 return (ret == 0) ? E_POINTER : ::VariantCopy(ret, &(cls->*mem));
00202 }
00203
00204
00205
00223 template<class C, ss_typename_param_k T, ss_typename_param_k T2>
00224 inline HRESULT get_MemberValue(C *const cls, T *ret, T2 (C::*pfn)() const)
00225 {
00226 return (ret == 0) ? E_POINTER : (*ret = (cls->*pfn)(), S_OK);
00227 }
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00255 template <ss_typename_param_k C, ss_typename_param_k T>
00256 inline HRESULT put_MemberValue(C *const cls, T const& newVal, T C::*mem)
00257 {
00258 return (cls->*mem = newVal, S_OK);
00259 }
00260
00274 template <ss_typename_param_k C>
00275 inline HRESULT put_MemberValue(C *const cls, BSTR newVal, CComBSTR C::*mem)
00276 {
00277 return (cls->*mem = newVal, S_OK);
00278 }
00279
00293 template <ss_typename_param_k C>
00294 inline HRESULT put_MemberValue(C *const cls, CComBSTR const& newVal, CComBSTR C::*mem)
00295 {
00296 return put_MemberValue(cls, (BSTR)newVal, mem);
00297 }
00298
00312 template <ss_typename_param_k C>
00313 inline HRESULT put_MemberValue(C *const cls, CComVariant const& newVal, CComVariant C::*mem)
00314 {
00315 return (cls->*mem = newVal, (VT_ERROR == (cls->*mem).vt) ? (cls->*mem).scode : S_OK);
00316 }
00317
00318
00319
00320
00321
00322
00323
00344 template <ss_typename_type_k T1, ss_typename_type_k T2>
00345 inline HRESULT get_ConstantValue(T1 *ret, T2 const& value)
00346 {
00347 return (NULL == ret) ? E_POINTER : (*ret = value, S_OK);
00348 }
00349
00351
00352
00353 #ifdef STLSOFT_UNITTEST
00354 # include "./unittest/property_method_helpers_unittest_.h"
00355 #endif
00356
00357
00358
00359 #ifndef _ATLSTL_NO_NAMESPACE
00360 # if defined(_STLSOFT_NO_NAMESPACE) || \
00361 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00362 }
00363 # else
00364 }
00365 }
00366 # endif
00367 #endif
00368
00369
00370
00371 #endif
00372
00373