]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/longlong.tex
added wxString::ToLongLong() and ToULongLong() (feature request 1290937)
[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
47\latexignore{\rtfignore{\wxheading{Members}}}
48
e7aaf2de 49
d7da9756
VZ
50\membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglongdef}
51
52\func{}{wxLongLong}{\void}
53
54Default 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
61Constructor 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
68Constructor from 2 longs: the high and low part are combined into one
69wxLongLong.
70
e7aaf2de 71
d7da9756
VZ
72\membersection{wxLongLong::operator=}\label{wxlonglongoperatorassign}
73
74\func{wxLongLong\& operator}{operator=}{\param{wxLongLong\_t }{ll}}
75
76Assignment 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
83Assignment operator from native unsigned long long (only for compilers
84supporting it).
85
49b8ffac
MR
86\newsince{2.7.0}
87
216a72f3
VZ
88\membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignlong}
89
90\func{wxLongLong\& operator}{operator=}{\param{long }{l}}
91
92Assignment operator from long.
93
49b8ffac
MR
94\newsince{2.7.0}
95
216a72f3
VZ
96\membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignulong}
97
98\func{wxLongLong\& operator}{operator=}{\param{unsigned long }{l}}
99
100Assignment operator from unsigned long.
101
49b8ffac
MR
102\newsince{2.7.0}
103
216a72f3
VZ
104\membersection{wxLongLong::operator=}\label{wxlonglongoperatorassignulonglong}
105
106\func{wxLongLong\& operator}{operator=}{\param{const wxULongLong \& }{ll}}
107
108Assignment operator from unsigned long long. The sign bit will be copied too.
109
49b8ffac
MR
110\newsince{2.7.0}
111
d7da9756
VZ
112\membersection{wxLongLong::Abs}\label{wxlonglongabs}
113
114\constfunc{wxLongLong}{Abs}{\void}
115
116\func{wxLongLong\&}{Abs}{\void}
117
118Returns an absolute value of wxLongLong - either making a copy (const version)
8e38fd1f 119or modifying it in place (the second one). Not in wxULongLong.
d7da9756 120
e7aaf2de 121
d7da9756
VZ
122\membersection{wxLongLong::Assign}\label{wxlonglongassign}
123
124\func{wxLongLong\&}{Assign}{\param{double }{d}}
125
126This allows to convert a double value to wxLongLong type. Such conversion is
127not always possible in which case the result will be silently truncated in a
8e38fd1f 128platform-dependent way. Not in wxULongLong.
d7da9756 129
e7aaf2de 130
d7da9756
VZ
131\membersection{wxLongLong::GetHi}\label{wxlonglonggethi}
132
133\constfunc{long}{GetHi}{\void}
134
2edb0bde 135Returns the high 32 bits of 64 bit integer.
d7da9756 136
e7aaf2de 137
d7da9756
VZ
138\membersection{wxLongLong::GetLo}\label{wxlonglonggetlo}
139
140\constfunc{unsigned long}{GetLo}{\void}
141
2edb0bde 142Returns the low 32 bits of 64 bit integer.
d7da9756 143
e7aaf2de 144
d7da9756
VZ
145\membersection{wxLongLong::GetValue}\label{wxlonglonggetvalue}
146
147\constfunc{wxLongLong\_t}{GetValue}{\void}
148
149Convert to native long long (only for compilers supporting it)
150
e7aaf2de
VZ
151
152\membersection{wxLongLong::ToDouble}\label{wxlonglonggetdouble}
153
154\constfunc{double}{ToDouble}{\void}
155
156Returns the value as \texttt{double}.
157
158
d7da9756
VZ
159\membersection{wxLongLong::ToLong}\label{wxlonglongtolong}
160
161\constfunc{long}{ToLong}{\void}
162
163Truncate wxLongLong to long. If the conversion loses data (i.e. the wxLongLong
164value is outside the range of built-in long type), an assert will be triggered
165in debug mode.
166
e7aaf2de 167
3a994742
VZ
168\membersection{wxLongLong::ToString}\label{wxlonglongtostring}
169
170\constfunc{wxString}{ToString}{\void}
171
172Returns the string representation of a wxLongLong.
173
e7aaf2de 174
d7da9756
VZ
175\membersection{wxLongLong::operator$+$}\label{wxlonglongoperatorplus}
176
177\constfunc{wxLongLong}{operator$+$}{\param{const wxLongLong\& }{ll}}
178
179Adds 2 wxLongLongs together and returns the result.
180
e7aaf2de 181
d7da9756
VZ
182\membersection{wxLongLong::operator$+=$}\label{wxlonglongoperatorplusassign}
183
184\func{wxLongLong\&}{operator+}{\param{const wxLongLong\& }{ll}}
185
186Add another wxLongLong to this one.
187
e7aaf2de 188
d7da9756
VZ
189\membersection{wxLongLong::operator$++$}\label{wxlonglongoperatorinc}
190
191\func{wxLongLong\&}{operator$++$}{\void}
192
193\func{wxLongLong\&}{operator$++$}{\param{int}{}}
194
195Pre/post increment operator.
196
e7aaf2de 197
d7da9756
VZ
198\membersection{wxLongLong::operator$-$}\label{wxlonglongoperatorunaryminus}
199
200\constfunc{wxLongLong}{operator$-$}{\void}
201
8e38fd1f 202Returns the value of this wxLongLong with opposite sign. Not in wxULongLong.
d7da9756 203
e7aaf2de 204
d7da9756
VZ
205\membersection{wxLongLong::operator$-$}\label{wxlonglongoperatorminus}
206
207\constfunc{wxLongLong}{operator$-$}{\param{const wxLongLong\& }{ll}}
208
dbd94b75 209Subtracts 2 wxLongLongs and returns the result.
d7da9756 210
e7aaf2de 211
d7da9756
VZ
212\membersection{wxLongLong::operator$-=$}\label{wxlonglongoperatorminusassign}
213
214\func{wxLongLong\&}{operator-}{\param{const wxLongLong\& }{ll}}
215
dbd94b75 216Subtracts another wxLongLong from this one.
d7da9756 217
e7aaf2de 218
d7da9756
VZ
219\membersection{wxLongLong::operator$--$}\label{wxlonglongoperatordec}
220
221\func{wxLongLong\&}{operator$--$}{\void}
222
223\func{wxLongLong\&}{operator$--$}{\param{int}{}}
224
225Pre/post decrement operator.
22d6efa8 226
66f55ec6 227% TODO document all other arithmetics operations: shifts, multiplication,
d7da9756 228% division, bitwise, comparison
66f55ec6 229