]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/compat/ms_atl.h
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / compat / ms_atl.h
1 /*
2  * Minimal replacement for class CComPtr and CComBSTR
3  * Based on common public IUnknown interface only
4  */
5
6 template <class T> class CComPtr
7 {
8
9 public:
10
11 /* Attribute(s) ... */
12         T* p;
13
14 /* Creation ... */
15         CComPtr()
16         {
17            p = NULL;
18         }
19
20 /* Destructor ... */
21         ~CComPtr()
22         {
23            if (p)
24               p->Release();
25         }
26 };
27
28 class CComBSTR
29 {
30
31 public:
32
33         BSTR p;
34
35 /* Creation ... */
36         CComBSTR()
37         {
38            p = NULL;
39         }
40
41 /* Destructor ... */
42         ~CComBSTR()
43         {
44              ::SysFreeString(p);
45         }
46
47 /* Address-of operator */
48         BSTR* operator&()
49         {
50            return &p;
51         }
52
53 };