Mobile API Reference  MicroStrategy 2019
Msi_variant.h
Go to the documentation of this file.
1 // File: variant.h
2 // Date: 15/08/2001
3 // Author: Yuling Ma
4 //
5 // Copyright (C) 2001 MicroStrategy Incorporated
6 // All rights reserved
7 
8 // This header file is for defining the VARIANT related structures, symbols and functions.
9 // On NT platform, the these structures, symbols and functions are defined in the following
10 // header files: oaidl.h, oleauto.h, wtypes.h
11 
12 
13 
14 #if !defined( _VARIANT_H_ )
15 #define _VARIANT_H_
16 
17 //#include "oaidl.h"
18 #include "MsiCOM/MsiCOM/MsiCOM.h"
19 #include "PDCHeader/PDCwtypes.h"
20 #include "MsiCOM/MsiCOM/Msi_bstr.h"
21 #ifndef FARSTRUCT
22 #define FARSTRUCT
23 #endif // FARSTRUCT
24 
25 #ifdef __ANDROID__
26 class IUnknown ;
27 class IDispatch ;
28 struct tagSAFEARRAY;
29 typedef tagSAFEARRAY SAFEARRAY;
30 #endif
31 
32 typedef unsigned short VARTYPE;
33 /*
34  * VARENUM usage key,
35  *
36  * * [V] - may appear in a VARIANT
37  * * [T] - may appear in a TYPEDESC
38  * * [P] - may appear in an OLE property set
39  * * [S] - may appear in a Safe Array
40  *
41  *
42  * VT_EMPTY [V] [P] nothing
43  * VT_NULL [V] [P] SQL style Null
44  * VT_I2 [V][T][P][S] 2 byte signed int
45  * VT_I4 [V][T][P][S] 4 byte signed int
46  * VT_R4 [V][T][P][S] 4 byte real
47  * VT_R8 [V][T][P][S] 8 byte real
48  * VT_CY [V][T][P][S] currency
49  * VT_DATE [V][T][P][S] date
50  * VT_BSTR [V][T][P][S] OLE Automation string
51  * VT_DISPATCH [V][T][P][S] IDispatch *
52  * VT_ERROR [V][T][P][S] SCODE
53  * VT_BOOL [V][T][P][S] True=-1, False=0
54  * VT_VARIANT [V][T][P][S] VARIANT *
55  * VT_UNKNOWN [V][T] [S] IUnknown *
56  * VT_DECIMAL [V][T] [S] 16 byte fixed point
57  * VT_RECORD [V] [P][S] user defined type
58  * VT_I1 [V][T][P][s] signed char
59  * VT_UI1 [V][T][P][S] unsigned char
60  * VT_UI2 [V][T][P][S] unsigned short
61  * VT_UI4 [V][T][P][S] unsigned short
62  * VT_I8 [T][P] signed 64-bit int
63  * VT_UI8 [T][P] unsigned 64-bit int
64  * VT_INT [V][T][P][S] signed machine int
65  * VT_UINT [V][T] [S] unsigned machine int
66  * VT_VOID [T] C style void
67  * VT_HRESULT [T] Standard return type
68  * VT_PTR [T] pointer type
69  * VT_SAFEARRAY [T] (use VT_ARRAY in VARIANT)
70  * VT_CARRAY [T] C style array
71  * VT_USERDEFINED [T] user defined type
72  * VT_LPSTR [T][P] null terminated string
73  * VT_LPWSTR [T][P] wide null terminated string
74  * VT_FILETIME [P] FILETIME
75  * VT_BLOB [P] Length prefixed bytes
76  * VT_STREAM [P] Name of the stream follows
77  * VT_STORAGE [P] Name of the storage follows
78  * VT_STREAMED_OBJECT [P] Stream contains an object
79  * VT_STORED_OBJECT [P] Storage contains an object
80  * VT_BLOB_OBJECT [P] Blob contains an object
81  * VT_CF [P] Clipboard format
82  * VT_CLSID [P] A Class ID
83  * VT_VECTOR [P] simple counted array
84  * VT_ARRAY [V] SAFEARRAY*
85  * VT_BYREF [V] void* for local use
86  * VT_BSTR_BLOB Reserved for system use
87  */
88 
90  { VT_EMPTY = 0,
91  VT_NULL = 1,
92  VT_I2 = 2,
93  VT_I4 = 3,
94  VT_R4 = 4,
95  VT_R8 = 5,
96  VT_CY = 6,
97  VT_DATE = 7,
98  VT_BSTR = 8,
100  VT_ERROR = 10,
101  VT_BOOL = 11,
105  VT_I1 = 16,
106  VT_UI1 = 17,
107  VT_UI2 = 18,
108  VT_UI4 = 19,
109  VT_I8 = 20,
110  VT_UI8 = 21,
111  VT_INT = 22,
112  VT_UINT = 23,
113  VT_VOID = 24,
115  VT_PTR = 26,
117  VT_CARRAY = 28,
119  VT_LPSTR = 30,
120  VT_LPWSTR = 31,
121  VT_RECORD = 36,
123  VT_BLOB = 65,
124  VT_STREAM = 66,
129  VT_CF = 71,
130  VT_CLSID = 72,
131  VT_BSTR_BLOB = 0xfff,
132  VT_VECTOR = 0x1000,
133  VT_ARRAY = 0x2000,
134  VT_BYREF = 0x4000,
135  VT_RESERVED = 0x8000,
136  VT_ILLEGAL = 0xffff,
138  VT_TYPEMASK = 0xfff
139  };
140 
141 
142 typedef /* [wire_marshal] */ struct tagVARIANT VARIANT;
144 
146 
147 typedef struct tagVARIANT {
149  WORD wReserved1; // typedef unsigned short WORD;
152  union {
153  BYTE bVal; // VT_UI1.
154  SHORT iVal; // VT_I2.
155  LONG lVal; // VT_I4.
156  LONGLONG llVal; // VT_I8.
157  FLOAT fltVal; // VT_R4.
158  DOUBLE dblVal; // VT_R8.
159  VARIANT_BOOL boolVal; // VT_BOOL.
160  SCODE scode; // VT_ERROR.
161  CY cyVal; // VT_CY.
162  DATE date; // VT_DATE.
163  BSTR bstrVal; // VT_BSTR.
164  DECIMAL FAR* pdecVal; // VT_BYREF|VT_DECIMAL.
165  IUnknown FAR* punkVal; // VT_UNKNOWN.
166  IDispatch FAR* pdispVal; // VT_DISPATCH.
167  SAFEARRAY FAR* parray; // VT_ARRAY|*.
168  BYTE FAR* pbVal; // VT_BYREF|VT_UI1.
169  SHORT FAR* piVal; // VT_BYREF|VT_I2.
170  LONG FAR* plVal; // VT_BYREF|VT_I4.
171  FLOAT FAR* pfltVal; // VT_BYREF|VT_R4.
172  DOUBLE FAR* pdblVal; // VT_BYREF|VT_R8.
173  VARIANT_BOOL FAR* pboolVal; // VT_BYREF|VT_BOOL.
174  SCODE FAR* pscode; // VT_BYREF|VT_ERROR.
175  CY FAR* pcyVal; // VT_BYREF|VT_CY.
176  DATE FAR* pdate; // VT_BYREF|VT_DATE.
177  BSTR FAR* pbstrVal; // VT_BYREF|VT_BSTR.
178  IUnknown FAR* FAR* ppunkVal; // VT_BYREF|VT_UNKNOWN.
179  IDispatch FAR* FAR* ppdispVal; // VT_BYREF|VT_DISPATCH.
180  SAFEARRAY FAR* FAR* pparray; // VT_ARRAY|*.
181  VARIANT FAR* pvarVal; // VT_BYREF|VT_VARIANT.
182  PVOID byref; // Generic ByRef.
183  CHAR cVal; // VT_I1.
184  USHORT uiVal; // VT_UI2.
185  ULONG ulVal; // VT_UI4.
186  INT intVal; // VT_INT.
187  UINT uintVal; // VT_UINT.
188  CHAR FAR * pcVal; // VT_BYREF|VT_I1.
189  USHORT FAR * puiVal; // VT_BYREF|VT_UI2.
190  ULONG FAR * pulVal; // VT_BYREF|VT_UI4.
191  INT FAR * pintVal; // VT_BYREF|VT_INT.
192  UINT FAR * puintVal; //VT_BYREF|VT_UINT.
193  };
194 } tagVARIANT;
195 
196 
197 /*---------------------------------------------------------------------*/
198 /* VARIANT API */
199 /*---------------------------------------------------------------------*/
200 
201 WINOLEAUTAPI_(void) DLL_MSICOM_EXIM VariantInit(VARIANTARG * pvarg);
206  VARIANTARG * pvarSrc, USHORT wFlags, VARTYPE vt);
207 WINOLEAUTAPI DLL_MSICOM_EXIM VariantChangeTypeEx(VARIANTARG * pvargDest, VARIANTARG * pvarSrc, LCID lcid, USHORT wFlags, VARTYPE vt);
209 
210 // Flags for VariantChangeType/VariantChangeTypeEx
211 #define VARIANT_NOVALUEPROP 0x01
212 #define VARIANT_ALPHABOOL 0x02 // For VT_BOOL to VT_BSTR conversions,
213  // convert to "True"/"False" instead of
214  // "-1"/"0"
215 #define VARIANT_NOUSEROVERRIDE 0x04 // For conversions to/from VT_BSTR,
216  // passes LOCALE_NOUSEROVERRIDE
217  // to core coercion routines
218 #define VARIANT_CALENDAR_HIJRI 0x08
219 #define VARIANT_LOCALBOOL 0x10 // For VT_BOOL to VT_BSTR and back,
220  // convert to local language rather than
221  // English
222 
223 // Compare results. These are returned as a SUCCESS HResult. Subtracting
224 // one gives the usual values of -1 for Less Than, 0 for Equal To, +1 for
225 // Greater Than.
226 //
227 #define VARCMP_LT 0
228 #define VARCMP_EQ 1
229 #define VARCMP_GT 2
230 #define VARCMP_NULL 3
231 
232 
233 #define V_UNION(X, Y) ((X)->Y)
234 #define V_VT(X) ((X)->vt)
235 #define V_RECORDINFO(X) ((X)->pRecInfo)
236 #define V_RECORD(X) ((X)->pvRecord)
237 
238 
239 /* Variant access macros
240  */
241 #define V_ISBYREF(X) (V_VT(X)&VT_BYREF)
242 #define V_ISARRAY(X) (V_VT(X)&VT_ARRAY)
243 #define V_ISVECTOR(X) (V_VT(X)&VT_VECTOR)
244 #define V_NONE(X) V_I2(X)
245 
246 #define V_UI1(X) V_UNION(X, bVal)
247 #define V_UI1REF(X) V_UNION(X, pbVal)
248 #define V_I2(X) V_UNION(X, iVal)
249 #define V_I2REF(X) V_UNION(X, piVal)
250 #define V_I4(X) V_UNION(X, lVal)
251 #define V_I4REF(X) V_UNION(X, plVal)
252 #define V_I8(X) V_UNION(X, llVal)
253 #define V_I8REF(X) V_UNION(X, pllVal)
254 #define V_R4(X) V_UNION(X, fltVal)
255 #define V_R4REF(X) V_UNION(X, pfltVal)
256 #define V_R8(X) V_UNION(X, dblVal)
257 #define V_R8REF(X) V_UNION(X, pdblVal)
258 #define V_I1(X) V_UNION(X, cVal)
259 #define V_I1REF(X) V_UNION(X, pcVal)
260 #define V_UI2(X) V_UNION(X, uiVal)
261 #define V_UI2REF(X) V_UNION(X, puiVal)
262 #define V_UI4(X) V_UNION(X, ulVal)
263 #define V_UI4REF(X) V_UNION(X, pulVal)
264 #define V_UI8(X) V_UNION(X, ullVal)
265 #define V_UI8REF(X) V_UNION(X, pullVal)
266 #define V_INT(X) V_UNION(X, intVal)
267 #define V_INTREF(X) V_UNION(X, pintVal)
268 #define V_UINT(X) V_UNION(X, uintVal)
269 #define V_UINTREF(X) V_UNION(X, puintVal)
270 
271 #define V_CY(X) V_UNION(X, cyVal)
272 #define V_CYREF(X) V_UNION(X, pcyVal)
273 #define V_DATE(X) V_UNION(X, date)
274 #define V_DATEREF(X) V_UNION(X, pdate)
275 #define V_BSTR(X) V_UNION(X, bstrVal)
276 #define V_BSTRREF(X) V_UNION(X, pbstrVal)
277 #define V_DISPATCH(X) V_UNION(X, pdispVal)
278 #define V_DISPATCHREF(X) V_UNION(X, ppdispVal)
279 #define V_ERROR(X) V_UNION(X, scode)
280 #define V_ERRORREF(X) V_UNION(X, pscode)
281 #define V_BOOL(X) V_UNION(X, boolVal)
282 #define V_BOOLREF(X) V_UNION(X, pboolVal)
283 #define V_UNKNOWN(X) V_UNION(X, punkVal)
284 #define V_UNKNOWNREF(X) V_UNION(X, ppunkVal)
285 #define V_VARIANTREF(X) V_UNION(X, pvarVal)
286 #define V_ARRAY(X) V_UNION(X, parray)
287 #define V_ARRAYREF(X) V_UNION(X, pparray)
288 #define V_BYREF(X) V_UNION(X, byref)
289 
290 #define V_DECIMAL(X) V_UNION(X, decVal)
291 #define V_DECIMALREF(X) V_UNION(X, pdecVal)
292 
293 #define VTBIT_I1 (1 << VT_I1)
294 #define VTBIT_UI1 (1 << VT_UI1)
295 #define VTBIT_I2 (1 << VT_I2)
296 #define VTBIT_UI2 (1 << VT_UI2)
297 #define VTBIT_I4 (1 << VT_I4)
298 #define VTBIT_UI4 (1 << VT_UI4)
299 #define VTBIT_I8 (1 << VT_I8)
300 #define VTBIT_UI8 (1 << VT_UI8)
301 #define VTBIT_R4 (1 << VT_R4)
302 #define VTBIT_R8 (1 << VT_R8)
303 #define VTBIT_CY (1 << VT_CY)
304 #define VTBIT_DECIMAL (1 << VT_DECIMAL)
305 
306 #define VTBIT_BOOL (1 << VT_BOOL)
307 #define VTBIT_BSTR (1 << VT_BSTR)
308 #define VTBIT_DATE (1 << VT_DATE)
309 #define VTBIT_DISPATCH (1 << VT_DISPATCH)
310 #define VTBIT_EMPTY (1 << VT_EMPTY)
311 #define VTBIT_ERROR (1 << VT_ERROR)
312 #define VTBIT_INT (1 << VT_INT)
313 #define VTBIT_NULL (1 << VT_NULL)
314 #define VTBIT_UINT (1 << VT_UINT)
315 #define VTBIT_UNKNOWN (1 << VT_UNKNOWN)
316 #define VTBIT_VARIANT (1 << VT_VARIANT)
317 #define VTBIT_15 (1 << 15) /* no variant type with this number */
318 
319 #endif /* _VARIANT_H_ */
320 
321 
322 
INT intVal
Definition: Msi_variant.h:186
USHORT uiVal
Definition: Msi_variant.h:184
Definition: Msi_variant.h:90
IUnknown FAR * punkVal
Definition: Msi_variant.h:165
char CHAR
Definition: PDCwtypes.h:338
Definition: Msi_variant.h:100
Definition: Msi_variant.h:91
OLECHAR __RPC_FAR * BSTR
Definition: PDCwtypes.h:401
BSTR FAR * pbstrVal
Definition: Msi_variant.h:177
Definition: Msi_variant.h:132
WINOLEAUTAPI DLL_MSICOM_EXIM VariantChangeTypeEx(VARIANTARG *pvargDest, VARIANTARG *pvarSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
BYTE FAR * pbVal
Definition: Msi_variant.h:168
double DATE
Definition: PDCwtypes.h:154
Definition: Msi_variant.h:98
WINOLEAUTAPI DLL_MSICOM_EXIM VariantClear(VARIANTARG *pvarg)
SHORT iVal
Definition: Msi_variant.h:154
LONG lVal
Definition: Msi_variant.h:155
LONG FAR * plVal
Definition: Msi_variant.h:170
LONGLONG llVal
Definition: Msi_variant.h:156
ULONG FAR * pulVal
Definition: Msi_variant.h:190
int INT
Definition: PDCwtypes.h:96
Definition: Msi_variant.h:104
float FLOAT
Definition: PDCwtypes.h:150
unsigned char BYTE
Definition: PDCwtypes.h:108
WORD wReserved1
Definition: Msi_variant.h:149
ULONG ulVal
Definition: Msi_variant.h:185
SCODE FAR * pscode
Definition: Msi_variant.h:174
VARIANT VARIANTARG
Definition: Msi_variant.h:145
WINOLEAUTAPI DLL_MSICOM_EXIM VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: Msi_variant.h:133
WINOLEAUTAPI_(void) DLL_MSICOM_EXIM VariantInit(VARIANTARG *pvarg)
short SHORT
Definition: PDCwtypes.h:148
Definition: Msi_variant.h:94
Definition: Msi_variant.h:138
Definition: Msi_variant.h:122
DECIMAL FAR * pdecVal
Definition: Msi_variant.h:164
Definition: Msi_variant.h:106
WINOLEAUTAPI DLL_MSICOM_EXIM VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvarSrc, USHORT wFlags, VARTYPE vt)
DOUBLE FAR * pdblVal
Definition: Msi_variant.h:172
Definition: PDCwtypes.h:274
unsigned int UINT
Definition: PDCwtypes.h:110
unsigned short VARTYPE
Definition: Msi_variant.h:32
Definition: Msi_variant.h:92
Definition: Msi_variant.h:127
PVOID byref
Definition: Msi_variant.h:182
BYTE bVal
Definition: Msi_variant.h:153
FLOAT fltVal
Definition: Msi_variant.h:157
USHORT FAR * puiVal
Definition: Msi_variant.h:189
Definition: Msi_variant.h:116
Definition: Msi_oaidl.h:95
Definition: Msi_variant.h:101
VARTYPE vt
Definition: Msi_variant.h:148
DWORD LCID
Definition: PDCwtypes.h:294
Definition: Msi_variant.h:135
CY cyVal
Definition: Msi_variant.h:161
SAFEARRAY FAR * parray
Definition: Msi_variant.h:167
CHAR cVal
Definition: Msi_variant.h:183
Definition: Msi_variant.h:99
Definition: Msi_variant.h:103
CY FAR * pcyVal
Definition: Msi_variant.h:175
WINOLEAUTAPI DLL_MSICOM_EXIM VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
Definition: Msi_variant.h:129
SAFEARRAY FAR *FAR * pparray
Definition: Msi_variant.h:180
Definition: Msi_variant.h:123
WORD wReserved3
Definition: Msi_variant.h:151
Definition: Msi_variant.h:110
Definition: Msi_variant.h:105
WINOLEAUTAPI DLL_MSICOM_EXIM VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: Msi_variant.h:107
Definition: Msi_variant.h:128
CHAR FAR * pcVal
Definition: Msi_variant.h:188
Definition: Msi_variant.h:121
IDispatch FAR * pdispVal
Definition: Msi_variant.h:166
INT FAR * pintVal
Definition: Msi_variant.h:191
Definition: Msi_variant.h:137
struct tagSAFEARRAY SAFEARRAY
SCODE scode
Definition: Msi_variant.h:160
Definition: Msi_variant.h:114
UINT uintVal
Definition: Msi_variant.h:187
Definition: Msi_variant.h:134
UINT FAR * puintVal
Definition: Msi_variant.h:192
Definition: Msi_variant.h:120
long LONG
Definition: PDCwtypes.h:119
VARIANT FAR * pvarVal
Definition: Msi_variant.h:181
void __RPC_FAR * PVOID
Definition: PDCwtypes.h:149
IDispatch FAR *FAR * ppdispVal
Definition: Msi_variant.h:179
Definition: Msi_variant.h:97
DATE FAR * pdate
Definition: Msi_variant.h:176
Definition: Msi_variant.h:108
WORD wReserved2
Definition: Msi_variant.h:150
IUnknown FAR *FAR * ppunkVal
Definition: Msi_variant.h:178
Definition: Msi_variant.h:117
unsigned short WORD
Definition: PDCwtypes.h:109
Definition: Msi_oaidl.h:41
#define __RPC_FAR
Definition: PDCrpc.h:38
Definition: Msi_variant.h:126
Definition: Msi_variant.h:113
VARIANT_BOOL boolVal
Definition: Msi_variant.h:159
FLOAT FAR * pfltVal
Definition: Msi_variant.h:171
#define DLL_MSICOM_EXIM
Definition: MsiCOM.h:19
unsigned short USHORT
Definition: PDCwtypes.h:155
Definition: Msi_variant.h:119
Definition: Msi_variant.h:95
Definition: Msi_variant.h:125
#define WINOLEAUTAPI
Definition: Msi_bstr.h:21
Definition: Msi_variant.h:115
LONG SCODE
Definition: PDCwtypes.h:153
Definition: Msi_variant.h:147
Definition: Msi_variant.h:96
Definition: Msi_variant.h:109
Definition: Msi_variant.h:124
struct tagVARIANT tagVARIANT
Definition: Msi_variant.h:102
Definition: Msi_variant.h:130
Definition: Msi_variant.h:93
Definition: Msi_variant.h:111
#define FAR
Definition: PDCwtypes.h:68
Definition: Msi_variant.h:118
Definition: Msi_variant.h:136
SHORT FAR * piVal
Definition: Msi_variant.h:169
DWORD ULONG
Definition: PDCwtypes.h:127
VARIANT_BOOL FAR * pboolVal
Definition: Msi_variant.h:173
DOUBLE dblVal
Definition: Msi_variant.h:158
long long LONGLONG
Definition: PDCwtypes.h:120
unsigned long DWORD
Definition: PDCwtypes.h:121
Definition: Msi_variant.h:131
Definition: Msi_oaidl.h:510
Definition: Msi_variant.h:112
short VARIANT_BOOL
Definition: PDCwtypes.h:152
DATE date
Definition: Msi_variant.h:162
double DOUBLE
Definition: PDCwtypes.h:151
Definition: PDCwtypes.h:261
VARIANT __RPC_FAR * LPVARIANT
Definition: Msi_variant.h:143
BSTR bstrVal
Definition: Msi_variant.h:163
EnumVariantType
Definition: Msi_variant.h:89