From: Kern Sibbald Date: Sat, 22 Apr 2006 16:26:24 +0000 (+0000) Subject: Add ms_atl.h X-Git-Tag: Release-2.0.0~922 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=40c6f07a5e3f46ec138be6ac2df32f59f92ac0c3;p=bacula%2Fbacula Add ms_atl.h git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2958 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/win32/compat/ms_atl.h b/bacula/src/win32/compat/ms_atl.h new file mode 100644 index 0000000000..29589798a5 --- /dev/null +++ b/bacula/src/win32/compat/ms_atl.h @@ -0,0 +1,53 @@ +/* + * Minimal replacement for class CComPtr and CComBSTR + * Based on common public IUnknown interface only + */ + +template 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; + } + +};