PropVariant.h 1.9 KB

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