You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/datastreamformat.doc

249 lines
6.4 KiB

/****************************************************************************
**
** Documentation of the Format of the QDataStream operators
**
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the Qt GUI Toolkit.
**
** This file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the files LICENSE.GPL2
** and LICENSE.GPL3 included in the packaging of this file.
** Alternatively you may (at your option) use any later version
** of the GNU General Public License if such license has been
** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free Qt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** This file may be used under the terms of the Q Public License as
** defined by Trolltech ASA and appearing in the file LICENSE.QPL
** included in the packaging of this file. Licensees holding valid Qt
** Commercial licenses may use this file in accordance with the Qt
** Commercial License Agreement provided with the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/
/*!
\page datastreamformat.html
\title Format of the QDataStream Operators
The \l QDataStream allows you to serialize some of the Qt data types.
The table below lists the data types that QDataStream can serialize
and how they are represented.
It is best to always cast integers to a Qt integer type when writing,
and to read back into the same Qt integer type when reading.
\table
\row \i Q_INT8
\i \list
\i signed byte
\endlist
\row \i Q_INT16
\i \list
\i signed 16 bit integer
\endlist
\row \i Q_INT32
\i \list
\i signed 32 bit integer
\endlist
\row \i Q_UINT8
\i \list
\i unsigned byte
\endlist
\row \i Q_UINT16
\i \list
\i unsigned 16 bit integer
\endlist
\row \i Q_UINT32
\i \list
\i unsigned 32 bit integer
\endlist
\row \i float
\i \list
\i 32-bit floating point number using the standard IEEE-754 format
\endlist
\row \i double
\i \list
\i 64-bit floating point number using the standard IEEE-754 format
\endlist
\row \i char *
\i \list
\i The size of the string including the terminating 0 (Q_UINT32)
\i The string bytes including the terminating 0
\endlist
The null string is represented as \c {(Q_UINT32) 0}.
\row \i QBitArray
\i \list
\i The array size (Q_UINT32)
\i The array bits, i.e. (size + 7)/8 bytes
\endlist
\row \i QBrush
\i \list
\i The brush style (Q_UINT8)
\i The brush color (QColor)
\i If style is CustomPattern, the brush pixmap (QPixmap)
\endlist
\row \i QByteArray
\i \list
\i The array size (Q_UINT32)
\i The array bytes, i.e. size bytes
\endlist
\row \i QCString
\i \list
\i The size of the string including the terminating 0 (Q_UINT32)
\i The string bytes including the terminating 0
\endlist
The null string is represented as \c {(Q_UINT32) 0}.
\row \i \l QColor
\i \list \i RGB value serialized as a Q_UINT32 \endlist
\row \i QColorGroup
\i \list
\i foreground (QBrush)
\i button (QBrush)
\i light (QBrush)
\i midLight (QBrush)
\i dark (QBrush)
\i mid (QBrush)
\i text (QBrush)
\i brightText (QBrush)
\i ButtonText (QBrush)
\i base (QBrush)
\i background (QBrush)
\i shadow (QBrush)
\i highlight (QBrush)
\i highlightedText (QBrush)
\endlist
\row \i QCursor
\i \list
\i Shape id (Q_INT16)
\i If shape is BitmapCursor: The bitmap (QPixmap), mask (QPixmap) and hot spot (QPoint)
\endlist
\row \i QDate
\i \list
\i Julian day (Q_UINT32)
\endlist
\row \i QDateTime
\i \list
\i Date (QDate)
\i Time (QTime)
\endlist
\row \i QFont
\i \list
\i The family (QCString)
\i The point size (Q_INT16)
\i The style hint (Q_UINT8)
\i The char set (Q_UINT8)
\i The weight (Q_UINT8)
\i The font bits (Q_UINT8)
\endlist
\row \i QImage
\i \list
\i If the image is null a "null image" marker is saved;
otherwise the image is saved in PNG or BMP format (depending
on the stream version). If you want control of the format,
stream the image into a QBuffer (using QImageIO) and stream
that.
\endlist
\row \i QMap
\i \list
\i The number of items (Q_UINT32)
\i For all items, the key and value
\endlist
\row \i QPalette
\i \list
\i active (QColorGroup)
\i disabled (QColorGroup)
\i inactive (QColorGroup)
\endlist
\row \i QPen
\i \list
\i The pen styles (Q_UINT8)
\i The pen width (Q_UINT8)
\i The pen color (QColor)
\endlist
\row \i QPicture
\i \list
\i The size of the picture data (Q_UINT32)
\i The raw bytes of picture data (char)
\endlist
\row \i QPixmap
\i \list
\i Save it as a PNG image.
\endlist
\row \i QPoint
\i \list
\i The x coordinate (Q_INT32)
\i The y coordinate (Q_INT32)
\endlist
\row \i QPointArray
\i \list
\i The array size (Q_UINT32)
\i The array points (QPoint)
\endlist
\row \i QRect
\i \list
\i left (Q_INT32)
\i top (Q_INT32)
\i right (Q_INT32)
\i bottom (Q_INT32)
\endlist
\row \i QRegion
\i \list
\i The size of the data, i.e. 8 + 16 * (number of rectangles) (Q_UINT32)
\i QRGN_RECTS (Q_INT32)
\i The number of rectangles (Q_UINT32)
\i The rectangles in sequential order (QRect)
\endlist
\row \i QSize
\i \list
\i width (Q_INT32)
\i height (Q_INT32)
\endlist
\row \i QString
\i \list
\i If the string is null: 0xffffffff (Q_UINT32)<br>
otherwise: The string length (Q_UINT32) followed by the
data in UTF-16
\endlist
\row \i QTime
\i \list
\i Milliseconds since midnight (Q_UINT32)
\endlist
\row \i QValueList
\i \list
\i The number of list elements (Q_UINT32)
\i All the elements in sequential order
\endlist
\row \i QVariant
\i \list
\i The type of the data (Q_UINT32)
\i The data of the specified type
\endlist
\row \i QWMatrix
\i \list
\i m11 (double)
\i m12 (double)
\i m21 (double)
\i m22 (double)
\i dx (double)
\i dy (double)
\endlist
\endtable
*/