Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qiodevice.cpp File Reference

(7ce6920aacfcba485cd8017e01c6aeb324292e75)

#include "qbytearray.h"
#include "qdebug.h"
#include "qiodevice_p.h"
#include "qfile.h"
#include "qstringlist.h"
#include "qdir.h"
#include "private/qtools_p.h"
#include <algorithm>
#include "moc_qiodevice.cpp"
+ Include dependency graph for qiodevice.cpp:

Go to the source code of this file.

Macros

#define Q_VOID
 
#define CHECK_MAXLEN(function, returnType)
 
#define CHECK_LINEMAXLEN(function, returnType)
 
#define CHECK_MAXBYTEARRAYSIZE(function)
 
#define CHECK_WRITABLE(function, returnType)
 
#define CHECK_READABLE(function, returnType)
 

Functions

static void debugBinaryString (const char *input, qint64 maxlen)
 
static Q_DECL_COLD_FUNCTION void checkWarnMessage (const QIODevice *device, const char *function, const char *what)
 
int qt_subtract_from_timeout (int timeout, int elapsed)
 
QDebug operator<< (QDebug debug, QIODevice::OpenMode modes)
 

Macro Definition Documentation

◆ CHECK_LINEMAXLEN

#define CHECK_LINEMAXLEN ( function,
returnType )
Value:
do { \
if (maxSize < 2) { \
checkWarnMessage(this, #function, "Called with maxSize < 2"); \
return returnType; \
} \
} while (0)

Definition at line 81 of file qiodevice.cpp.

Referenced by QIODevice::readLine(), and QIODevice::readLine().

◆ CHECK_MAXBYTEARRAYSIZE

#define CHECK_MAXBYTEARRAYSIZE ( function)
Value:
do { \
if (maxSize >= QByteArray::max_size()) { \
checkWarnMessage(this, #function, "maxSize argument exceeds QByteArray size limit"); \
maxSize = QByteArray::max_size() - 1; \
} \
} while (0)
static constexpr qsizetype max_size() noexcept
Definition qbytearray.h:485

Definition at line 89 of file qiodevice.cpp.

Referenced by QIODevice::peek(), QIODevice::read(), and QIODevice::readLine().

◆ CHECK_MAXLEN

#define CHECK_MAXLEN ( function,
returnType )
Value:
do { \
if (maxSize < 0) { \
checkWarnMessage(this, #function, "Called with maxSize < 0"); \
return returnType; \
} \
} while (0)

Definition at line 73 of file qiodevice.cpp.

Referenced by QIODevice::peek(), QIODevice::peek(), QIODevice::read(), QIODevice::read(), QIODevice::skip(), and QIODevice::write().

◆ CHECK_READABLE

#define CHECK_READABLE ( function,
returnType )
Value:
do { \
if ((d->openMode & ReadOnly) == 0) { \
if (d->openMode == NotOpen) { \
checkWarnMessage(this, #function, "device not open"); \
return returnType; \
} \
checkWarnMessage(this, #function, "WriteOnly device"); \
return returnType; \
} \
} while (0)

Definition at line 109 of file qiodevice.cpp.

Referenced by QIODevice::peek(), QIODevice::peek(), QIODevice::read(), QIODevice::read(), QIODevice::readAll(), QIODevice::readLine(), QIODevice::readLine(), QIODevice::skip(), and QIODevice::ungetChar().

◆ CHECK_WRITABLE

#define CHECK_WRITABLE ( function,
returnType )
Value:
do { \
if ((d->openMode & WriteOnly) == 0) { \
if (d->openMode == NotOpen) { \
checkWarnMessage(this, #function, "device not open"); \
return returnType; \
} \
checkWarnMessage(this, #function, "ReadOnly device"); \
return returnType; \
} \
} while (0)

Definition at line 97 of file qiodevice.cpp.

Referenced by QIODevice::write().

◆ Q_VOID

Function Documentation

◆ checkWarnMessage()

static Q_DECL_COLD_FUNCTION void checkWarnMessage ( const QIODevice * device,
const char * function,
const char * what )
static

Definition at line 48 of file qiodevice.cpp.

References d, device, function, Q_UNUSED, qWarning, and QDir::toNativeSeparators().

Referenced by QIODevice::commitTransaction(), QIODevice::rollbackTransaction(), QIODevice::seek(), QIODevice::setCurrentReadChannel(), QIODevice::setTextModeEnabled(), QIODevice::startTransaction(), and QIODevice::ungetChar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debugBinaryString()

static void debugBinaryString ( const char * input,
qint64 maxlen )
static

Definition at line 22 of file qiodevice.cpp.

References QByteArray::clear(), i, QtMiscUtils::isAsciiPrintable(), j, and QByteArray::size().

Referenced by QIODevice::read(), QIODevice::readLine(), and QIODevicePrivate::readLine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

◆ qt_subtract_from_timeout()

int qt_subtract_from_timeout ( int timeout,
int elapsed )

Reduces the timeout by elapsed, taking into account that -1 is a special value for timeouts.

Definition at line 2191 of file qiodevice.cpp.

References elapsed().

Referenced by QSslSocket::waitForBytesWritten(), QSslSocket::waitForDisconnected(), QSslSocket::waitForEncrypted(), QPacketProtocol::waitForReadyRead(), and QSslSocket::waitForReadyRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: