Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/qtools/qdatastream.h

Source at commit 1322 created 9 years 5 months ago.
By meklort, Add doxygen to utils folder
1/****************************************************************************
2**
3**
4** Definition of QDataStream class
5**
6** Created : 930831
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the tools module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QDATASTREAM_H
39#define QDATASTREAM_H
40
41#ifndef QT_H
42#include "qiodevice.h"
43#include "qstring.h"
44#endif // QT_H
45
46#ifndef QT_NO_DATASTREAM
47class Q_EXPORT QDataStream// data stream class
48{
49public:
50 QDataStream();
51 QDataStream( QIODevice * );
52 QDataStream( QByteArray, int mode );
53 virtual ~QDataStream();
54
55 QIODevice*device() const;
56 void setDevice( QIODevice * );
57 void unsetDevice();
58
59 bool atEnd() const;
60 bool eof() const;
61
62 enum ByteOrder { BigEndian, LittleEndian };
63 int byteOrder()const;
64 void setByteOrder( int );
65
66 bool isPrintableData() const;
67 void setPrintableData( bool );
68
69 int version() const;
70 void setVersion( int );
71
72 QDataStream &operator>>( Q_INT8 &i );
73 QDataStream &operator>>( Q_UINT8 &i );
74 QDataStream &operator>>( Q_INT16 &i );
75 QDataStream &operator>>( Q_UINT16 &i );
76 QDataStream &operator>>( Q_INT32 &i );
77 QDataStream &operator>>( Q_UINT32 &i );
78 QDataStream &operator>>( Q_INT64 &i );
79 QDataStream &operator>>( Q_UINT64 &i );
80
81 QDataStream &operator>>( float &f );
82 QDataStream &operator>>( double &f );
83 QDataStream &operator>>( char *&str );
84
85 QDataStream &operator<<( Q_INT8 i );
86 QDataStream &operator<<( Q_UINT8 i );
87 QDataStream &operator<<( Q_INT16 i );
88 QDataStream &operator<<( Q_UINT16 i );
89 QDataStream &operator<<( Q_INT32 i );
90 QDataStream &operator<<( Q_UINT32 i );
91 QDataStream &operator<<( Q_INT64 i );
92 QDataStream &operator<<( Q_UINT64 i );
93 QDataStream &operator<<( float f );
94 QDataStream &operator<<( double f );
95 QDataStream &operator<<( const char *str );
96
97 QDataStream &readBytes( char *&, uint &len );
98 QDataStream &readRawBytes( char *, uint len );
99
100 QDataStream &writeBytes( const char *, uint len );
101 QDataStream &writeRawBytes( const char *, uint len );
102
103private:
104 QIODevice*dev;
105 bool owndev;
106 int byteorder;
107 bool printable;
108 bool noswap;
109 int ver;
110
111private:// Disabled copy constructor and operator=
112#if defined(Q_DISABLE_COPY)
113 QDataStream( const QDataStream & );
114 QDataStream &operator=( const QDataStream & );
115#endif
116};
117
118
119/*****************************************************************************
120 QDataStream inline functions
121 *****************************************************************************/
122
123inline QIODevice *QDataStream::device() const
124{ return dev; }
125
126inline bool QDataStream::atEnd() const
127{ return dev ? dev->atEnd() : TRUE; }
128
129inline bool QDataStream::eof() const
130{ return atEnd(); }
131
132inline int QDataStream::byteOrder() const
133{ return byteorder; }
134
135inline bool QDataStream::isPrintableData() const
136{ return printable; }
137
138inline void QDataStream::setPrintableData( bool p )
139{ printable = p; }
140
141inline int QDataStream::version() const
142{ return ver; }
143
144inline void QDataStream::setVersion( int v )
145{ ver = v; }
146
147inline QDataStream &QDataStream::operator>>( Q_UINT8 &i )
148{ return *this >> (Q_INT8&)i; }
149
150inline QDataStream &QDataStream::operator>>( Q_UINT16 &i )
151{ return *this >> (Q_INT16&)i; }
152
153inline QDataStream &QDataStream::operator>>( Q_UINT32 &i )
154{ return *this >> (Q_INT32&)i; }
155
156inline QDataStream &QDataStream::operator>>( Q_UINT64 &i )
157{ return *this >> (Q_INT64&)i; }
158
159inline QDataStream &QDataStream::operator<<( Q_UINT8 i )
160{ return *this << (Q_INT8)i; }
161
162inline QDataStream &QDataStream::operator<<( Q_UINT16 i )
163{ return *this << (Q_INT16)i; }
164
165inline QDataStream &QDataStream::operator<<( Q_UINT32 i )
166{ return *this << (Q_INT32)i; }
167
168inline QDataStream &QDataStream::operator<<( Q_UINT64 i )
169{ return *this << (Q_INT64)i; }
170
171
172#endif // QT_NO_DATASTREAM
173#endif // QDATASTREAM_H
174

Archive Download this file

Revision: 1322