QNonContiguousByteDevice: mark atEnd(), size(), pos() methods as const.
These methods do not modify the object. Change-Id: I9ab9a17fa24f5a608943ec263913df14218214a8 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
4fb7eb0da7
commit
e2e190fd69
@ -160,7 +160,7 @@ bool QNonContiguousByteDeviceBufferImpl::advanceReadPointer(qint64 amount)
|
|||||||
return arrayImpl->advanceReadPointer(amount);
|
return arrayImpl->advanceReadPointer(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QNonContiguousByteDeviceBufferImpl::atEnd()
|
bool QNonContiguousByteDeviceBufferImpl::atEnd() const
|
||||||
{
|
{
|
||||||
return arrayImpl->atEnd();
|
return arrayImpl->atEnd();
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ bool QNonContiguousByteDeviceBufferImpl::reset()
|
|||||||
return arrayImpl->reset();
|
return arrayImpl->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceBufferImpl::size()
|
qint64 QNonContiguousByteDeviceBufferImpl::size() const
|
||||||
{
|
{
|
||||||
return arrayImpl->size();
|
return arrayImpl->size();
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ bool QNonContiguousByteDeviceByteArrayImpl::advanceReadPointer(qint64 amount)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QNonContiguousByteDeviceByteArrayImpl::atEnd()
|
bool QNonContiguousByteDeviceByteArrayImpl::atEnd() const
|
||||||
{
|
{
|
||||||
return currentPosition >= size();
|
return currentPosition >= size();
|
||||||
}
|
}
|
||||||
@ -217,12 +217,12 @@ bool QNonContiguousByteDeviceByteArrayImpl::reset()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceByteArrayImpl::size()
|
qint64 QNonContiguousByteDeviceByteArrayImpl::size() const
|
||||||
{
|
{
|
||||||
return byteArray->size();
|
return byteArray->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceByteArrayImpl::pos()
|
qint64 QNonContiguousByteDeviceByteArrayImpl::pos() const
|
||||||
{
|
{
|
||||||
return currentPosition;
|
return currentPosition;
|
||||||
}
|
}
|
||||||
@ -259,12 +259,12 @@ bool QNonContiguousByteDeviceRingBufferImpl::advanceReadPointer(qint64 amount)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QNonContiguousByteDeviceRingBufferImpl::atEnd()
|
bool QNonContiguousByteDeviceRingBufferImpl::atEnd() const
|
||||||
{
|
{
|
||||||
return currentPosition >= size();
|
return currentPosition >= size();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceRingBufferImpl::pos()
|
qint64 QNonContiguousByteDeviceRingBufferImpl::pos() const
|
||||||
{
|
{
|
||||||
return currentPosition;
|
return currentPosition;
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ bool QNonContiguousByteDeviceRingBufferImpl::reset()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceRingBufferImpl::size()
|
qint64 QNonContiguousByteDeviceRingBufferImpl::size() const
|
||||||
{
|
{
|
||||||
return ringBuffer->size();
|
return ringBuffer->size();
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QNonContiguousByteDeviceIoDeviceImpl::atEnd()
|
bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() const
|
||||||
{
|
{
|
||||||
return eof == true;
|
return eof == true;
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceIoDeviceImpl::size()
|
qint64 QNonContiguousByteDeviceIoDeviceImpl::size() const
|
||||||
{
|
{
|
||||||
// note that this is different from the size() implementation of QIODevice!
|
// note that this is different from the size() implementation of QIODevice!
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ qint64 QNonContiguousByteDeviceIoDeviceImpl::size()
|
|||||||
return device->size() - initialPosition;
|
return device->size() - initialPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QNonContiguousByteDeviceIoDeviceImpl::pos()
|
qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() const
|
||||||
{
|
{
|
||||||
if (device->isSequential())
|
if (device->isSequential())
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -66,10 +66,10 @@ class Q_CORE_EXPORT QNonContiguousByteDevice : public QObject
|
|||||||
public:
|
public:
|
||||||
virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0;
|
virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0;
|
||||||
virtual bool advanceReadPointer(qint64 amount) = 0;
|
virtual bool advanceReadPointer(qint64 amount) = 0;
|
||||||
virtual bool atEnd() = 0;
|
virtual bool atEnd() const = 0;
|
||||||
virtual qint64 pos() { return -1; }
|
virtual qint64 pos() const { return -1; }
|
||||||
virtual bool reset() = 0;
|
virtual bool reset() = 0;
|
||||||
virtual qint64 size() = 0;
|
virtual qint64 size() const = 0;
|
||||||
|
|
||||||
virtual ~QNonContiguousByteDevice();
|
virtual ~QNonContiguousByteDevice();
|
||||||
|
|
||||||
@ -107,10 +107,10 @@ public:
|
|||||||
~QNonContiguousByteDeviceByteArrayImpl();
|
~QNonContiguousByteDeviceByteArrayImpl();
|
||||||
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
||||||
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
||||||
bool atEnd() Q_DECL_OVERRIDE;
|
bool atEnd() const Q_DECL_OVERRIDE;
|
||||||
bool reset() Q_DECL_OVERRIDE;
|
bool reset() Q_DECL_OVERRIDE;
|
||||||
qint64 size() Q_DECL_OVERRIDE;
|
qint64 size() const Q_DECL_OVERRIDE;
|
||||||
qint64 pos() Q_DECL_OVERRIDE;
|
qint64 pos() const Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
QByteArray* byteArray;
|
QByteArray* byteArray;
|
||||||
qint64 currentPosition;
|
qint64 currentPosition;
|
||||||
@ -123,10 +123,10 @@ public:
|
|||||||
~QNonContiguousByteDeviceRingBufferImpl();
|
~QNonContiguousByteDeviceRingBufferImpl();
|
||||||
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
||||||
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
||||||
bool atEnd() Q_DECL_OVERRIDE;
|
bool atEnd() const Q_DECL_OVERRIDE;
|
||||||
bool reset() Q_DECL_OVERRIDE;
|
bool reset() Q_DECL_OVERRIDE;
|
||||||
qint64 size() Q_DECL_OVERRIDE;
|
qint64 size() const Q_DECL_OVERRIDE;
|
||||||
qint64 pos() Q_DECL_OVERRIDE;
|
qint64 pos() const Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
QSharedPointer<QRingBuffer> ringBuffer;
|
QSharedPointer<QRingBuffer> ringBuffer;
|
||||||
qint64 currentPosition;
|
qint64 currentPosition;
|
||||||
@ -141,10 +141,10 @@ public:
|
|||||||
~QNonContiguousByteDeviceIoDeviceImpl();
|
~QNonContiguousByteDeviceIoDeviceImpl();
|
||||||
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
||||||
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
||||||
bool atEnd() Q_DECL_OVERRIDE;
|
bool atEnd() const Q_DECL_OVERRIDE;
|
||||||
bool reset() Q_DECL_OVERRIDE;
|
bool reset() Q_DECL_OVERRIDE;
|
||||||
qint64 size() Q_DECL_OVERRIDE;
|
qint64 size() const Q_DECL_OVERRIDE;
|
||||||
qint64 pos() Q_DECL_OVERRIDE;
|
qint64 pos() const Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
QIODevice* device;
|
QIODevice* device;
|
||||||
QByteArray* currentReadBuffer;
|
QByteArray* currentReadBuffer;
|
||||||
@ -164,9 +164,9 @@ public:
|
|||||||
~QNonContiguousByteDeviceBufferImpl();
|
~QNonContiguousByteDeviceBufferImpl();
|
||||||
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
|
||||||
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
|
||||||
bool atEnd() Q_DECL_OVERRIDE;
|
bool atEnd() const Q_DECL_OVERRIDE;
|
||||||
bool reset() Q_DECL_OVERRIDE;
|
bool reset() Q_DECL_OVERRIDE;
|
||||||
qint64 size() Q_DECL_OVERRIDE;
|
qint64 size() const Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
QBuffer* buffer;
|
QBuffer* buffer;
|
||||||
QByteArray byteArray;
|
QByteArray byteArray;
|
||||||
|
@ -214,7 +214,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 pos() Q_DECL_OVERRIDE
|
qint64 pos() const Q_DECL_OVERRIDE
|
||||||
{
|
{
|
||||||
return m_pos;
|
return m_pos;
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool atEnd() Q_DECL_OVERRIDE
|
bool atEnd() const Q_DECL_OVERRIDE
|
||||||
{
|
{
|
||||||
if (m_amount > 0)
|
if (m_amount > 0)
|
||||||
return false;
|
return false;
|
||||||
@ -284,7 +284,7 @@ public:
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 size() Q_DECL_OVERRIDE
|
qint64 size() const Q_DECL_OVERRIDE
|
||||||
{
|
{
|
||||||
return m_size;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user