1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qendian.qdoc -->
<title><QtEndian> - Endian Conversion Functions | Qt Core 5.11</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><QtEndian> - Endian Conversion Functions</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title"><QtEndian> - Endian Conversion Functions</h1>
<span class="subtitle"></span>
<!-- $$$<QtEndian>-brief -->
<p>The <QtEndian> header provides functions to convert between little and big endian representations of numbers. <a href="#details">More...</a></p>
<!-- @@@<QtEndian> -->
<ul>
</ul>
<a name="Types"></a>
<h2 id="Types">Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint16_be-typedef">qint16_be</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint16_le-typedef">qint16_le</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint32_be-typedef">qint32_be</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint32_le-typedef">qint32_le</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint64_be-typedef">qint64_be</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint64_le-typedef">qint64_le</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint16_be-typedef">quint16_be</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint16_le-typedef">quint16_le</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint32_be-typedef">quint32_be</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint32_le-typedef">quint32_le</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint64_be-typedef">quint64_be</a></b></td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint64_le-typedef">quint64_le</a></b></td></tr>
</table></div>
<a name="Functions"></a>
<h2 id="Functions">Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a></b>(T <i>src</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a></b>(const void *<i>src</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a></b>(T <i>src</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a></b>(const void *<i>src</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToBigEndian">qToBigEndian</a></b>(T <i>src</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToBigEndian">qToBigEndian</a></b>(T <i>src</i>, void *<i>dest</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToLittleEndian">qToLittleEndian</a></b>(T <i>src</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToLittleEndian">qToLittleEndian</a></b>(T <i>src</i>, void *<i>dest</i>)</td></tr>
</table></div>
<!-- $$$<QtEndian>-description -->
<div class="descr"> <a name="details"></a>
</div>
<!-- @@@<QtEndian> -->
<h2>Type Documentation</h2>
<!-- $$$qint16_be -->
<h3 class="fn" id="qint16_be-typedef"><a name="qint16_be-typedef"></a>typedef <span class="name">qint16_be</span></h3>
<p>Typedef for <a href="qbeinteger.html">QBEInteger</a><qint16>. This type is guaranteed to be stored in memory as a 16-bit big-endian signed integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#qint16-typedef">qint16</a>.</p>
<!-- @@@qint16_be -->
<!-- $$$qint16_le -->
<h3 class="fn" id="qint16_le-typedef"><a name="qint16_le-typedef"></a>typedef <span class="name">qint16_le</span></h3>
<p>Typedef for <a href="qleinteger.html">QLEInteger</a><qint16>. This type is guaranteed to be stored in memory as a 16-bit little-endian signed integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#qint16-typedef">qint16</a>.</p>
<!-- @@@qint16_le -->
<!-- $$$qint32_be -->
<h3 class="fn" id="qint32_be-typedef"><a name="qint32_be-typedef"></a>typedef <span class="name">qint32_be</span></h3>
<p>Typedef for <a href="qbeinteger.html">QBEInteger</a><qint32>. This type is guaranteed to be stored in memory as a 32-bit big-endian signed integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#qint32-typedef">qint32</a>.</p>
<!-- @@@qint32_be -->
<!-- $$$qint32_le -->
<h3 class="fn" id="qint32_le-typedef"><a name="qint32_le-typedef"></a>typedef <span class="name">qint32_le</span></h3>
<p>Typedef for <a href="qleinteger.html">QLEInteger</a><qint32>. This type is guaranteed to be stored in memory as a 32-bit little-endian signed integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#qint32-typedef">qint32</a>.</p>
<!-- @@@qint32_le -->
<!-- $$$qint64_be -->
<h3 class="fn" id="qint64_be-typedef"><a name="qint64_be-typedef"></a>typedef <span class="name">qint64_be</span></h3>
<p>Typedef for <a href="qbeinteger.html">QBEInteger</a><qint64>. This type is guaranteed to be stored in memory as a 64-bit big-endian signed integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#qint64-typedef">qint64</a>.</p>
<!-- @@@qint64_be -->
<!-- $$$qint64_le -->
<h3 class="fn" id="qint64_le-typedef"><a name="qint64_le-typedef"></a>typedef <span class="name">qint64_le</span></h3>
<p>Typedef for <a href="qleinteger.html">QLEInteger</a><qint64>. This type is guaranteed to be stored in memory as a 64-bit little-endian signed integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#qint64-typedef">qint64</a>.</p>
<!-- @@@qint64_le -->
<!-- $$$quint16_be -->
<h3 class="fn" id="quint16_be-typedef"><a name="quint16_be-typedef"></a>typedef <span class="name">quint16_be</span></h3>
<p>Typedef for <a href="qbeinteger.html">QBEInteger</a><quint16>. This type is guaranteed to be stored in memory as a 16-bit big-endian unsigned integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#quint16-typedef">quint16</a>.</p>
<!-- @@@quint16_be -->
<!-- $$$quint16_le -->
<h3 class="fn" id="quint16_le-typedef"><a name="quint16_le-typedef"></a>typedef <span class="name">quint16_le</span></h3>
<p>Typedef for <a href="qleinteger.html">QLEInteger</a><quint16>. This type is guaranteed to be stored in memory as a 16-bit little-endian unsigned integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#quint16-typedef">quint16</a>.</p>
<!-- @@@quint16_le -->
<!-- $$$quint32_be -->
<h3 class="fn" id="quint32_be-typedef"><a name="quint32_be-typedef"></a>typedef <span class="name">quint32_be</span></h3>
<p>Typedef for <a href="qbeinteger.html">QBEInteger</a><quint32>. This type is guaranteed to be stored in memory as a 32-bit big-endian unsigned integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#quint32-typedef">quint32</a>.</p>
<!-- @@@quint32_be -->
<!-- $$$quint32_le -->
<h3 class="fn" id="quint32_le-typedef"><a name="quint32_le-typedef"></a>typedef <span class="name">quint32_le</span></h3>
<p>Typedef for <a href="qleinteger.html">QLEInteger</a><quint32>. This type is guaranteed to be stored in memory as a 32-bit little-endian unsigned integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#quint32-typedef">quint32</a>.</p>
<!-- @@@quint32_le -->
<!-- $$$quint64_be -->
<h3 class="fn" id="quint64_be-typedef"><a name="quint64_be-typedef"></a>typedef <span class="name">quint64_be</span></h3>
<p>Typedef for <a href="qbeinteger.html">QBEInteger</a><quint64>. This type is guaranteed to be stored in memory as a 64-bit big-endian unsigned integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#quint64-typedef">quint64</a>.</p>
<!-- @@@quint64_be -->
<!-- $$$quint64_le -->
<h3 class="fn" id="quint64_le-typedef"><a name="quint64_le-typedef"></a>typedef <span class="name">quint64_le</span></h3>
<p>Typedef for <a href="qleinteger.html">QLEInteger</a><quint64>. This type is guaranteed to be stored in memory as a 64-bit little-endian unsigned integer on all platforms supported by Qt.</p>
<p>This typedef was introduced in Qt 5.10.</p>
<p><b>See also </b><a href="qtglobal.html#quint64-typedef">quint64</a>.</p>
<!-- @@@quint64_le -->
<h2>Function Documentation</h2>
<!-- $$$qFromBigEndian[overload1]$$$qFromBigEndianT -->
<h3 class="fn" id="qFromBigEndian"><a name="qFromBigEndian"></a><span class="type">T</span> <span class="name">qFromBigEndian</span>(<span class="type">T</span> <i>src</i>)</h3>
<p>This is an overloaded function.</p>
<p>Converts <i>src</i> from big-endian byte order and returns the number in host byte order representation of that number. On CPU architectures where the host byte order is little-endian (such as x86) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p>
<p>This function was introduced in Qt 4.3.</p>
<!-- @@@qFromBigEndian -->
<!-- $$$qFromBigEndian[overload1]$$$qFromBigEndianconstvoid* -->
<h3 class="fn" id="qFromBigEndian"><a name="qFromBigEndian"></a><span class="type">T</span> <span class="name">qFromBigEndian</span>(const <span class="type">void</span> *<i>src</i>)</h3>
<p>Reads a big-endian number from memory location <i>src</i> and returns the number in the host byte order representation. On CPU architectures where the host byte order is little-endian (such as x86) this will swap the byte order; otherwise it will just read from <i>src</i>.</p>
<p><b>Note: </b>Template type <code>T</code> can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p><b>Note: </b>Since Qt 5.7, the type of the <i>src</i> parameter is a void pointer.</p><p>There are no data alignment constraints for <i>src</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p>
<!-- @@@qFromBigEndian -->
<!-- $$$qFromLittleEndian[overload1]$$$qFromLittleEndianT -->
<h3 class="fn" id="qFromLittleEndian"><a name="qFromLittleEndian"></a><span class="type">T</span> <span class="name">qFromLittleEndian</span>(<span class="type">T</span> <i>src</i>)</h3>
<p>This is an overloaded function.</p>
<p>Converts <i>src</i> from little-endian byte order and returns the number in host byte order representation of that number. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p>
<p>This function was introduced in Qt 4.3.</p>
<!-- @@@qFromLittleEndian -->
<!-- $$$qFromLittleEndian[overload1]$$$qFromLittleEndianconstvoid* -->
<h3 class="fn" id="qFromLittleEndian"><a name="qFromLittleEndian"></a><span class="type">T</span> <span class="name">qFromLittleEndian</span>(const <span class="type">void</span> *<i>src</i>)</h3>
<p>Reads a little-endian number from memory location <i>src</i> and returns the number in the host byte order representation. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will swap the byte order; otherwise it will just read from <i>src</i>.</p>
<p><b>Note: </b>Template type <code>T</code> can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p><b>Note: </b>Since Qt 5.7, the type of the <i>src</i> parameter is a void pointer.</p><p>There are no data alignment constraints for <i>src</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p>
<!-- @@@qFromLittleEndian -->
<!-- $$$qToBigEndian[overload1]$$$qToBigEndianT -->
<h3 class="fn" id="qToBigEndian"><a name="qToBigEndian"></a><span class="type">T</span> <span class="name">qToBigEndian</span>(<span class="type">T</span> <i>src</i>)</h3>
<p>This is an overloaded function.</p>
<p>Converts <i>src</i> from host byte order and returns the number in big-endian byte order representation of that number. On CPU architectures where the host byte order is little-endian (such as x86) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p>
<p>This function was introduced in Qt 4.3.</p>
<!-- @@@qToBigEndian -->
<!-- $$$qToBigEndian[overload1]$$$qToBigEndianTvoid* -->
<h3 class="fn" id="qToBigEndian"><a name="qToBigEndian"></a><span class="type">void</span> <span class="name">qToBigEndian</span>(<span class="type">T</span> <i>src</i>, <span class="type">void</span> *<i>dest</i>)</h3>
<p>Writes the number <i>src</i> with template type <code>T</code> to the memory location at <i>dest</i> in big-endian byte order.</p>
<p>Note that template type <code>T</code> can only be an integer data type (signed or unsigned).</p>
<p>There are no data alignment constraints for <i>dest</i>.</p>
<p><b>Note: </b>Since Qt 5.7, the type of the <i>dest</i> parameter is a void pointer.</p><p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a>(), <a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p>
<!-- @@@qToBigEndian -->
<!-- $$$qToLittleEndian[overload1]$$$qToLittleEndianT -->
<h3 class="fn" id="qToLittleEndian"><a name="qToLittleEndian"></a><span class="type">T</span> <span class="name">qToLittleEndian</span>(<span class="type">T</span> <i>src</i>)</h3>
<p>This is an overloaded function.</p>
<p>Converts <i>src</i> from host byte order and returns the number in little-endian byte order representation of that number. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p>
<p>This function was introduced in Qt 4.3.</p>
<!-- @@@qToLittleEndian -->
<!-- $$$qToLittleEndian[overload1]$$$qToLittleEndianTvoid* -->
<h3 class="fn" id="qToLittleEndian"><a name="qToLittleEndian"></a><span class="type">void</span> <span class="name">qToLittleEndian</span>(<span class="type">T</span> <i>src</i>, <span class="type">void</span> *<i>dest</i>)</h3>
<p>Writes the number <i>src</i> with template type <code>T</code> to the memory location at <i>dest</i> in little-endian byte order.</p>
<p>Note that template type <code>T</code> can only be an integer data type (signed or unsigned).</p>
<p>There are no data alignment constraints for <i>dest</i>.</p>
<p><b>Note: </b>Since Qt 5.7, the type of the <i>dest</i> parameter is a void pointer.</p><p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a>(), <a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), and <a href="qtendian.html#qToBigEndian">qToBigEndian</a>().</p>
<!-- @@@qToLittleEndian -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2018 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>