31 #include "../api_core.h"
36 template <
typename Type>
42 explicit ComPtr(Type *ptr) : ptr(ptr) { }
43 ComPtr(
const ComPtr ©) : ptr(copy.ptr) {
if (ptr) ptr->AddRef(); }
57 template<
typename That>
59 : ptr(static_cast<Type*>(that.ptr))
65 bool operator ==(
const ComPtr &other)
const {
return ptr == other.
ptr; }
66 bool operator !=(
const ComPtr &other)
const {
return ptr != other.
ptr; }
67 bool operator <(
const ComPtr &other)
const {
return ptr < other.
ptr; }
68 bool operator <=(
const ComPtr &other)
const {
return ptr <= other.
ptr; }
69 bool operator >(
const ComPtr &other)
const {
return ptr > other.
ptr; }
70 bool operator >=(
const ComPtr &other)
const {
return ptr >= other.
ptr; }
74 Type *
const operator ->()
const {
return const_cast<Type*
>(ptr); }
75 Type *operator ->() {
return ptr; }
76 operator Type *()
const {
return const_cast<Type*
>(ptr); }
77 operator bool()
const {
return ptr != 0; }
80 void clear() {
if (ptr) ptr->Release(); ptr = 0; }
81 Type *
get()
const {
return const_cast<Type*
>(ptr); }
ComPtr(const ComPtr< That > &that)
Definition: comptr.h:58
Type ** output_variable()
Definition: comptr.h:82
ComPtr.
Definition: comptr.h:38
ComPtr()
Definition: comptr.h:41
ComPtr(const ComPtr ©)
Definition: comptr.h:43
bool is_null() const
Definition: comptr.h:79
~ComPtr()
Definition: comptr.h:44
ComPtr(Type *ptr)
Definition: comptr.h:42
void clear()
Definition: comptr.h:80
Type * ptr
Definition: comptr.h:84