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