12 #if defined(_MSC_VER) && defined(__clang__)
13 # pragma clang diagnostic push
14 # pragma clang diagnostic ignored "-Wlanguage-extension-token"
40 #ifndef __WRL_CLASSIC_COM__
41 operator IInspectable**()
const throw()
43 static_assert(__is_base_of(IInspectable,
InterfaceType),
"Invalid cast");
44 return reinterpret_cast<IInspectable**
>(
ptr_->ReleaseAndGetAddressOf());
48 operator IUnknown**()
const throw()
50 static_assert(__is_base_of(IUnknown,
InterfaceType),
"Invalid cast");
51 return reinterpret_cast<IUnknown**
>(
ptr_->ReleaseAndGetAddressOf());
64 operator void**()
const throw()
134 if (
this !=
reinterpret_cast<ComPtr*
>(&
reinterpret_cast<unsigned char&
>(other)))
140 :
ptr_(other.Detach())
165 template <
typename U>
179 if (
ptr_ != other.ptr_)
180 ComPtr(other).Swap(*
this);
187 ComPtr(other).Swap(*
this);
193 ComPtr(other).Swap(*
this);
200 ComPtr(other).Swap(*
this);
288 HRESULT
CopyTo(REFIID riid,
void** ptr)
const throw()
290 return ptr_->QueryInterface(riid, ptr);
293 template <
typename U>
296 return ptr_->QueryInterface(__uuidof(U),
reinterpret_cast<void**
>(ptr));
299 template <
typename U>
302 return ptr_->QueryInterface(__uuidof(U), p);
305 template <
typename U>
308 return ptr_->QueryInterface(__uuidof(U),
reinterpret_cast<void**
>(p->ReleaseAndGetAddressOf()));
313 return ptr_->QueryInterface(riid,
reinterpret_cast<void**
>(p->ReleaseAndGetAddressOf()));
337 return tmp->Release();
343 template <
typename T>
346 static_assert(__is_base_of(IUnknown,
typename T::InterfaceType),
"Expected COM interface");
354 template <
typename T>
360 template <
typename T>
363 return RoGetActivationFactory(classid, IID_INS_ARGS(factory.ReleaseAndGetAddressOf()));
374 template <
typename T>
380 template <
typename T>
384 return RoGetActivationFactory(classid, IID_INS_ARGS(factory.ReleaseAndGetAddressOf()));
390 #if defined(_MSC_VER) && defined(__clang__)
391 # pragma clang diagnostic pop
ComPtr & operator=(U *other)
Definition: client.h:166
ComPtr & operator=(InterfaceType *other)
Definition: client.h:154
ComPtr()
Definition: client.h:104
ComPtr(ComPtr &&other)
Definition: client.h:131
HRESULT As(ComPtr< U > *p) const
Definition: client.h:306
~ComPtr()
Definition: client.h:143
ComPtr & operator=(const ComPtr< U > &other)
Definition: client.h:185
HRESULT As(Details::ComPtrRef< ComPtr< U >> p) const
Definition: client.h:300
unsigned long InternalRelease()
Definition: client.h:331
ComPtr(ComPtr< U > &&other)
Definition: client.h:139
ComPtr(decltype(nullptr))
Definition: client.h:107
ComPtr & operator=(decltype(nullptr))
Definition: client.h:148
ComPtr(U *other)
Definition: client.h:112
Details::ComPtrRef< ComPtr< T > > operator&()
Definition: client.h:233
void Swap(ComPtr &r)
Definition: client.h:211
HRESULT CopyTo(REFIID riid, void **ptr) const
Definition: client.h:288
InterfaceType ** GetAddressOf()
Definition: client.h:248
InterfaceType * Detach()
Definition: client.h:259
const Details::ComPtrRef< const ComPtr< T > > operator&() const
Definition: client.h:238
HRESULT CopyTo(InterfaceType **ptr) const
Definition: client.h:281
void Attach(InterfaceType *other)
Definition: client.h:266
void InternalAddRef() const
Definition: client.h:325
ComPtr(const ComPtr &other)
Definition: client.h:118
InterfaceType *const * GetAddressOf() const
Definition: client.h:243
HRESULT AsIID(REFIID riid, ComPtr< IUnknown > *p) const
Definition: client.h:311
InterfaceType ** ReleaseAndGetAddressOf()
Definition: client.h:253
unsigned long Reset()
Definition: client.h:276
ComPtr & operator=(const ComPtr &other)
Definition: client.h:177
HRESULT CopyTo(U **ptr) const
Definition: client.h:294
ComPtr & operator=(ComPtr< U > &&other)
Definition: client.h:198
T InterfaceType
Definition: client.h:102
InterfaceType * operator->() const
Definition: client.h:228
InterfaceType * ptr_
Definition: client.h:323
InterfaceType * Get() const
Definition: client.h:223
ComPtr(const ComPtr< U > &other)
Definition: client.h:125
void Swap(ComPtr &&r)
Definition: client.h:204
ComPtr & operator=(ComPtr &&other)
Definition: client.h:191
T * ptr_
Definition: client.h:35
T::InterfaceType InterfaceType
Definition: client.h:38
ComPtrRef(T *ptr)
Definition: client.h:59
ComPtrRefBase< T >::InterfaceType *const * GetAddressOf() const
Definition: client.h:85
ComPtrRefBase< T >::InterfaceType * operator*()
Definition: client.h:80
ComPtrRefBase< T >::InterfaceType ** ReleaseAndGetAddressOf()
Definition: client.h:90
void ** IID_PPV_ARGS_Helper(::Microsoft::WRL::Details::ComPtrRef< T > pp)
Definition: client.h:344
HRESULT GetActivationFactory(HSTRING classid, ::Microsoft::WRL::Details::ComPtrRef< T > factory)
Definition: client.h:382
HRESULT ActivateInstance(HSTRING classid, ::Microsoft::WRL::Details::ComPtrRef< T > instance)
Definition: client.h:375
int BoolStruct::* BoolType
Definition: internal.h:47
This file has no copyright assigned and is placed in the Public Domain.
Definition: client.h:26
HRESULT GetActivationFactory(HSTRING classid, ::Microsoft::WRL::Details::ComPtrRef< T > factory)
Definition: client.h:361
HRESULT ActivateInstance(HSTRING classid, ::Microsoft::WRL::Details::ComPtrRef< T > instance)
Definition: client.h:355
int Member
Definition: internal.h:44