aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/PropVariant.h
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Windows/PropVariant.h')
-rw-r--r--CPP/Windows/PropVariant.h52
1 files changed, 49 insertions, 3 deletions
diff --git a/CPP/Windows/PropVariant.h b/CPP/Windows/PropVariant.h
index 108bf6b..171402f 100644
--- a/CPP/Windows/PropVariant.h
+++ b/CPP/Windows/PropVariant.h
@@ -29,11 +29,14 @@ inline void PropVarEm_Set_UInt64(PROPVARIANT *p, UInt64 v) throw()
29 p->uhVal.QuadPart = v; 29 p->uhVal.QuadPart = v;
30} 30}
31 31
32inline void PropVarEm_Set_FileTime64(PROPVARIANT *p, UInt64 v) throw() 32inline void PropVarEm_Set_FileTime64_Prec(PROPVARIANT *p, UInt64 v, unsigned prec) throw()
33{ 33{
34 p->vt = VT_FILETIME; 34 p->vt = VT_FILETIME;
35 p->filetime.dwLowDateTime = (DWORD)v; 35 p->filetime.dwLowDateTime = (DWORD)v;
36 p->filetime.dwHighDateTime = (DWORD)(v >> 32); 36 p->filetime.dwHighDateTime = (DWORD)(v >> 32);
37 p->wReserved1 = (WORD)prec;
38 p->wReserved2 = 0;
39 p->wReserved3 = 0;
37} 40}
38 41
39inline void PropVarEm_Set_Bool(PROPVARIANT *p, bool b) throw() 42inline void PropVarEm_Set_Bool(PROPVARIANT *p, bool b) throw()
@@ -63,7 +66,51 @@ public:
63 // uhVal.QuadPart = 0; 66 // uhVal.QuadPart = 0;
64 bstrVal = 0; 67 bstrVal = 0;
65 } 68 }
66 ~CPropVariant() throw() { Clear(); } 69
70
71 void Set_FtPrec(unsigned prec)
72 {
73 wReserved1 = (WORD)prec;
74 wReserved2 = 0;
75 wReserved3 = 0;
76 }
77
78 void SetAsTimeFrom_FT_Prec(const FILETIME &ft, unsigned prec)
79 {
80 operator=(ft);
81 Set_FtPrec(prec);
82 }
83
84 void SetAsTimeFrom_Ft64_Prec(UInt64 v, unsigned prec)
85 {
86 FILETIME ft;
87 ft.dwLowDateTime = (DWORD)(UInt32)v;
88 ft.dwHighDateTime = (DWORD)(UInt32)(v >> 32);
89 operator=(ft);
90 Set_FtPrec(prec);
91 }
92
93 void SetAsTimeFrom_FT_Prec_Ns100(const FILETIME &ft, unsigned prec, unsigned ns100)
94 {
95 operator=(ft);
96 wReserved1 = (WORD)prec;
97 wReserved2 = (WORD)ns100;
98 wReserved3 = 0;
99 }
100
101 unsigned Get_Ns100() const
102 {
103 const unsigned prec = wReserved1;
104 const unsigned ns100 = wReserved2;
105 if (prec == 0
106 && prec <= k_PropVar_TimePrec_1ns
107 && ns100 < 100
108 && wReserved3 == 0)
109 return ns100;
110 return 0;
111 }
112
113 ~CPropVariant();
67 CPropVariant(const PROPVARIANT &varSrc); 114 CPropVariant(const PROPVARIANT &varSrc);
68 CPropVariant(const CPropVariant &varSrc); 115 CPropVariant(const CPropVariant &varSrc);
69 CPropVariant(BSTR bstrSrc); 116 CPropVariant(BSTR bstrSrc);
@@ -118,7 +165,6 @@ public:
118 165
119 HRESULT InternalClear() throw(); 166 HRESULT InternalClear() throw();
120 void InternalCopy(const PROPVARIANT *pSrc); 167 void InternalCopy(const PROPVARIANT *pSrc);
121
122 int Compare(const CPropVariant &a) throw(); 168 int Compare(const CPropVariant &a) throw();
123}; 169};
124 170