123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #ifndef __WIN_NANOAFX_HPP__
- #define __WIN_NANOAFX_HPP__
- #define _T(n) L##n
- class CComBSTR : public _bstr_t
- {
- public:
- inline CComBSTR(const wchar_t *str) : _bstr_t(str)
- {
- }
- inline CComBSTR(const char *str) : _bstr_t(str)
- {
- }
- };
- class CComVariant : public tagVARIANT
- {
- };
- template<class T>
- class CComPtr
- {
- private:
- T *_ptr;
- public:
- inline CComPtr()
- {
- _ptr = NULL;
- }
- inline CComPtr(T *ptr)
- {
- if(ptr)
- {
- ptr->AddRef();
- _ptr = ptr;
- }
- }
- inline ~CComPtr()
- {
- if(_ptr)
- _ptr->Release();
- _ptr = NULL;
- }
-
- inline CComPtr &operator = (T *ptr)
- {
- if(ptr)
- {
- ptr->AddRef();
- _ptr = ptr;
- }
- }
- inline bool operator == (T *ptr)
- {
- return _ptr == ptr;
- }
- inline T *operator -> ()
- {
- return _ptr;
- }
-
- inline T **operator & ()
- {
- return &_ptr;
- }
- inline operator T *()
- {
- return _ptr;
- }
- };
- #endif
|