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
QRingBuffer Class Reference

#include <qringbuffer_p.h>

+ Collaboration diagram for QRingBuffer:

Public Member Functions

 QRingBuffer (int growth=QRINGBUFFER_CHUNKSIZE)
 
 QRingBuffer (QRingBuffer &&) noexcept=default
 
QRingBufferoperator= (QRingBuffer &&) noexcept=default
 
void setChunkSize (int size)
 
int chunkSize () const
 
qint64 nextDataBlockSize () const
 
const char * readPointer () const
 
Q_CORE_EXPORT const char * readPointerAtPosition (qint64 pos, qint64 &length) const
 
Q_CORE_EXPORT void free (qint64 bytes)
 
Q_CORE_EXPORT char * reserve (qint64 bytes)
 
Q_CORE_EXPORT char * reserveFront (qint64 bytes)
 
void truncate (qint64 pos)
 
Q_CORE_EXPORT void chop (qint64 bytes)
 
bool isEmpty () const
 
int getChar ()
 
void putChar (char c)
 
void ungetChar (char c)
 
qint64 size () const
 
Q_CORE_EXPORT void clear ()
 
qint64 indexOf (char c) const
 
Q_CORE_EXPORT qint64 indexOf (char c, qint64 maxLength, qint64 pos=0) const
 
Q_CORE_EXPORT qint64 read (char *data, qint64 maxLength)
 
Q_CORE_EXPORT QByteArray read ()
 
Q_CORE_EXPORT qint64 peek (char *data, qint64 maxLength, qint64 pos=0) const
 
Q_CORE_EXPORT void append (const char *data, qint64 size)
 
Q_CORE_EXPORT void append (const QByteArray &qba)
 
Q_CORE_EXPORT void append (QByteArray &&qba)
 
qint64 skip (qint64 length)
 
Q_CORE_EXPORT qint64 readLine (char *data, qint64 maxLength)
 
bool canReadLine () const
 

Detailed Description

Definition at line 133 of file qringbuffer_p.h.

Constructor & Destructor Documentation

◆ QRingBuffer() [1/2]

QRingBuffer::QRingBuffer ( int growth = QRINGBUFFER_CHUNKSIZE)
inlineexplicit

Definition at line 137 of file qringbuffer_p.h.

◆ QRingBuffer() [2/2]

QRingBuffer::QRingBuffer ( QRingBuffer && )
defaultnoexcept

Member Function Documentation

◆ append() [1/3]

void QRingBuffer::append ( const char * data,
qint64 size )

Append bytes from data to the end

Definition at line 300 of file qringbuffer.cpp.

References Q_ASSERT, and reserve().

Referenced by QSocks5SocketEnginePrivate::_q_controlSocketReadNotification(), QIODevicePrivate::QRingBufferRef::append(), QIODevicePrivate::QRingBufferRef::append(), and QGstAppSource::write().

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

◆ append() [2/3]

void QRingBuffer::append ( const QByteArray & qba)

Append a new buffer to the end

Definition at line 319 of file qringbuffer.cpp.

◆ append() [3/3]

void QRingBuffer::append ( QByteArray && qba)

Append a new buffer to the end

Definition at line 333 of file qringbuffer.cpp.

◆ canReadLine()

bool QRingBuffer::canReadLine ( ) const
inline

Definition at line 219 of file qringbuffer_p.h.

References indexOf().

Referenced by QIODevicePrivate::QRingBufferRef::canReadLine().

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

◆ chop()

void QRingBuffer::chop ( qint64 bytes)

Definition at line 164 of file qringbuffer.cpp.

References QRingChunk::capacity(), chunkSize(), clear(), QRingChunk::grow(), QRingChunk::isShared(), QByteArray::max_size(), Q_ASSERT, and QRingChunk::reset().

Referenced by QIODevicePrivate::QRingBufferRef::chop().

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

◆ chunkSize()

int QRingBuffer::chunkSize ( ) const
inline

Definition at line 147 of file qringbuffer_p.h.

Referenced by chop(), QIODevicePrivate::QRingBufferRef::chunkSize(), free(), reserve(), and reserveFront().

+ Here is the caller graph for this function:

◆ clear()

void QRingBuffer::clear ( )

Definition at line 197 of file qringbuffer.cpp.

Referenced by QSocks5SocketEnginePrivate::_q_controlSocketErrorOccurred(), QSocks5SocketEnginePrivate::_q_emitPendingReadNotification(), chop(), QIODevicePrivate::QRingBufferRef::clear(), free(), and QGStreamerAudioSource::reset().

+ Here is the caller graph for this function:

◆ free()

void QRingBuffer::free ( qint64 bytes)

Definition at line 73 of file qringbuffer.cpp.

References QRingChunk::advance(), QRingChunk::capacity(), chunkSize(), clear(), QRingChunk::isShared(), QByteArray::max_size(), Q_ASSERT, and QRingChunk::reset().

Referenced by QIODevicePrivate::QRingBufferRef::free(), and read().

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

◆ getChar()

int QRingBuffer::getChar ( )
inline

Definition at line 176 of file qringbuffer_p.h.

Referenced by QIODevicePrivate::QRingBufferRef::getChar().

+ Here is the caller graph for this function:

◆ indexOf() [1/2]

qint64 QRingBuffer::indexOf ( char c) const
inline

Definition at line 201 of file qringbuffer_p.h.

References indexOf().

Referenced by QIODevicePrivate::QRingBufferRef::indexOf(), indexOf(), QIODevicePrivate::QRingBufferRef::indexOf(), and readLine().

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

◆ indexOf() [2/2]

qint64 QRingBuffer::indexOf ( char c,
qint64 maxLength,
qint64 pos = 0 ) const

Definition at line 207 of file qringbuffer.cpp.

References pos, ptr(), Q_ASSERT, and qMin().

+ Here is the call graph for this function:

◆ isEmpty()

bool QRingBuffer::isEmpty ( ) const
inline

Definition at line 172 of file qringbuffer_p.h.

Referenced by QIODevicePrivate::QRingBufferRef::isEmpty().

+ Here is the caller graph for this function:

◆ nextDataBlockSize()

qint64 QRingBuffer::nextDataBlockSize ( ) const
inline

Definition at line 151 of file qringbuffer_p.h.

References Q_INT64_C.

Referenced by QIODevicePrivate::QRingBufferRef::nextDataBlockSize(), and read().

+ Here is the caller graph for this function:

◆ operator=()

QRingBuffer & QRingBuffer::operator= ( QRingBuffer && )
defaultnoexcept

◆ peek()

qint64 QRingBuffer::peek ( char * data,
qint64 maxLength,
qint64 pos = 0 ) const

Peek the bytes from a specified position

Definition at line 272 of file qringbuffer.cpp.

References pos, Q_ASSERT, and qMin().

Referenced by QIODevicePrivate::QRingBufferRef::peek().

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

◆ putChar()

void QRingBuffer::putChar ( char c)
inline

Definition at line 184 of file qringbuffer_p.h.

References ptr(), and reserve().

Referenced by QIODevicePrivate::QRingBufferRef::putChar().

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

◆ read() [1/2]

QByteArray QRingBuffer::read ( )

Read an unspecified amount (will read the first buffer)

Definition at line 258 of file qringbuffer.cpp.

References QByteArray().

Referenced by readLine().

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

◆ read() [2/2]

qint64 QRingBuffer::read ( char * data,
qint64 maxLength )

Definition at line 238 of file qringbuffer.cpp.

References free(), nextDataBlockSize(), qMin(), readPointer(), and size().

Referenced by QIODevicePrivate::QRingBufferRef::read(), QIODevicePrivate::QRingBufferRef::read(), and GStreamerInputPrivate::readData().

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

◆ readLine()

qint64 QRingBuffer::readLine ( char * data,
qint64 maxLength )

Definition at line 343 of file qringbuffer.cpp.

References i, indexOf(), Q_ASSERT, and read().

Referenced by QIODevicePrivate::QRingBufferRef::readLine().

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

◆ readPointer()

const char * QRingBuffer::readPointer ( ) const
inline

Definition at line 155 of file qringbuffer_p.h.

References nullptr.

Referenced by read(), and QIODevicePrivate::QRingBufferRef::readPointer().

+ Here is the caller graph for this function:

◆ readPointerAtPosition()

const char * QRingBuffer::readPointerAtPosition ( qint64 pos,
qint64 & length ) const

Access the bytes at a specified position the out-variable length will contain the amount of bytes readable from there, e.g. the amount still the same QByteArray

Definition at line 56 of file qringbuffer.cpp.

References pos, and Q_ASSERT.

Referenced by QIODevicePrivate::QRingBufferRef::readPointerAtPosition().

+ Here is the caller graph for this function:

◆ reserve()

char * QRingBuffer::reserve ( qint64 bytes)

Definition at line 106 of file qringbuffer.cpp.

References QRingChunk::available(), chunkSize(), QRingChunk::isShared(), QByteArray::max_size(), Q_ASSERT, qMax(), and QRingChunk::size().

Referenced by append(), and QIODevicePrivate::QRingBufferRef::reserve().

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

◆ reserveFront()

char * QRingBuffer::reserveFront ( qint64 bytes)

Allocate data at buffer head

Definition at line 136 of file qringbuffer.cpp.

References chunkSize(), QRingChunk::grow(), QRingChunk::head(), QRingChunk::isShared(), QByteArray::max_size(), Q_ASSERT, and qMax().

Referenced by QIODevicePrivate::QRingBufferRef::reserveFront().

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

◆ setChunkSize()

void QRingBuffer::setChunkSize ( int size)
inline

Definition at line 143 of file qringbuffer_p.h.

Referenced by QIODevicePrivate::QRingBufferRef::setChunkSize().

+ Here is the caller graph for this function:

◆ size()

qint64 QRingBuffer::size ( ) const
inline

Definition at line 196 of file qringbuffer_p.h.

Referenced by GStreamerInputPrivate::bytesAvailable(), QGStreamerAudioSource::bytesReady(), QIODevicePrivate::QRingBufferRef::indexOf(), read(), and QIODevicePrivate::QRingBufferRef::size().

+ Here is the caller graph for this function:

◆ skip()

qint64 QRingBuffer::skip ( qint64 length)
inline

Definition at line 210 of file qringbuffer_p.h.

References qMin().

Referenced by QIODevicePrivate::QRingBufferRef::skip().

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

◆ truncate()

void QRingBuffer::truncate ( qint64 pos)
inline

Definition at line 164 of file qringbuffer_p.h.

References pos, and Q_ASSERT.

Referenced by QIODevicePrivate::QRingBufferRef::truncate().

+ Here is the caller graph for this function:

◆ ungetChar()

void QRingBuffer::ungetChar ( char c)
inline

Definition at line 189 of file qringbuffer_p.h.

References ptr().

Referenced by QIODevicePrivate::QRingBufferRef::ungetChar().

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

The documentation for this class was generated from the following files: