5#include "private/qringbuffer_p.h"
13static_assert(std::is_nothrow_default_constructible_v<QRingChunk>);
14static_assert(std::is_nothrow_move_constructible_v<QRingChunk>);
15static_assert(std::is_nothrow_move_assignable_v<QRingChunk>);
30 chunk =
QByteArray(std::as_const(*this).data(), chunkSize);
32 tailOffset = chunkSize;
38 if (headOffset != 0 || tailOffset != chunk.size()) {
43 chunk.remove(0, headOffset);
46 return std::move(chunk);
64 return chunk.data() +
pos;
85 if (bufferSize == bytes) {
112 if (bufferSize == 0) {
128 return buffers.last().data() + tail;
141 if (bufferSize == 0) {
151 if (basicBlockSize == 0 || chunk.
isShared() || bytes > chunk.
head()) {
156 buffers.first().advance(-bytes);
176 if (bufferSize == bytes) {
218 if (nextBlockIndex > 0) {
219 const char *
ptr = chunk.data();
225 const char *findPtr =
reinterpret_cast<const char *
>(memchr(
ptr,
c,
226 nextBlockIndex -
index));
233 index = nextBlockIndex;
242 while (readSoFar < bytesToRead) {
243 const qint64 bytesToReadFromThisBlock =
qMin(bytesToRead - readSoFar,
247 readSoFar += bytesToReadFromThisBlock;
248 free(bytesToReadFromThisBlock);
263 bufferSize -=
buffers.constFirst().size();
264 return buffers.takeFirst().toByteArray();
281 qint64 blockLength = chunk.size();
282 if (
pos < blockLength) {
284 memcpy(
data + readSoFar, chunk.data() +
pos, blockLength);
285 readSoFar += blockLength;
309 *writePointer = *
data;
321 if (bufferSize != 0 ||
buffers.isEmpty())
325 bufferSize += qba.size();
335 const auto qbaSize = qba.size();
336 if (bufferSize != 0 ||
buffers.isEmpty())
337 buffers.emplace_back(std::move(qba));
339 buffers.last().assign(std::move(qba));
340 bufferSize += qbaSize;
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
static constexpr qsizetype max_size() noexcept
QByteArray sliced(qsizetype pos) const &
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
Q_CORE_EXPORT void free(qint64 bytes)
Q_CORE_EXPORT QByteArray read()
Q_CORE_EXPORT qint64 peek(char *data, qint64 maxLength, qint64 pos=0) const
Q_CORE_EXPORT qint64 readLine(char *data, qint64 maxLength)
const char * readPointer() const
Q_CORE_EXPORT const char * readPointerAtPosition(qint64 pos, qint64 &length) const
Q_CORE_EXPORT void chop(qint64 bytes)
Q_CORE_EXPORT char * reserve(qint64 bytes)
Q_CORE_EXPORT void append(const char *data, qint64 size)
Q_CORE_EXPORT char * reserveFront(qint64 bytes)
qint64 indexOf(char c) const
Q_CORE_EXPORT void clear()
qint64 nextDataBlockSize() const
void advance(qsizetype offset)
void allocate(qsizetype alloc)
void grow(qsizetype offset)
qsizetype available() const
qsizetype capacity() const
Q_CORE_EXPORT void detach()
QByteArray toByteArray() &&
Combined button and popup list for selecting options.
constexpr Initialization Uninitialized
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
static ControlElement< T > * ptr(QWidget *widget)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLuint const GLuint * buffers
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
manager head(request, this, [this](QRestReply &reply) { if(reply.isSuccess()) })
[6]