regedit: An English (United States) spelling fix.
[wine/multimedia.git] / dlls / oleaut32 / variant.h
blob265fcc8041ee66bd46a4a24f7c4f16010814519b
1 /*
2 * Variant Inlines
4 * Copyright 2003 Jon Griffiths
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define NONAMELESSUNION
21 #define NONAMELESSSTRUCT
22 #include "windef.h"
23 #include "winerror.h"
24 #include "objbase.h"
25 #include "oleauto.h"
26 #include <math.h>
28 /* Get just the type from a variant pointer */
29 #define V_TYPE(v) (V_VT((v)) & VT_TYPEMASK)
31 /* Flags set in V_VT, other than the actual type value */
32 #define VT_EXTRA_TYPE (VT_VECTOR|VT_ARRAY|VT_BYREF|VT_RESERVED)
34 /* Get the extra flags from a variant pointer */
35 #define V_EXTRA_TYPE(v) (V_VT((v)) & VT_EXTRA_TYPE)
37 /* Missing in Windows but useful VTBIT_* defines */
38 #define VTBIT_BOOL (1 << VT_BSTR)
39 #define VTBIT_BSTR (1 << VT_BSTR)
40 #define VTBIT_DATE (1 << VT_DATE)
41 #define VTBIT_DISPATCH (1 << VT_DISPATCH)
42 #define VTBIT_EMPTY (1 << VT_EMPTY)
43 #define VTBIT_ERROR (1 << VT_ERROR)
44 #define VTBIT_INT (1 << VT_INT)
45 #define VTBIT_NULL (1 << VT_NULL)
46 #define VTBIT_UINT (1 << VT_UINT)
47 #define VTBIT_UNKNOWN (1 << VT_UNKNOWN)
48 #define VTBIT_VARIANT (1 << VT_VARIANT)
49 #define VTBIT_15 (1 << 15) /* no variant type with this number */
51 extern const char * const wine_vtypes[];
52 #define debugstr_vt(v) (((v)&VT_TYPEMASK) <= VT_CLSID ? wine_vtypes[((v)&VT_TYPEMASK)] : \
53 ((v)&VT_TYPEMASK) == VT_BSTR_BLOB ? "VT_BSTR_BLOB": "Invalid")
54 #define debugstr_VT(v) (!(v) ? "(null)" : debugstr_vt(V_TYPE((v))))
56 extern const char * const wine_vflags[];
57 #define debugstr_vf(v) (wine_vflags[((v)&VT_EXTRA_TYPE)>>12])
58 #define debugstr_VF(v) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v)))
60 /* Size constraints */
61 #define I1_MAX 0x7f
62 #define I1_MIN ((-I1_MAX)-1)
63 #define UI1_MAX 0xff
64 #define UI1_MIN 0
65 #define I2_MAX 0x7fff
66 #define I2_MIN ((-I2_MAX)-1)
67 #define UI2_MAX 0xffff
68 #define UI2_MIN 0
69 #define I4_MAX 0x7fffffff
70 #define I4_MIN ((-I4_MAX)-1)
71 #define UI4_MAX 0xffffffff
72 #define UI4_MIN 0
73 #define I8_MAX (((LONGLONG)I4_MAX << 32) | UI4_MAX)
74 #define I8_MIN ((-I8_MAX)-1)
75 #define UI8_MAX (((ULONGLONG)UI4_MAX << 32) | UI4_MAX)
76 #define UI8_MIN 0
77 #define DATE_MAX 2958465
78 #define DATE_MIN -657434
79 #define R4_MAX 3.402823567797336e38
80 #define R4_MIN 1.40129846432481707e-45
81 #define R8_MAX 1.79769313486231470e+308
82 #define R8_MIN 4.94065645841246544e-324
84 /* Value of sign for a positive decimal number */
85 #define DECIMAL_POS 0
87 /* Native headers don't change the union ordering for DECIMAL sign/scale (duh).
88 * This means that the signscale member is only useful for setting both members to 0.
89 * SIGNSCALE creates endian-correct values so that we can properly set both at once
90 * to values other than 0.
92 #ifdef WORDS_BIGENDIAN
93 #define SIGNSCALE(sign,scale) (((scale) << 8) | sign)
94 #else
95 #define SIGNSCALE(sign,scale) (((sign) << 8) | scale)
96 #endif
98 /* Macros for getting at a DECIMAL's parts */
99 #define DEC_SIGN(d) ((d)->u.s.sign)
100 #define DEC_SCALE(d) ((d)->u.s.scale)
101 #define DEC_SIGNSCALE(d) ((d)->u.signscale)
102 #define DEC_HI32(d) ((d)->Hi32)
103 #define DEC_MID32(d) ((d)->u1.s1.Mid32)
104 #define DEC_LO32(d) ((d)->u1.s1.Lo32)
105 #define DEC_LO64(d) ((d)->u1.Lo64)
107 #define DEC_MAX_SCALE 28 /* Maximum scale for a decimal */
109 /* Internal flags for low level conversion functions */
110 #define VAR_BOOLONOFF 0x0400 /* Convert bool to "On"/"Off" */
111 #define VAR_BOOLYESNO 0x0800 /* Convert bool to "Yes"/"No" */
112 #define VAR_NEGATIVE 0x1000 /* Number is negative */
114 /* The localised characters that make up a valid number */
115 typedef struct tagVARIANT_NUMBER_CHARS
117 WCHAR cNegativeSymbol;
118 WCHAR cPositiveSymbol;
119 WCHAR cDecimalPoint;
120 WCHAR cDigitSeparator;
121 WCHAR cCurrencyLocal;
122 WCHAR cCurrencyLocal2;
123 WCHAR cCurrencyDecimalPoint;
124 WCHAR cCurrencyDigitSeparator;
125 } VARIANT_NUMBER_CHARS;
128 BOOL VARIANT_GetLocalisedText(LANGID, DWORD, WCHAR *);
129 HRESULT VARIANT_ClearInd(VARIANTARG *);