46 #include <QtCore/qobject.h> 48 #include <QtCore/qobjectdefs.h> 49 #include <QtCore/qscopedpointer.h> 51 #include <QtCore/qstring.h> 54 #error qiodevice.h must be included before any header file that defines open 79 ReadWrite = ReadOnly | WriteOnly,
93 OpenMode openMode()
const;
95 void setTextModeEnabled(
bool enabled);
96 bool isTextModeEnabled()
const;
99 bool isReadable()
const;
100 bool isWritable()
const;
101 virtual bool isSequential()
const;
103 virtual bool open(OpenMode mode);
104 virtual void close();
108 virtual qint64 pos()
const;
109 virtual qint64 size()
const;
110 virtual bool seek(
qint64 pos);
111 virtual bool atEnd()
const;
112 virtual bool reset();
114 virtual qint64 bytesAvailable()
const;
115 virtual qint64 bytesToWrite()
const;
122 virtual bool canReadLine()
const;
132 virtual bool waitForReadyRead(
int msecs);
133 virtual bool waitForBytesWritten(
int msecs);
135 void ungetChar(
char c);
136 bool putChar(
char c);
141 #ifndef QT_NO_QOBJECT 144 void bytesWritten(
qint64 bytes);
146 void readChannelFinished();
157 virtual qint64 writeData(
const char *data,
qint64 len) = 0;
159 void setOpenMode(OpenMode openMode);
161 void setErrorString(
const QString &errorString);
175 inline QT3_SUPPORT
int flags()
const {
return static_cast<int>(openMode()); }
176 inline QT3_SUPPORT
int mode()
const {
return static_cast<int>(openMode()); }
177 inline QT3_SUPPORT
int state()
const;
179 inline QT3_SUPPORT
bool isDirectAccess()
const {
return !isSequential(); }
180 inline QT3_SUPPORT
bool isSequentialAccess()
const {
return isSequential(); }
181 inline QT3_SUPPORT
bool isCombinedAccess()
const {
return false; }
182 inline QT3_SUPPORT
bool isBuffered()
const {
return true; }
183 inline QT3_SUPPORT
bool isRaw()
const {
return false; }
184 inline QT3_SUPPORT
bool isSynchronous()
const {
return true; }
185 inline QT3_SUPPORT
bool isAsynchronous()
const {
return false; }
186 inline QT3_SUPPORT
bool isTranslated()
const {
return (openMode() &
Text) != 0; }
187 inline QT3_SUPPORT
bool isInactive()
const {
return !isOpen(); }
190 QT3_SUPPORT Status
status()
const;
191 QT3_SUPPORT
void resetStatus();
193 inline QT3_SUPPORT Offset
at()
const {
return pos(); }
194 inline QT3_SUPPORT
bool at(Offset offset) {
return seek(offset); }
196 inline QT3_SUPPORT
qint64 readBlock(
char *data,
quint64 maxlen) {
return read(data, maxlen); }
197 inline QT3_SUPPORT
qint64 writeBlock(
const char *data,
quint64 len) {
return write(data, len); }
198 inline QT3_SUPPORT
qint64 writeBlock(
const QByteArray &data) {
return write(data); }
200 inline QT3_SUPPORT
int getch() {
char c;
return getChar(&c) ? int(
uchar(c)) : -1; }
201 inline QT3_SUPPORT
int putch(
int c) {
return putChar(
char(c)) ? int(
uchar(c)) : -1; }
202 inline QT3_SUPPORT
int ungetch(
int c) { ungetChar(
uchar(c));
return c; }
209 static QT3_SUPPORT_VARIABLE
const uint IO_Direct = 0x0100;
210 static QT3_SUPPORT_VARIABLE
const uint IO_Sequential = 0x0200;
211 static QT3_SUPPORT_VARIABLE
const uint IO_Combined = 0x0300;
212 static QT3_SUPPORT_VARIABLE
const uint IO_TypeMask = 0x0300;
214 static QT3_SUPPORT_VARIABLE
const uint IO_Raw = 0x0000;
215 static QT3_SUPPORT_VARIABLE
const uint IO_Async = 0x0000;
217 #define IO_ReadOnly QIODevice::ReadOnly 218 #define IO_WriteOnly QIODevice::WriteOnly 219 #define IO_ReadWrite QIODevice::ReadWrite 220 #define IO_Append QIODevice::Append 221 #define IO_Truncate QIODevice::Truncate 222 #define IO_Translate QIODevice::Text 223 #define IO_ModeMask 0x00ff 225 static QT3_SUPPORT_VARIABLE
const uint IO_Open = 0x1000;
226 static QT3_SUPPORT_VARIABLE
const uint IO_StateMask = 0xf000;
228 static QT3_SUPPORT_VARIABLE
const uint IO_Ok = 0;
229 static QT3_SUPPORT_VARIABLE
const uint IO_ReadError = 1;
230 static QT3_SUPPORT_VARIABLE
const uint IO_WriteError = 2;
231 static QT3_SUPPORT_VARIABLE
const uint IO_FatalError = 3;
232 static QT3_SUPPORT_VARIABLE
const uint IO_ResourceError = 4;
233 static QT3_SUPPORT_VARIABLE
const uint IO_OpenError = 5;
234 static QT3_SUPPORT_VARIABLE
const uint IO_ConnectError = 5;
235 static QT3_SUPPORT_VARIABLE
const uint IO_AbortError = 6;
236 static QT3_SUPPORT_VARIABLE
const uint IO_TimeOutError = 7;
237 static QT3_SUPPORT_VARIABLE
const uint IO_UnspecifiedError = 8;
239 inline QT3_SUPPORT
int QIODevice::state()
const 241 return isOpen() ? 0x1000 : 0;
245 #if !defined(QT_NO_DEBUG_STREAM) 254 #endif // QIODEVICE_H Q_CORE_EXPORT QDebug operator<<(QDebug debug, QIODevice::OpenMode modes)
The QDebug class provides an output stream for debugging information.
#define QT_END_NAMESPACE
This macro expands to.
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
#define at(className, varName)
The QByteArray class provides an array of bytes.
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
static LibLoadStatus status
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
OpenModeFlag
This enum is used with open() to describe the mode in which a device is opened.
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
Q_GUI_EXPORT QString errorString(EGLint code=eglGetError())
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
static unsigned int getChar(const QChar *str, int &i, const int len)
static const char * data(const QByteArray &arr)
const char * constData() const
Returns a pointer to the data stored in the byte array.
int size() const
Returns the number of bytes in this byte array.
QScopedPointer< QObjectData > d_ptr
#define Q_DECLARE_PRIVATE(Class)
The QIODevice class is the base interface class of all I/O devices in Qt.
qint64 write(const QByteArray &data)
Writes the content of byteArray to the device.
int open(const char *, int,...)
The Text item allows you to add formatted text to a scene.