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