]>
Commit | Line | Data |
---|---|---|
d7da9756 VZ |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: longlong.tex | |
3 | %% Purpose: wxLongLong documentation | |
4 | %% Author: Vadim Zeitlin | |
5 | %% Modified by: | |
6 | %% Created: 07.03.00 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) Vadim Zeitlin | |
8795498c | 9 | %% License: wxWindows license |
d7da9756 VZ |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
11 | ||
8b81872f VZ |
12 | \section{\class{wxLongLong}}\label{wxlonglong} |
13 | ||
14 | This class represents a signed 64 bit long number. It is implemented using the | |
15 | native 64 bit type where available (machines with 64 bit longs or compilers | |
16 | which have (an analog of) {\it long long} type) and uses the emulation code in | |
17 | the other cases which ensures that it is the most efficient solution for | |
18 | working with 64 bit integers independently of the architecture. | |
19 | ||
20 | wxLongLong defines all usual arithmetic operations such as addition, | |
2edb0bde | 21 | subtraction, bitwise shifts and logical operations as well as multiplication |
8b81872f VZ |
22 | and division (not yet for the machines without native {\it long long}). It |
23 | also has operators for implicit construction from and conversion to the native | |
24 | {\it long long} type if it exists and {\it long}. | |
25 | ||
26 | You would usually use this type in exactly the same manner as any other | |
8e38fd1f | 27 | (built-in) arithmetic type. Note that wxLongLong is a signed type, if you |
2b5f62a0 VZ |
28 | want unsigned values use wxULongLong which has exactly the same API as |
29 | wxLongLong except when explicitly mentioned otherwise. | |
d7da9756 VZ |
30 | |
31 | If a native (i.e. supported directly by the compiler) 64 bit integer type was | |
2b5f62a0 VZ |
32 | found to exist, {\it wxLongLong\_t} macro will be defined to correspond to it. |
33 | Also, in this case only, two additional macros will be defined: | |
34 | \helpref{wxLongLongFmtSpec}{wxlonglongfmtspec} for printing 64 bit integers | |
35 | using the standard {\tt printf()} function (but see also | |
36 | \helpref{ToString()}{wxlonglongtostring} for a more portable solution) and | |
37 | \helpref{wxLL}{wxll} for defining 64 bit integer compile-time constants. | |
d7da9756 VZ |
38 | |
39 | \wxheading{Derived from} | |
40 | ||
41 | No base class | |
42 | ||
43 | \wxheading{Include files} | |
44 | ||
45 | <wx/longlong.h> | |
46 | ||
47 | \latexignore{\rtfignore{\wxheading{Members}}} | |
48 | ||
e7aaf2de | 49 | |
d7da9756 VZ |
50 | \membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglongdef} |
51 | ||
52 | \func{}{wxLongLong}{\void} | |
53 | ||
54 | Default constructor initializes the object to 0. | |
55 | ||
e7aaf2de | 56 | |
d7da9756 VZ |
57 | \membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglongll} |
58 | ||
59 | \func{}{wxLongLong}{\param{wxLongLong\_t }{ll}} | |
60 | ||
61 | Constructor from native long long (only for compilers supporting it). | |
62 | ||
e7aaf2de | 63 | |
d7da9756 VZ |
64 | \membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglong} |
65 | ||
66 | \func{}{wxLongLong}{\param{long }{hi}, \param{unsigned long }{lo}} | |
67 | ||
68 | Constructor from 2 longs: the high and low part are combined into one | |
69 | wxLongLong. | |
70 | ||
e7aaf2de | 71 | |
d7da9756 VZ |
72 | \membersection{wxLongLong::operator=}\label{wxlonglongoperatorassign} |
73 | ||
74 | \func{wxLongLong\& operator}{operator=}{\param{wxLongLong\_t }{ll}} | |
75 | ||
76 | Assignment operator from native long long (only for compilers supporting it). | |
77 | ||
e7aaf2de | 78 | |
216a72f3 VZ |
79 | \membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignull} |
80 | ||
81 | \func{wxLongLong\& operator}{operator=}{\param{wxULongLong\_t }{ll}} | |
82 | ||
83 | Assignment operator from native unsigned long long (only for compilers | |
84 | supporting it). | |
85 | ||
86 | \membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignlong} | |
87 | ||
88 | \func{wxLongLong\& operator}{operator=}{\param{long }{l}} | |
89 | ||
90 | Assignment operator from long. | |
91 | ||
92 | \membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignulong} | |
93 | ||
94 | \func{wxLongLong\& operator}{operator=}{\param{unsigned long }{l}} | |
95 | ||
96 | Assignment operator from unsigned long. | |
97 | ||
98 | \membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignulonglong} | |
99 | ||
100 | \func{wxLongLong\& operator}{operator=}{\param{const wxULongLong \& }{ll}} | |
101 | ||
102 | Assignment operator from unsigned long long. The sign bit will be copied too. | |
103 | ||
d7da9756 VZ |
104 | \membersection{wxLongLong::Abs}\label{wxlonglongabs} |
105 | ||
106 | \constfunc{wxLongLong}{Abs}{\void} | |
107 | ||
108 | \func{wxLongLong\&}{Abs}{\void} | |
109 | ||
110 | Returns an absolute value of wxLongLong - either making a copy (const version) | |
8e38fd1f | 111 | or modifying it in place (the second one). Not in wxULongLong. |
d7da9756 | 112 | |
e7aaf2de | 113 | |
d7da9756 VZ |
114 | \membersection{wxLongLong::Assign}\label{wxlonglongassign} |
115 | ||
116 | \func{wxLongLong\&}{Assign}{\param{double }{d}} | |
117 | ||
118 | This allows to convert a double value to wxLongLong type. Such conversion is | |
119 | not always possible in which case the result will be silently truncated in a | |
8e38fd1f | 120 | platform-dependent way. Not in wxULongLong. |
d7da9756 | 121 | |
e7aaf2de | 122 | |
d7da9756 VZ |
123 | \membersection{wxLongLong::GetHi}\label{wxlonglonggethi} |
124 | ||
125 | \constfunc{long}{GetHi}{\void} | |
126 | ||
2edb0bde | 127 | Returns the high 32 bits of 64 bit integer. |
d7da9756 | 128 | |
e7aaf2de | 129 | |
d7da9756 VZ |
130 | \membersection{wxLongLong::GetLo}\label{wxlonglonggetlo} |
131 | ||
132 | \constfunc{unsigned long}{GetLo}{\void} | |
133 | ||
2edb0bde | 134 | Returns the low 32 bits of 64 bit integer. |
d7da9756 | 135 | |
e7aaf2de | 136 | |
d7da9756 VZ |
137 | \membersection{wxLongLong::GetValue}\label{wxlonglonggetvalue} |
138 | ||
139 | \constfunc{wxLongLong\_t}{GetValue}{\void} | |
140 | ||
141 | Convert to native long long (only for compilers supporting it) | |
142 | ||
e7aaf2de VZ |
143 | |
144 | \membersection{wxLongLong::ToDouble}\label{wxlonglonggetdouble} | |
145 | ||
146 | \constfunc{double}{ToDouble}{\void} | |
147 | ||
148 | Returns the value as \texttt{double}. | |
149 | ||
150 | ||
d7da9756 VZ |
151 | \membersection{wxLongLong::ToLong}\label{wxlonglongtolong} |
152 | ||
153 | \constfunc{long}{ToLong}{\void} | |
154 | ||
155 | Truncate wxLongLong to long. If the conversion loses data (i.e. the wxLongLong | |
156 | value is outside the range of built-in long type), an assert will be triggered | |
157 | in debug mode. | |
158 | ||
e7aaf2de | 159 | |
3a994742 VZ |
160 | \membersection{wxLongLong::ToString}\label{wxlonglongtostring} |
161 | ||
162 | \constfunc{wxString}{ToString}{\void} | |
163 | ||
164 | Returns the string representation of a wxLongLong. | |
165 | ||
e7aaf2de | 166 | |
d7da9756 VZ |
167 | \membersection{wxLongLong::operator$+$}\label{wxlonglongoperatorplus} |
168 | ||
169 | \constfunc{wxLongLong}{operator$+$}{\param{const wxLongLong\& }{ll}} | |
170 | ||
171 | Adds 2 wxLongLongs together and returns the result. | |
172 | ||
e7aaf2de | 173 | |
d7da9756 VZ |
174 | \membersection{wxLongLong::operator$+=$}\label{wxlonglongoperatorplusassign} |
175 | ||
176 | \func{wxLongLong\&}{operator+}{\param{const wxLongLong\& }{ll}} | |
177 | ||
178 | Add another wxLongLong to this one. | |
179 | ||
e7aaf2de | 180 | |
d7da9756 VZ |
181 | \membersection{wxLongLong::operator$++$}\label{wxlonglongoperatorinc} |
182 | ||
183 | \func{wxLongLong\&}{operator$++$}{\void} | |
184 | ||
185 | \func{wxLongLong\&}{operator$++$}{\param{int}{}} | |
186 | ||
187 | Pre/post increment operator. | |
188 | ||
e7aaf2de | 189 | |
d7da9756 VZ |
190 | \membersection{wxLongLong::operator$-$}\label{wxlonglongoperatorunaryminus} |
191 | ||
192 | \constfunc{wxLongLong}{operator$-$}{\void} | |
193 | ||
8e38fd1f | 194 | Returns the value of this wxLongLong with opposite sign. Not in wxULongLong. |
d7da9756 | 195 | |
e7aaf2de | 196 | |
d7da9756 VZ |
197 | \membersection{wxLongLong::operator$-$}\label{wxlonglongoperatorminus} |
198 | ||
199 | \constfunc{wxLongLong}{operator$-$}{\param{const wxLongLong\& }{ll}} | |
200 | ||
dbd94b75 | 201 | Subtracts 2 wxLongLongs and returns the result. |
d7da9756 | 202 | |
e7aaf2de | 203 | |
d7da9756 VZ |
204 | \membersection{wxLongLong::operator$-=$}\label{wxlonglongoperatorminusassign} |
205 | ||
206 | \func{wxLongLong\&}{operator-}{\param{const wxLongLong\& }{ll}} | |
207 | ||
dbd94b75 | 208 | Subtracts another wxLongLong from this one. |
d7da9756 | 209 | |
e7aaf2de | 210 | |
d7da9756 VZ |
211 | \membersection{wxLongLong::operator$--$}\label{wxlonglongoperatordec} |
212 | ||
213 | \func{wxLongLong\&}{operator$--$}{\void} | |
214 | ||
215 | \func{wxLongLong\&}{operator$--$}{\param{int}{}} | |
216 | ||
217 | Pre/post decrement operator. | |
22d6efa8 | 218 | |
66f55ec6 | 219 | % TODO document all other arithmetics operations: shifts, multiplication, |
d7da9756 | 220 | % division, bitwise, comparison |
66f55ec6 | 221 |