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