XRC: make wxStaticText's wrap property a dimension.
[wxWidgets.git] / interface / wx / longlong.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: longlong.h
3 // Purpose: interface of wxLongLong
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxLongLong
10
11 This class represents a signed 64 bit long number. It is implemented using the
12 native 64 bit type where available (machines with 64 bit longs or compilers
13 which have (an analog of) @e long long type) and uses the emulation code in
14 the other cases which ensures that it is the most efficient solution for
15 working with 64 bit integers independently of the architecture.
16
17 wxLongLong defines all usual arithmetic operations such as addition,
18 subtraction, bitwise shifts and logical operations as well as multiplication
19 and division (not yet for the machines without native @e long long).
20 It also has operators for implicit construction from and conversion to the native
21 @e long long type if it exists and @e long.
22
23 You would usually use this type in exactly the same manner as any other
24 (built-in) arithmetic type. Note that wxLongLong is a signed type, if you
25 want unsigned values use wxULongLong which has exactly the same API as
26 wxLongLong except when explicitly mentioned otherwise.
27
28 If a native (i.e. supported directly by the compiler) 64 bit integer type was
29 found to exist, @e wxLongLong_t macro will be defined to correspond to it.
30 Also, in this case only, two additional macros will be defined:
31 - wxLongLongFmtSpec() for printing 64 bit integers using the standard @c printf()
32 function (but see also wxLongLong::ToString for a more portable solution);
33 - wxLL() for defining 64 bit integer compile-time constants.
34
35 @library{wxbase}
36 @category{data}
37 */
38 class wxLongLong
39 {
40 public:
41 /**
42 Default constructor initializes the object to 0.
43 */
44 wxLongLong();
45
46 /**
47 Constructor from native long long (only for compilers supporting it).
48 */
49 wxLongLong(wxLongLong_t ll);
50
51 /**
52 Constructor from 2 longs: the high and low part are combined into one
53 wxLongLong.
54 */
55 wxLongLong(long hi, unsigned long lo);
56
57 //@{
58 /**
59 Returns an absolute value of wxLongLong - either making a copy (const version)
60 or modifying it in place (the second one). Not in wxULongLong.
61 */
62 wxLongLong Abs() const;
63 wxLongLong& Abs();
64 //@}
65
66 /**
67 This allows to convert a double value to wxLongLong type.
68
69 Such conversion is not always possible in which case the result will be
70 silently truncated in a platform-dependent way. Not in wxULongLong.
71 */
72 wxLongLong Assign(double d);
73
74 /**
75 Returns the high 32 bits of 64 bit integer.
76 */
77 long GetHi() const;
78
79 /**
80 Returns the low 32 bits of 64 bit integer.
81 */
82 unsigned long GetLo() const;
83
84 /**
85 Convert to native long long (only for compilers supporting it).
86 */
87 wxLongLong_t GetValue() const;
88
89 /**
90 Returns the value as @c double.
91 */
92 double ToDouble() const;
93
94 /**
95 Truncate wxLongLong to long. If the conversion loses data (i.e. the wxLongLong
96 value is outside the range of built-in long type), an assert will be triggered
97 in debug mode.
98 */
99 long ToLong() const;
100
101 /**
102 Returns the string representation of a wxLongLong.
103 */
104 wxString ToString() const;
105
106
107 /**
108 Adds 2 wxLongLongs together and returns the result.
109 */
110 wxLongLong operator+(const wxLongLong& ll) const;
111
112 /**
113 Add another wxLongLong to this one.
114 */
115 wxLongLong& operator+(const wxLongLong& ll);
116
117
118 /**
119 Subtracts 2 wxLongLongs and returns the result.
120 */
121 wxLongLong operator-(const wxLongLong& ll) const;
122
123 /**
124 Subtracts another wxLongLong from this one.
125 */
126 wxLongLong& operator-(const wxLongLong& ll);
127
128
129 //@{
130 /**
131 Pre/post increment operator.
132 */
133 wxLongLong operator++();
134 wxLongLong operator++(int);
135 //@}
136
137 //@{
138 /**
139 Pre/post decrement operator.
140 */
141 wxLongLong operator--();
142 wxLongLong operator--(int);
143 //@}
144
145 /**
146 Returns the value of this wxLongLong with opposite sign. Not in wxULongLong.
147 */
148 wxLongLong operator-() const;
149
150 /**
151 Assignment operator from unsigned long long. The sign bit will be copied too.
152
153 @since 2.7.0
154 */
155 wxLongLong& operator=(const wxULongLong& ll);
156
157 /**
158 Assignment operator from native long long (only for compilers supporting it).
159 */
160 wxLongLong& operator=(wxLongLong_t ll);
161
162 /**
163 Assignment operator from native unsigned long long (only for compilers supporting it).
164
165 @since 2.7.0
166 */
167 wxLongLong& operator=(wxULongLong_t ll);
168
169 /**
170 Assignment operator from long.
171
172 @since 2.7.0
173 */
174 wxLongLong& operator=(long l);
175
176 /**
177 Assignment operator from unsigned long.
178
179 @since 2.7.0
180 */
181 wxLongLong& operator=(unsigned long l);
182
183 };
184
185
186 /**
187 @class wxULongLong
188
189 This class represents an unsigned 64 bit long number.
190
191 Since wxULongLong has exactly the same API as wxLongLong, please refer
192 to wxLongLong documentation (this page exists only as redirection).
193
194 @library{wxbase}
195 @category{data}
196 */
197 class wxULongLong
198 {
199 };
200
201
202 // ============================================================================
203 // Global functions/macros
204 // ============================================================================
205
206 /** @addtogroup group_funcmacro_misc */
207 //@{
208
209 /**
210 This macro is defined to contain the @c printf() format specifier using
211 which 64 bit integer numbers (i.e. those of type @c wxLongLong_t) can be
212 printed. Example of using it:
213
214 @code
215 #ifdef wxLongLong_t
216 wxLongLong_t ll = wxLL(0x1234567890abcdef);
217 printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
218 #endif
219 @endcode
220
221 @see wxLL()
222
223 @header{wx/longlong.h}
224 */
225 #define wxLongLongFmtSpec
226
227 /**
228 This macro is defined for the platforms with a native 64 bit integer type
229 and allow the use of 64 bit compile time constants:
230
231 @code
232 #ifdef wxLongLong_t
233 wxLongLong_t ll = wxLL(0x1234567890abcdef);
234 #endif
235 @endcode
236
237 @see wxULL(), wxLongLong
238
239 @header{wx/longlong.h}
240 */
241 wxLongLong_t wxLL(number);
242
243 /**
244 This macro is defined for the platforms with a native 64 bit integer type
245 and allow the use of 64 bit compile time constants:
246
247 @code
248 #ifdef wxLongLong_t
249 unsigned wxLongLong_t ll = wxULL(0x1234567890abcdef);
250 #endif
251 @endcode
252
253 @see wxLL(), wxLongLong
254
255 @header{wx/longlong.h}
256 */
257 wxLongLong_t wxULL(number);
258
259 //@}
260