]>
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 | ||
49 | \membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglongdef} | |
50 | ||
51 | \func{}{wxLongLong}{\void} | |
52 | ||
53 | Default constructor initializes the object to 0. | |
54 | ||
55 | \membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglongll} | |
56 | ||
57 | \func{}{wxLongLong}{\param{wxLongLong\_t }{ll}} | |
58 | ||
59 | Constructor from native long long (only for compilers supporting it). | |
60 | ||
61 | \membersection{wxLongLong::wxLongLong}\label{wxlonglongwxlonglong} | |
62 | ||
63 | \func{}{wxLongLong}{\param{long }{hi}, \param{unsigned long }{lo}} | |
64 | ||
65 | Constructor from 2 longs: the high and low part are combined into one | |
66 | wxLongLong. | |
67 | ||
68 | \membersection{wxLongLong::operator=}\label{wxlonglongoperatorassign} | |
69 | ||
70 | \func{wxLongLong\& operator}{operator=}{\param{wxLongLong\_t }{ll}} | |
71 | ||
72 | Assignment operator from native long long (only for compilers supporting it). | |
73 | ||
74 | \membersection{wxLongLong::Abs}\label{wxlonglongabs} | |
75 | ||
76 | \constfunc{wxLongLong}{Abs}{\void} | |
77 | ||
78 | \func{wxLongLong\&}{Abs}{\void} | |
79 | ||
80 | Returns an absolute value of wxLongLong - either making a copy (const version) | |
8e38fd1f | 81 | or modifying it in place (the second one). Not in wxULongLong. |
d7da9756 VZ |
82 | |
83 | \membersection{wxLongLong::Assign}\label{wxlonglongassign} | |
84 | ||
85 | \func{wxLongLong\&}{Assign}{\param{double }{d}} | |
86 | ||
87 | This allows to convert a double value to wxLongLong type. Such conversion is | |
88 | not always possible in which case the result will be silently truncated in a | |
8e38fd1f | 89 | platform-dependent way. Not in wxULongLong. |
d7da9756 VZ |
90 | |
91 | \membersection{wxLongLong::GetHi}\label{wxlonglonggethi} | |
92 | ||
93 | \constfunc{long}{GetHi}{\void} | |
94 | ||
2edb0bde | 95 | Returns the high 32 bits of 64 bit integer. |
d7da9756 VZ |
96 | |
97 | \membersection{wxLongLong::GetLo}\label{wxlonglonggetlo} | |
98 | ||
99 | \constfunc{unsigned long}{GetLo}{\void} | |
100 | ||
2edb0bde | 101 | Returns the low 32 bits of 64 bit integer. |
d7da9756 VZ |
102 | |
103 | \membersection{wxLongLong::GetValue}\label{wxlonglonggetvalue} | |
104 | ||
105 | \constfunc{wxLongLong\_t}{GetValue}{\void} | |
106 | ||
107 | Convert to native long long (only for compilers supporting it) | |
108 | ||
109 | \membersection{wxLongLong::ToLong}\label{wxlonglongtolong} | |
110 | ||
111 | \constfunc{long}{ToLong}{\void} | |
112 | ||
113 | Truncate wxLongLong to long. If the conversion loses data (i.e. the wxLongLong | |
114 | value is outside the range of built-in long type), an assert will be triggered | |
115 | in debug mode. | |
116 | ||
3a994742 VZ |
117 | \membersection{wxLongLong::ToString}\label{wxlonglongtostring} |
118 | ||
119 | \constfunc{wxString}{ToString}{\void} | |
120 | ||
121 | Returns the string representation of a wxLongLong. | |
122 | ||
d7da9756 VZ |
123 | \membersection{wxLongLong::operator$+$}\label{wxlonglongoperatorplus} |
124 | ||
125 | \constfunc{wxLongLong}{operator$+$}{\param{const wxLongLong\& }{ll}} | |
126 | ||
127 | Adds 2 wxLongLongs together and returns the result. | |
128 | ||
129 | \membersection{wxLongLong::operator$+=$}\label{wxlonglongoperatorplusassign} | |
130 | ||
131 | \func{wxLongLong\&}{operator+}{\param{const wxLongLong\& }{ll}} | |
132 | ||
133 | Add another wxLongLong to this one. | |
134 | ||
135 | \membersection{wxLongLong::operator$++$}\label{wxlonglongoperatorinc} | |
136 | ||
137 | \func{wxLongLong\&}{operator$++$}{\void} | |
138 | ||
139 | \func{wxLongLong\&}{operator$++$}{\param{int}{}} | |
140 | ||
141 | Pre/post increment operator. | |
142 | ||
143 | \membersection{wxLongLong::operator$-$}\label{wxlonglongoperatorunaryminus} | |
144 | ||
145 | \constfunc{wxLongLong}{operator$-$}{\void} | |
146 | ||
8e38fd1f | 147 | Returns the value of this wxLongLong with opposite sign. Not in wxULongLong. |
d7da9756 VZ |
148 | |
149 | \membersection{wxLongLong::operator$-$}\label{wxlonglongoperatorminus} | |
150 | ||
151 | \constfunc{wxLongLong}{operator$-$}{\param{const wxLongLong\& }{ll}} | |
152 | ||
dbd94b75 | 153 | Subtracts 2 wxLongLongs and returns the result. |
d7da9756 VZ |
154 | |
155 | \membersection{wxLongLong::operator$-=$}\label{wxlonglongoperatorminusassign} | |
156 | ||
157 | \func{wxLongLong\&}{operator-}{\param{const wxLongLong\& }{ll}} | |
158 | ||
dbd94b75 | 159 | Subtracts another wxLongLong from this one. |
d7da9756 VZ |
160 | |
161 | \membersection{wxLongLong::operator$--$}\label{wxlonglongoperatordec} | |
162 | ||
163 | \func{wxLongLong\&}{operator$--$}{\void} | |
164 | ||
165 | \func{wxLongLong\&}{operator$--$}{\param{int}{}} | |
166 | ||
167 | Pre/post decrement operator. | |
22d6efa8 | 168 | |
66f55ec6 | 169 | % TODO document all other arithmetics operations: shifts, multiplication, |
d7da9756 | 170 | % division, bitwise, comparison |
66f55ec6 | 171 |