Make WvStreams compile with gcc 4.4.
[wvstreams.git] / win32 / cominclude / comdef.h
blobfcaf1c2a91066cefb9db16e5a6cadc43adc992c1
1 #ifndef __COMDEF_H
2 #define __COMDEF_H
4 //#warning "Using hideously broken fake comdef.h"
6 class WvComSmartBase
8 public:
9 void *p;
13 // FIXME: completely untested and random
14 template <typename I>
15 class WvComSmart : public WvComSmartBase
17 public:
18 WvComSmart(IUnknown *ptr = 0, bool addref = false)
20 p = ptr;
23 WvComSmart(const WvComSmartBase &b)
25 p = b.p;
28 bool operator== (const void *b) const
30 return p == b;
33 bool operator!= (const void *b) const
35 return p != b;
38 I *operator-> ()
40 return (I *)p;
43 operator I* ()
45 return (I *)p;
48 I **operator& ()
50 return (I **)&p;
54 #define _COM_SMARTPTR_TYPEDEF(x, y) typedef WvComSmart<x> x##Ptr;
56 // FIXME
57 extern CLSID xblah;
58 _COM_SMARTPTR_TYPEDEF(IUnknown, xblah);
59 _COM_SMARTPTR_TYPEDEF(IDispatch, xblah);
61 class _com_error
63 public:
64 const char *ErrorMessage();
67 #define __uuidof(x) (xblah)
69 #endif // _COMDEF_H