| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the documentation of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | /**************************************************************************** | 
|---|
| 43 | ** | 
|---|
| 44 | ** Documentation of the Format of the QDataStream operators. | 
|---|
| 45 | ** | 
|---|
| 46 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 47 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 48 | ** | 
|---|
| 49 | ** This file is part of the Qt GUI Toolkit. | 
|---|
| 50 | ** EDITIONS: FREE, PROFESSIONAL, ENTERPRISE | 
|---|
| 51 | ** | 
|---|
| 52 | ****************************************************************************/ | 
|---|
| 53 |  | 
|---|
| 54 | /*! | 
|---|
| 55 | \page datastreamformat.html | 
|---|
| 56 | \title Format of the QDataStream Operators | 
|---|
| 57 | \ingroup architecture | 
|---|
| 58 | \brief Representations of data types that can be serialized by QDataStream. | 
|---|
| 59 |  | 
|---|
| 60 | The \l QDataStream allows you to serialize some of the Qt data types. | 
|---|
| 61 | The table below lists the data types that QDataStream can serialize | 
|---|
| 62 | and how they are represented. The format described below is | 
|---|
| 63 | \l{QDataStream::setVersion()}{version 8}. | 
|---|
| 64 |  | 
|---|
| 65 | It is always best to cast integers to a Qt integer type, such as | 
|---|
| 66 | qint16 or quint32, when reading and writing. This ensures that | 
|---|
| 67 | you always know exactly what size integers you are reading and | 
|---|
| 68 | writing, no matter what the underlying platform and architecture | 
|---|
| 69 | the application happens to be running on. | 
|---|
| 70 |  | 
|---|
| 71 | \table | 
|---|
| 72 | \row \o qint8 | 
|---|
| 73 | \o \list | 
|---|
| 74 | \o signed byte | 
|---|
| 75 | \endlist | 
|---|
| 76 | \row \o qint16 | 
|---|
| 77 | \o \list | 
|---|
| 78 | \o signed 16-bit integer | 
|---|
| 79 | \endlist | 
|---|
| 80 | \row \o qint32 | 
|---|
| 81 | \o \list | 
|---|
| 82 | \o signed 32-bit integer | 
|---|
| 83 | \endlist | 
|---|
| 84 | \row \o qint64 | 
|---|
| 85 | \o \list | 
|---|
| 86 | \o signed 64-bit integer | 
|---|
| 87 | \endlist | 
|---|
| 88 | \row \o quint8 | 
|---|
| 89 | \o \list | 
|---|
| 90 | \o unsigned byte | 
|---|
| 91 | \endlist | 
|---|
| 92 | \row \o quint16 | 
|---|
| 93 | \o \list | 
|---|
| 94 | \o unsigned 16-bit integer | 
|---|
| 95 | \endlist | 
|---|
| 96 | \row \o quint32 | 
|---|
| 97 | \o \list | 
|---|
| 98 | \o unsigned 32-bit integer | 
|---|
| 99 | \endlist | 
|---|
| 100 | \row \o quint64 | 
|---|
| 101 | \o \list | 
|---|
| 102 | \o unsigned 64-bit integer | 
|---|
| 103 | \endlist | 
|---|
| 104 | \row \o \c float | 
|---|
| 105 | \o \list | 
|---|
| 106 | \o 32-bit floating point number using the standard IEEE 754 format | 
|---|
| 107 | \endlist | 
|---|
| 108 | \row \o \c double | 
|---|
| 109 | \o \list | 
|---|
| 110 | \o 64-bit floating point number using the standard IEEE 754 format | 
|---|
| 111 | \endlist | 
|---|
| 112 | \row \o \c {const char *} | 
|---|
| 113 | \o \list | 
|---|
| 114 | \o The string length (quint32) | 
|---|
| 115 | \o The string bytes, excluding the terminating 0 | 
|---|
| 116 | \endlist | 
|---|
| 117 | \row \o QBitArray | 
|---|
| 118 | \o \list | 
|---|
| 119 | \o The array size (quint32) | 
|---|
| 120 | \o The array bits, i.e. (size + 7)/8 bytes | 
|---|
| 121 | \endlist | 
|---|
| 122 | \row \o QBrush | 
|---|
| 123 | \o \list | 
|---|
| 124 | \o The brush style (quint8) | 
|---|
| 125 | \o The brush color (QColor) | 
|---|
| 126 | \o If style is CustomPattern, the brush pixmap (QPixmap) | 
|---|
| 127 | \endlist | 
|---|
| 128 | \row \o QByteArray | 
|---|
| 129 | \o \list | 
|---|
| 130 | \o If the byte array is null: 0xFFFFFFFF (quint32) | 
|---|
| 131 | \o Otherwise: the array size (quint32) followed by the array bytes, i.e. size bytes | 
|---|
| 132 | \endlist | 
|---|
| 133 | \row \o \l QColor | 
|---|
| 134 | \o \list | 
|---|
| 135 | \o Color spec (qint8) | 
|---|
| 136 | \o Alpha value (quint16) | 
|---|
| 137 | \o Red value (quint16) | 
|---|
| 138 | \o Green value (quint16) | 
|---|
| 139 | \o Blue value (quint16) | 
|---|
| 140 | \o Pad value (quint16) | 
|---|
| 141 | \endlist | 
|---|
| 142 | \row \o QCursor | 
|---|
| 143 | \o \list | 
|---|
| 144 | \o Shape ID (qint16) | 
|---|
| 145 | \o If shape is BitmapCursor: The bitmap (QPixmap), mask (QPixmap), and hot spot (QPoint) | 
|---|
| 146 | \endlist | 
|---|
| 147 | \row \o QDate | 
|---|
| 148 | \o \list | 
|---|
| 149 | \o Julian day (quint32) | 
|---|
| 150 | \endlist | 
|---|
| 151 | \row \o QDateTime | 
|---|
| 152 | \o \list | 
|---|
| 153 | \o Date (QDate) | 
|---|
| 154 | \o Time (QTime) | 
|---|
| 155 | \o 0 for Qt::LocalTime, 1 for Qt::UTC (quint8) | 
|---|
| 156 | \endlist | 
|---|
| 157 | \row \o QFont | 
|---|
| 158 | \o \list | 
|---|
| 159 | \o The family (QString) | 
|---|
| 160 | \o The point size (qint16) | 
|---|
| 161 | \o The style hint (quint8) | 
|---|
| 162 | \o The char set (quint8) | 
|---|
| 163 | \o The weight (quint8) | 
|---|
| 164 | \o The font bits (quint8) | 
|---|
| 165 | \endlist | 
|---|
| 166 | \row \o QHash<Key, T> | 
|---|
| 167 | \o \list | 
|---|
| 168 | \o The number of items (quint32) | 
|---|
| 169 | \o For all items, the key (Key) and value (T) | 
|---|
| 170 | \endlist | 
|---|
| 171 | \row \o QIcon | 
|---|
| 172 | \o \list | 
|---|
| 173 | \o The number of pixmap entries (quint32) | 
|---|
| 174 | \o For all pixmap entries: | 
|---|
| 175 | \list | 
|---|
| 176 | \o The pixmap (QPixmap) | 
|---|
| 177 | \o The file name (QString) | 
|---|
| 178 | \o The pixmap size (QSize) | 
|---|
| 179 | \o The \l{QIcon::Mode}{mode} (quint32) | 
|---|
| 180 | \o The \l{QIcon::State}{state} (quint32) | 
|---|
| 181 | \endlist | 
|---|
| 182 | \endlist | 
|---|
| 183 | \row \o QImage | 
|---|
| 184 | \o \list | 
|---|
| 185 | \o If the image is null a "null image" marker is saved; | 
|---|
| 186 | otherwise the image is saved in PNG or BMP format (depending | 
|---|
| 187 | on the stream version). If you want control of the format, | 
|---|
| 188 | stream the image into a QBuffer (using QImageIO) and stream | 
|---|
| 189 | that. | 
|---|
| 190 | \endlist | 
|---|
| 191 | \row \o QKeySequence | 
|---|
| 192 | \o \list | 
|---|
| 193 | \o A QList<int>, where each integer is a key in the key sequence | 
|---|
| 194 | \endlist | 
|---|
| 195 | \row \o QLinkedList<T> | 
|---|
| 196 | \o \list | 
|---|
| 197 | \o The number of items (quint32) | 
|---|
| 198 | \o The items (T) | 
|---|
| 199 | \endlist | 
|---|
| 200 | \row \o QList<T> | 
|---|
| 201 | \o \list | 
|---|
| 202 | \o The number of items (quint32) | 
|---|
| 203 | \o The items (T) | 
|---|
| 204 | \endlist | 
|---|
| 205 | \row \o QMap<Key, T> | 
|---|
| 206 | \o \list | 
|---|
| 207 | \o The number of items (quint32) | 
|---|
| 208 | \o For all items, the key (Key) and value (T) | 
|---|
| 209 | \endlist | 
|---|
| 210 | \row \o QMatrix | 
|---|
| 211 | \o \list | 
|---|
| 212 | \o m11 (double) | 
|---|
| 213 | \o m12 (double) | 
|---|
| 214 | \o m21 (double) | 
|---|
| 215 | \o m22 (double) | 
|---|
| 216 | \o dx (double) | 
|---|
| 217 | \o dy (double) | 
|---|
| 218 | \endlist | 
|---|
| 219 | \row \o QPair<T1, T2> | 
|---|
| 220 | \o \list | 
|---|
| 221 | \o first (T1) | 
|---|
| 222 | \o second (T2) | 
|---|
| 223 | \endlist | 
|---|
| 224 | \row \o QPalette | 
|---|
| 225 | \o The disabled, active, and inactive color groups, each of which consists | 
|---|
| 226 | of the following: | 
|---|
| 227 | \list | 
|---|
| 228 | \o foreground (QBrush) | 
|---|
| 229 | \o button (QBrush) | 
|---|
| 230 | \o light (QBrush) | 
|---|
| 231 | \o midlight (QBrush) | 
|---|
| 232 | \o dark (QBrush) | 
|---|
| 233 | \o mid (QBrush) | 
|---|
| 234 | \o text (QBrush) | 
|---|
| 235 | \o brightText (QBrush) | 
|---|
| 236 | \o buttonText (QBrush) | 
|---|
| 237 | \o base (QBrush) | 
|---|
| 238 | \o background (QBrush) | 
|---|
| 239 | \o shadow (QBrush) | 
|---|
| 240 | \o highlight (QBrush) | 
|---|
| 241 | \o highlightedText (QBrush) | 
|---|
| 242 | \o link (QBrush) | 
|---|
| 243 | \o linkVisited (QBrush) | 
|---|
| 244 | \endlist | 
|---|
| 245 | \row \o QPen | 
|---|
| 246 | \o \list | 
|---|
| 247 | \o The pen styles (quint8) | 
|---|
| 248 | \o The pen width (quint16) | 
|---|
| 249 | \o The pen color (QColor) | 
|---|
| 250 | \endlist | 
|---|
| 251 | \row \o QPicture | 
|---|
| 252 | \o \list | 
|---|
| 253 | \o The size of the picture data (quint32) | 
|---|
| 254 | \o The raw bytes of picture data (char) | 
|---|
| 255 | \endlist | 
|---|
| 256 | \row \o QPixmap | 
|---|
| 257 | \o \list | 
|---|
| 258 | \o Save it as a PNG image. | 
|---|
| 259 | \endlist | 
|---|
| 260 | \row \o QPoint | 
|---|
| 261 | \o \list | 
|---|
| 262 | \o The x coordinate (qint32) | 
|---|
| 263 | \o The y coordinate (qint32) | 
|---|
| 264 | \endlist | 
|---|
| 265 | \row \o QRect | 
|---|
| 266 | \o \list | 
|---|
| 267 | \o left (qint32) | 
|---|
| 268 | \o top (qint32) | 
|---|
| 269 | \o right (qint32) | 
|---|
| 270 | \o bottom (qint32) | 
|---|
| 271 | \endlist | 
|---|
| 272 | \row \o QRegExp | 
|---|
| 273 | \o \list | 
|---|
| 274 | \o The regexp pattern (QString) | 
|---|
| 275 | \o Case sensitivity (quint8) | 
|---|
| 276 | \o Regular expression syntax (quint8) | 
|---|
| 277 | \o Minimal matching (quint8) | 
|---|
| 278 | \endlist | 
|---|
| 279 | \row \o QRegion | 
|---|
| 280 | \o \list | 
|---|
| 281 | \o The size of the data, i.e. 8 + 16 * (number of rectangles) (quint32) | 
|---|
| 282 | \o 10 (qint32) | 
|---|
| 283 | \o The number of rectangles (quint32) | 
|---|
| 284 | \o The rectangles in sequential order (QRect) | 
|---|
| 285 | \endlist | 
|---|
| 286 | \row \o QSize | 
|---|
| 287 | \o \list | 
|---|
| 288 | \o width (qint32) | 
|---|
| 289 | \o height (qint32) | 
|---|
| 290 | \endlist | 
|---|
| 291 | \row \o QString | 
|---|
| 292 | \o \list | 
|---|
| 293 | \o If the string is null: 0xFFFFFFFF (quint32) | 
|---|
| 294 | \o Otherwise: The string length in bytes (quint32) followed by the data in UTF-16 | 
|---|
| 295 | \endlist | 
|---|
| 296 | \row \o QTime | 
|---|
| 297 | \o \list | 
|---|
| 298 | \o Milliseconds since midnight (quint32) | 
|---|
| 299 | \endlist | 
|---|
| 300 | \row \o QVariant | 
|---|
| 301 | \o \list | 
|---|
| 302 | \o The type of the data (quint32) | 
|---|
| 303 | \o The null flag (qint8) | 
|---|
| 304 | \o The data of the specified type | 
|---|
| 305 | \endlist | 
|---|
| 306 | \row \o QVector<T> | 
|---|
| 307 | \o \list | 
|---|
| 308 | \o The number of items (quint32) | 
|---|
| 309 | \o The items (T) | 
|---|
| 310 | \endlist | 
|---|
| 311 | \endtable | 
|---|
| 312 | */ | 
|---|