This commit is contained in:
Igor Pavlov
2014-11-23 00:00:00 +00:00
committed by Kornel Lesiński
parent 83f8ddcc5b
commit f08f4dcc3c
1158 changed files with 76451 additions and 35082 deletions

93
CPP/Windows/PropVariant.h Executable file → Normal file
View File

@@ -1,29 +1,73 @@
// Windows/PropVariant.h
#ifndef __WINDOWS_PROPVARIANT_H
#define __WINDOWS_PROPVARIANT_H
#ifndef __WINDOWS_PROP_VARIANT_H
#define __WINDOWS_PROP_VARIANT_H
#include "../Common/MyTypes.h"
#include "../Common/MyWindows.h"
#include "../Common/Types.h"
namespace NWindows {
namespace NCOM {
HRESULT PropVariant_Clear(PROPVARIANT *p) throw();
HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars) throw();
HRESULT PropVarEm_Set_Str(PROPVARIANT *p, const char *s) throw();
inline void PropVarEm_Set_UInt32(PROPVARIANT *p, UInt32 v) throw()
{
p->vt = VT_UI4;
p->ulVal = v;
}
inline void PropVarEm_Set_UInt64(PROPVARIANT *p, UInt64 v) throw()
{
p->vt = VT_UI8;
p->uhVal.QuadPart = v;
}
inline void PropVarEm_Set_FileTime64(PROPVARIANT *p, UInt64 v) throw()
{
p->vt = VT_FILETIME;
p->filetime.dwLowDateTime = (DWORD)v;
p->filetime.dwHighDateTime = (DWORD)(v >> 32);
}
inline void PropVarEm_Set_Bool(PROPVARIANT *p, bool b) throw()
{
p->vt = VT_BOOL;
p->boolVal = (b ? VARIANT_TRUE : VARIANT_FALSE);
}
class CPropVariant : public tagPROPVARIANT
{
public:
CPropVariant() { vt = VT_EMPTY; wReserved1 = 0; }
~CPropVariant() { Clear(); }
CPropVariant()
{
vt = VT_EMPTY;
wReserved1 = 0;
// wReserved2 = 0;
// wReserved3 = 0;
// uhVal.QuadPart = 0;
bstrVal = 0;
}
~CPropVariant() throw() { Clear(); }
CPropVariant(const PROPVARIANT &varSrc);
CPropVariant(const CPropVariant &varSrc);
CPropVariant(BSTR bstrSrc);
CPropVariant(LPCOLESTR lpszSrc);
CPropVariant(bool bSrc) { vt = VT_BOOL; wReserved1 = 0; boolVal = (bSrc ? VARIANT_TRUE : VARIANT_FALSE); };
CPropVariant(Byte value) { vt = VT_UI1; wReserved1 = 0; bVal = value; }
CPropVariant(Int16 value) { vt = VT_I2; wReserved1 = 0; iVal = value; }
CPropVariant(Int32 value) { vt = VT_I4; wReserved1 = 0; lVal = value; }
private:
CPropVariant(Int16 value); // { vt = VT_I2; wReserved1 = 0; iVal = value; }
CPropVariant(Int32 value); // { vt = VT_I4; wReserved1 = 0; lVal = value; }
public:
CPropVariant(UInt32 value) { vt = VT_UI4; wReserved1 = 0; ulVal = value; }
CPropVariant(UInt64 value) { vt = VT_UI8; wReserved1 = 0; uhVal.QuadPart = value; }
CPropVariant(Int64 value) { vt = VT_I8; wReserved1 = 0; hVal.QuadPart = value; }
CPropVariant(const FILETIME &value) { vt = VT_FILETIME; wReserved1 = 0; filetime = value; }
CPropVariant& operator=(const CPropVariant &varSrc);
@@ -31,24 +75,31 @@ public:
CPropVariant& operator=(BSTR bstrSrc);
CPropVariant& operator=(LPCOLESTR lpszSrc);
CPropVariant& operator=(const char *s);
CPropVariant& operator=(bool bSrc);
CPropVariant& operator=(Byte value);
CPropVariant& operator=(Int16 value);
CPropVariant& operator=(Int32 value);
CPropVariant& operator=(UInt32 value);
CPropVariant& operator=(Int64 value);
CPropVariant& operator=(UInt64 value);
CPropVariant& operator=(const FILETIME &value);
CPropVariant& operator=(bool bSrc) throw();
CPropVariant& operator=(Byte value) throw();
private:
CPropVariant& operator=(Int16 value) throw();
HRESULT Clear();
HRESULT Copy(const PROPVARIANT *pSrc);
HRESULT Attach(PROPVARIANT *pSrc);
HRESULT Detach(PROPVARIANT *pDest);
public:
CPropVariant& operator=(Int32 value) throw();
CPropVariant& operator=(UInt32 value) throw();
CPropVariant& operator=(UInt64 value) throw();
CPropVariant& operator=(Int64 value) throw();
CPropVariant& operator=(const FILETIME &value) throw();
HRESULT InternalClear();
BSTR AllocBstr(unsigned numChars);
HRESULT Clear() throw();
HRESULT Copy(const PROPVARIANT *pSrc) throw();
HRESULT Attach(PROPVARIANT *pSrc) throw();
HRESULT Detach(PROPVARIANT *pDest) throw();
HRESULT InternalClear() throw();
void InternalCopy(const PROPVARIANT *pSrc);
int Compare(const CPropVariant &a1);
int Compare(const CPropVariant &a) throw();
};
}}