Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qiodevice.cpp File Reference
#include "qbytearray.h"
#include "qdebug.h"
#include "qiodevice_p.h"
#include "qfile.h"
#include "qstringlist.h"
#include "qdir.h"
#include "private/qbytearray_p.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 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.

◆ CHECK_MAXBYTEARRAYSIZE

#define CHECK_MAXBYTEARRAYSIZE (   function)
Value:
do { \
if (maxSize >= MaxByteArraySize) { \
checkWarnMessage(this, #function, "maxSize argument exceeds QByteArray size limit"); \
maxSize = MaxByteArraySize - 1; \
} \
} while (0)
QT_BEGIN_NAMESPACE constexpr qsizetype MaxByteArraySize

Definition at line 89 of file qiodevice.cpp.

◆ 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.

◆ 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.

◆ 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.

◆ Q_VOID

#define Q_VOID

Definition at line 46 of file qiodevice.cpp.

Function Documentation

◆ checkWarnMessage()

static 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 23 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 QSocks5SocketEngine::close(), QAbstractSocket::waitForBytesWritten(), QSslSocket::waitForBytesWritten(), QSocks5SocketEnginePrivate::waitForConnected(), QAbstractSocket::waitForConnected(), QAbstractSocket::waitForDisconnected(), QSslSocket::waitForDisconnected(), QSslSocket::waitForEncrypted(), QHttpSocketEngine::waitForRead(), QSocks5SocketEngine::waitForRead(), QPacketProtocol::waitForReadyRead(), QAbstractSocket::waitForReadyRead(), QSslSocket::waitForReadyRead(), QHttpSocketEngine::waitForWrite(), and QSocks5SocketEngine::waitForWrite().

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