Eneboo - Documentación para desarrolladores
src/qt/src/tools/qdatastream.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qdatastream.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QDataStream class
00005 **
00006 ** Created : 930831
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the tools module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QDATASTREAM_H
00039 #define QDATASTREAM_H
00040 
00041 #ifndef QT_H
00042 #include "qiodevice.h"
00043 #include "qstring.h"
00044 #endif // QT_H
00045 
00046 #ifndef QT_NO_DATASTREAM
00047 class Q_EXPORT QDataStream                              // data stream class
00048 {
00049 public:
00050     QDataStream();
00051     QDataStream( QIODevice * );
00052     QDataStream( QByteArray, int mode );
00053     virtual ~QDataStream();
00054 
00055     QIODevice   *device() const;
00056     void         setDevice( QIODevice * );
00057     void         unsetDevice();
00058 
00059     bool         atEnd() const;
00060     bool         eof() const;
00061 
00062     enum ByteOrder { BigEndian, LittleEndian };
00063     int          byteOrder()    const;
00064     void         setByteOrder( int );
00065 
00066     bool         isPrintableData() const;
00067     void         setPrintableData( bool );
00068 
00069     int          version() const;
00070     void         setVersion( int );
00071 
00072     QDataStream &operator>>( Q_INT8 &i );
00073     QDataStream &operator>>( Q_UINT8 &i );
00074     QDataStream &operator>>( Q_INT16 &i );
00075     QDataStream &operator>>( Q_UINT16 &i );
00076     QDataStream &operator>>( Q_INT32 &i );
00077     QDataStream &operator>>( Q_UINT32 &i );
00078     QDataStream &operator>>( Q_INT64 &i );
00079     QDataStream &operator>>( Q_UINT64 &i );
00080 #if !defined(Q_OS_WIN64)
00081     QDataStream &operator>>( Q_LONG &i );
00082     QDataStream &operator>>( Q_ULONG &i );
00083 #endif
00084 
00085     QDataStream &operator>>( float &f );
00086     QDataStream &operator>>( double &f );
00087     QDataStream &operator>>( char *&str );
00088 
00089     QDataStream &operator<<( Q_INT8 i );
00090     QDataStream &operator<<( Q_UINT8 i );
00091     QDataStream &operator<<( Q_INT16 i );
00092     QDataStream &operator<<( Q_UINT16 i );
00093     QDataStream &operator<<( Q_INT32 i );
00094     QDataStream &operator<<( Q_UINT32 i );
00095     QDataStream &operator<<( Q_INT64 i );
00096     QDataStream &operator<<( Q_UINT64 i );
00097 #if !defined(Q_OS_WIN64)
00098     QDataStream &operator<<( Q_LONG i );
00099     QDataStream &operator<<( Q_ULONG i );
00100 #endif
00101     QDataStream &operator<<( float f );
00102     QDataStream &operator<<( double f );
00103     QDataStream &operator<<( const char *str );
00104 
00105     QDataStream &readBytes( char *&, uint &len );
00106     QDataStream &readRawBytes( char *, uint len );
00107 
00108     QDataStream &writeBytes( const char *, uint len );
00109     QDataStream &writeRawBytes( const char *, uint len );
00110 
00111 private:
00112     QIODevice   *dev;
00113     bool         owndev;
00114     int          byteorder;
00115     bool         printable;
00116     bool         noswap;
00117     int          ver;
00118 
00119 private:        // Disabled copy constructor and operator=
00120 #if defined(Q_DISABLE_COPY)
00121     QDataStream( const QDataStream & );
00122     QDataStream &operator=( const QDataStream & );
00123 #endif
00124 };
00125 
00126 
00127 /*****************************************************************************
00128   QDataStream inline functions
00129  *****************************************************************************/
00130 
00131 inline QIODevice *QDataStream::device() const
00132 { return dev; }
00133 
00134 inline bool QDataStream::atEnd() const
00135 { return dev ? dev->atEnd() : TRUE; }
00136 
00137 inline bool QDataStream::eof() const
00138 { return atEnd(); }
00139 
00140 inline int QDataStream::byteOrder() const
00141 { return byteorder; }
00142 
00143 inline bool QDataStream::isPrintableData() const
00144 { return printable; }
00145 
00146 inline void QDataStream::setPrintableData( bool p )
00147 { printable = p; }
00148 
00149 inline int QDataStream::version() const
00150 { return ver; }
00151 
00152 inline void QDataStream::setVersion( int v )
00153 { ver = v; }
00154 
00155 inline QDataStream &QDataStream::operator>>( Q_UINT8 &i )
00156 { return *this >> (Q_INT8&)i; }
00157 
00158 inline QDataStream &QDataStream::operator>>( Q_UINT16 &i )
00159 { return *this >> (Q_INT16&)i; }
00160 
00161 inline QDataStream &QDataStream::operator>>( Q_UINT32 &i )
00162 { return *this >> (Q_INT32&)i; }
00163 
00164 inline QDataStream &QDataStream::operator>>( Q_UINT64 &i )
00165 { return *this >> (Q_INT64&)i; }
00166 
00167 #if !defined(Q_OS_WIN64)
00168 inline QDataStream &QDataStream::operator>>( Q_ULONG &i )
00169 { return *this >> (Q_LONG&)i; }
00170 #endif
00171 
00172 inline QDataStream &QDataStream::operator<<( Q_UINT8 i )
00173 { return *this << (Q_INT8)i; }
00174 
00175 inline QDataStream &QDataStream::operator<<( Q_UINT16 i )
00176 { return *this << (Q_INT16)i; }
00177 
00178 inline QDataStream &QDataStream::operator<<( Q_UINT32 i )
00179 { return *this << (Q_INT32)i; }
00180 
00181 inline QDataStream &QDataStream::operator<<( Q_UINT64 i )
00182 { return *this << (Q_INT64)i; }
00183 
00184 #if !defined(Q_OS_WIN64)
00185 inline QDataStream &QDataStream::operator<<( Q_ULONG i )
00186 { return *this << (Q_LONG)i; }
00187 #endif
00188 
00189 #endif // QT_NO_DATASTREAM
00190 #endif // QDATASTREAM_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'