1 // Windows/PropVariant.h 2 3 #ifndef __WINDOWS_PROPVARIANT_H 4 #define __WINDOWS_PROPVARIANT_H 5 6 #include "../Common/MyWindows.h" 7 #include "../Common/Types.h" 8 9 namespace NWindows { 10 namespace NCOM { 11 12 class CPropVariant : public tagPROPVARIANT 13 { 14 public: CPropVariant()15 CPropVariant() { vt = VT_EMPTY; wReserved1 = 0; } ~CPropVariant()16 ~CPropVariant() { Clear(); } 17 CPropVariant(const PROPVARIANT &varSrc); 18 CPropVariant(const CPropVariant &varSrc); 19 CPropVariant(BSTR bstrSrc); 20 CPropVariant(LPCOLESTR lpszSrc); CPropVariant(bool bSrc)21 CPropVariant(bool bSrc) { vt = VT_BOOL; wReserved1 = 0; boolVal = (bSrc ? VARIANT_TRUE : VARIANT_FALSE); }; CPropVariant(Byte value)22 CPropVariant(Byte value) { vt = VT_UI1; wReserved1 = 0; bVal = value; } CPropVariant(Int16 value)23 CPropVariant(Int16 value) { vt = VT_I2; wReserved1 = 0; iVal = value; } CPropVariant(Int32 value)24 CPropVariant(Int32 value) { vt = VT_I4; wReserved1 = 0; lVal = value; } CPropVariant(UInt32 value)25 CPropVariant(UInt32 value) { vt = VT_UI4; wReserved1 = 0; ulVal = value; } CPropVariant(UInt64 value)26 CPropVariant(UInt64 value) { vt = VT_UI8; wReserved1 = 0; uhVal.QuadPart = value; } CPropVariant(const FILETIME & value)27 CPropVariant(const FILETIME &value) { vt = VT_FILETIME; wReserved1 = 0; filetime = value; } 28 29 CPropVariant& operator=(const CPropVariant &varSrc); 30 CPropVariant& operator=(const PROPVARIANT &varSrc); 31 CPropVariant& operator=(BSTR bstrSrc); 32 CPropVariant& operator=(LPCOLESTR lpszSrc); 33 CPropVariant& operator=(const char *s); 34 CPropVariant& operator=(bool bSrc); 35 CPropVariant& operator=(Byte value); 36 CPropVariant& operator=(Int16 value); 37 CPropVariant& operator=(Int32 value); 38 CPropVariant& operator=(UInt32 value); 39 CPropVariant& operator=(Int64 value); 40 CPropVariant& operator=(UInt64 value); 41 CPropVariant& operator=(const FILETIME &value); 42 43 HRESULT Clear(); 44 HRESULT Copy(const PROPVARIANT *pSrc); 45 HRESULT Attach(PROPVARIANT *pSrc); 46 HRESULT Detach(PROPVARIANT *pDest); 47 48 HRESULT InternalClear(); 49 void InternalCopy(const PROPVARIANT *pSrc); 50 51 int Compare(const CPropVariant &a1); 52 }; 53 54 }} 55 56 #endif 57