]> git.sur5r.net Git - bacula/bacula/commitdiff
Add ms_atl.h
authorKern Sibbald <kern@sibbald.com>
Sat, 22 Apr 2006 16:26:24 +0000 (16:26 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 22 Apr 2006 16:26:24 +0000 (16:26 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2958 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/win32/compat/ms_atl.h [new file with mode: 0644]

diff --git a/bacula/src/win32/compat/ms_atl.h b/bacula/src/win32/compat/ms_atl.h
new file mode 100644 (file)
index 0000000..2958979
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Minimal replacement for class CComPtr and CComBSTR
+ * Based on common public IUnknown interface only
+ */
+
+template <class T> class CComPtr
+{
+
+public:
+
+/* Attribute(s) ... */
+       T* p;
+
+/* Creation ... */
+       CComPtr()
+       {
+               p = NULL;
+       }
+       
+/* Destructor ... */
+       ~CComPtr()
+       {
+               if (p)
+                       p->Release();
+       }
+};
+
+class CComBSTR
+{
+
+public:
+
+       BSTR p;
+
+/* Creation ... */
+       CComBSTR()
+       {
+               p = NULL;
+       }
+
+/* Destructor ... */
+       ~CComBSTR()
+       {
+               ::SysFreeString(p);
+       }
+
+/* Address-of operator */
+       BSTR* operator&()
+       {
+               return &p;
+       }
+
+};