Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
XComUtils.h
1// XComUtils.h: interface for the file related class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(CCOMUTILSINCLUDE_H)
6#define CCOMUTILSINCLUDE_H
7
8#ifdef _MSC_VER
9#pragma once
10#endif // _MSC_VER
11
12#include <atlbase.h>
13#include <shlwapi.h>
14
15BEGIN_MOOTOOLS_NAMESPACE
16
17template <class T>
19{
20protected:
21 T* p;
22
23public:
24 CXComPtr() throw()
25 {
26 p = NULL;
27 }
28
29 CXComPtr(T* lp) throw()
30 {
31 p = lp;
32 if (p != NULL)
33 p->AddRef();
34 }
35
36 ~CXComPtr() throw()
37 {
38 if (p)
39 p->Release();
40 }
41
42 T* operator->() const throw()
43 {
44 XASSERT(p!=NULL);
45 return p;
46 }
47
48 operator T*() const throw()
49 {
50 return p;
51 }
52
53 T& operator*() const
54 {
55 XASSERT(p != NULL);
56 return *p;
57 }
58
59 T** operator&() throw()
60 {
61 XASSERT(p==NULL);
62 return &p;
63 }
64
65 T* operator=(const CXComPtr<T>& lp) throw()
66 {
67 if (*this != lp)
68 {
69 if (p != NULL)
70 {
71 p->Release();
72 p = NULL;
73 }
74
75 if (lp.p != NULL)
76 {
77 p = lp.p;
78 p->AddRef();
79 }
80 }
81 return *this;
82 }
83
84 bool operator==(T* pT) const throw()
85 {
86 return p == pT;
87 }
88
89 // Compare two objects for equivalence
90 bool IsEqualObject(IUnknown* pOther) throw()
91 {
92 if (p == NULL && pOther == NULL)
93 return true; // They are both NULL objects
94
95 if (p == NULL || pOther == NULL)
96 return false; // One is NULL the other is not
97
100 p->QueryInterface(__uuidof(IUnknown), (void**)&punk1);
101 pOther->QueryInterface(__uuidof(IUnknown), (void**)&punk2);
102 return punk1 == punk2;
103 }
104
105};
106
107END_MOOTOOLS_NAMESPACE
108
109#endif // !defined(CCOMUTILSINCLUDE_H)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Definition XComUtils.h:19