comparison foosdk/sdk/libPPUI/CPropVariant.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 class CPropVariant : public PROPVARIANT {
4 public:
5 CPropVariant() {init();}
6 ~CPropVariant() {clear();}
7 CPropVariant( const CPropVariant & other ) {
8 init();
9 PropVariantCopy( this, &other );
10 }
11 const CPropVariant& operator=( const CPropVariant & other ) {
12 clear();
13 PropVariantCopy(this, &other);
14 return *this;
15 }
16
17 bool toInt64(int64_t & out) const {
18 switch( vt ) {
19 case VT_I1: out = (int64_t) cVal; return true;
20 case VT_I2: out = (int64_t) iVal; return true;
21 case VT_I4: out = (int64_t) lVal; return true;
22 case VT_I8: out = (int64_t) hVal.QuadPart; return true;
23 case VT_INT: out = (int64_t) intVal; return true;
24 default: return false;
25 }
26 }
27 bool toUint64(uint64_t & out) const {
28 switch( vt ) {
29 case VT_UI1: out = (uint64_t) bVal; return true;
30 case VT_UI2: out = (uint64_t) uiVal; return true;
31 case VT_UI4: out = (uint64_t) ulVal; return true;
32 case VT_UI8: out = (uint64_t) uhVal.QuadPart; return true;
33 case VT_UINT: out = (uint64_t) uintVal; return true;
34 default: return false;
35 }
36 }
37 bool toString( pfc::string_base & out ) const {
38 switch( vt ) {
39 case VT_LPSTR:
40 out = pfc::stringcvt::string_utf8_from_ansi( pszVal ); return true;
41 case VT_LPWSTR:
42 out = pfc::stringcvt::string_utf8_from_wide( pwszVal ); return true;
43 default: return false;
44 }
45 }
46 private:
47 void clear() {
48 PropVariantClear( this );
49 }
50 void init() {
51 PROPVARIANT * pv = this;
52 PropVariantInit( pv );
53 }
54 };