source: trunk/doc/html/qiodevice-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 7.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qiodevice.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>qiodevice.h Include File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qiodevice.h</h1>
33
34<p>This is the verbatim text of the qiodevice.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/****************************************************************************
38** $Id: qiodevice-h.html 2051 2007-02-21 10:04:20Z chehrlic $
39**
40** Definition of QIODevice class
41**
42** Created : 940913
43**
44** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
45**
46** This file is part of the tools module of the Qt GUI Toolkit.
47**
48** This file may be distributed under the terms of the Q Public License
49** as defined by Trolltech ASA of Norway and appearing in the file
50** LICENSE.QPL included in the packaging of this file.
51**
52** This file may be distributed and/or modified under the terms of the
53** GNU General Public License version 2 as published by the Free Software
54** Foundation and appearing in the file LICENSE.GPL included in the
55** packaging of this file.
56**
57** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
58** licenses may use this file in accordance with the Qt Commercial License
59** Agreement provided with the Software.
60**
61** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
62** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63**
64** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
65** information about Qt Commercial License Agreements.
66** See http://www.trolltech.com/qpl/ for QPL licensing information.
67** See http://www.trolltech.com/gpl/ for GPL licensing information.
68**
69** Contact info@trolltech.com if any conditions of this licensing are
70** not clear to you.
71**
72**********************************************************************/
73
74#ifndef QIODEVICE_H
75#define QIODEVICE_H
76
77#ifndef QT_H
78#include "qglobal.h"
79#include "qcstring.h"
80#endif // QT_H
81
82
83// IO device access types
84
85#define IO_Direct 0x0100 // direct access device
86#define IO_Sequential 0x0200 // sequential access device
87#define IO_Combined 0x0300 // combined direct/sequential
88#define IO_TypeMask 0x0f00
89
90// IO handling modes
91
92#define IO_Raw 0x0040 // raw access (not buffered)
93#define IO_Async 0x0080 // asynchronous mode
94
95// IO device open modes
96
97#define IO_ReadOnly 0x0001 // readable device
98#define IO_WriteOnly 0x0002 // writable device
99#define IO_ReadWrite 0x0003 // read+write device
100#define IO_Append 0x0004 // append
101#define IO_Truncate 0x0008 // truncate device
102#define IO_Translate 0x0010 // translate CR+LF
103#define IO_ModeMask 0x00ff
104
105// IO device state
106
107#define IO_Open 0x1000 // device is open
108#define IO_StateMask 0xf000
109
110// IO device status
111
112#define IO_Ok 0
113#define IO_ReadError 1 // read error
114#define IO_WriteError 2 // write error
115#define IO_FatalError 3 // fatal unrecoverable error
116#define IO_ResourceError 4 // resource limitation
117#define IO_OpenError 5 // cannot open device
118#define IO_ConnectError 5 // cannot connect to device
119#define IO_AbortError 6 // abort error
120#define IO_TimeOutError 7 // time out
121#define IO_UnspecifiedError 8 // unspecified error
122
123
124class Q_EXPORT QIODevice
125{
126public:
127#if defined(QT_ABI_QT4)
128 typedef Q_LLONG Offset;
129#else
130 typedef Q_ULONG Offset;
131#endif
132
133 QIODevice();
134 virtual ~QIODevice();
135
136 int flags() const { return ioMode; }
137 int mode() const { return ioMode &amp; IO_ModeMask; }
138 int state() const { return ioMode &amp; IO_StateMask; }
139
140 bool isDirectAccess() const { return ((ioMode &amp; IO_Direct) == IO_Direct); }
141 bool isSequentialAccess() const { return ((ioMode &amp; IO_Sequential) == IO_Sequential); }
142 bool isCombinedAccess() const { return ((ioMode &amp; IO_Combined) == IO_Combined); }
143 bool isBuffered() const { return ((ioMode &amp; IO_Raw) != IO_Raw); }
144 bool isRaw() const { return ((ioMode &amp; IO_Raw) == IO_Raw); }
145 bool isSynchronous() const { return ((ioMode &amp; IO_Async) != IO_Async); }
146 bool isAsynchronous() const { return ((ioMode &amp; IO_Async) == IO_Async); }
147 bool isTranslated() const { return ((ioMode &amp; IO_Translate) == IO_Translate); }
148 bool isReadable() const { return ((ioMode &amp; IO_ReadOnly) == IO_ReadOnly); }
149 bool isWritable() const { return ((ioMode &amp; IO_WriteOnly) == IO_WriteOnly); }
150 bool isReadWrite() const { return ((ioMode &amp; IO_ReadWrite) == IO_ReadWrite); }
151 bool isInactive() const { return state() == 0; }
152 bool isOpen() const { return state() == IO_Open; }
153
154 int status() const { return ioSt; }
155 void resetStatus() { ioSt = IO_Ok; }
156
157 virtual bool open( int mode ) = 0;
158 virtual void close() = 0;
159 virtual void flush() = 0;
160
161 virtual Offset size() const = 0;
162 virtual Offset at() const;
163 virtual bool at( Offset );
164 virtual bool atEnd() const;
165 bool reset() { return at(0); }
166
167 virtual Q_LONG readBlock( char *data, Q_ULONG maxlen ) = 0;
168 virtual Q_LONG writeBlock( const char *data, Q_ULONG len ) = 0;
169 virtual Q_LONG readLine( char *data, Q_ULONG maxlen );
170 Q_LONG writeBlock( const QByteArray&amp; data );
171 virtual QByteArray readAll();
172
173 virtual int getch() = 0;
174 virtual int putch( int ) = 0;
175 virtual int ungetch( int ) = 0;
176
177protected:
178 void setFlags( int f ) { ioMode = f; }
179 void setType( int );
180 void setMode( int );
181 void setState( int );
182 void setStatus( int );
183 Offset ioIndex;
184
185private:
186 int ioMode;
187 int ioSt;
188
189private: // Disabled copy constructor and operator=
190#if defined(Q_DISABLE_COPY)
191 QIODevice( const QIODevice &amp; );
192 QIODevice &amp;operator=( const QIODevice &amp; );
193#endif
194};
195
196
197#endif // QIODEVICE_H
198</pre>
199<!-- eof -->
200<p><address><hr><div align=center>
201<table width=100% cellspacing=0 border=0><tr>
202<td>Copyright &copy; 2007
203<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
204<td align=right><div align=right>Qt 3.3.8</div>
205</table></div></address></body>
206</html>
Note: See TracBrowser for help on using the repository browser.