summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-08 16:19:31 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-08 19:36:38 +0000
commite2e190fd69facbda3dea5a8a2a58629083ba835a (patch)
tree13c0439112f01e2bc58b25773df291017dca7f0f
parent4fb7eb0da74798205f5cac693c921065492fa33e (diff)
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>
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp22
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h28
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h6
3 files changed, 28 insertions, 28 deletions
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index 0216b7f814..872bebe87b 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -160,7 +160,7 @@ bool QNonContiguousByteDeviceBufferImpl::advanceReadPointer(qint64 amount)
return arrayImpl->advanceReadPointer(amount);
}
-bool QNonContiguousByteDeviceBufferImpl::atEnd()
+bool QNonContiguousByteDeviceBufferImpl::atEnd() const
{
return arrayImpl->atEnd();
}
@@ -170,7 +170,7 @@ bool QNonContiguousByteDeviceBufferImpl::reset()
return arrayImpl->reset();
}
-qint64 QNonContiguousByteDeviceBufferImpl::size()
+qint64 QNonContiguousByteDeviceBufferImpl::size() const
{
return arrayImpl->size();
}
@@ -206,7 +206,7 @@ bool QNonContiguousByteDeviceByteArrayImpl::advanceReadPointer(qint64 amount)
return true;
}
-bool QNonContiguousByteDeviceByteArrayImpl::atEnd()
+bool QNonContiguousByteDeviceByteArrayImpl::atEnd() const
{
return currentPosition >= size();
}
@@ -217,12 +217,12 @@ bool QNonContiguousByteDeviceByteArrayImpl::reset()
return true;
}
-qint64 QNonContiguousByteDeviceByteArrayImpl::size()
+qint64 QNonContiguousByteDeviceByteArrayImpl::size() const
{
return byteArray->size();
}
-qint64 QNonContiguousByteDeviceByteArrayImpl::pos()
+qint64 QNonContiguousByteDeviceByteArrayImpl::pos() const
{
return currentPosition;
}
@@ -259,12 +259,12 @@ bool QNonContiguousByteDeviceRingBufferImpl::advanceReadPointer(qint64 amount)
return true;
}
-bool QNonContiguousByteDeviceRingBufferImpl::atEnd()
+bool QNonContiguousByteDeviceRingBufferImpl::atEnd() const
{
return currentPosition >= size();
}
-qint64 QNonContiguousByteDeviceRingBufferImpl::pos()
+qint64 QNonContiguousByteDeviceRingBufferImpl::pos() const
{
return currentPosition;
}
@@ -275,7 +275,7 @@ bool QNonContiguousByteDeviceRingBufferImpl::reset()
return true;
}
-qint64 QNonContiguousByteDeviceRingBufferImpl::size()
+qint64 QNonContiguousByteDeviceRingBufferImpl::size() const
{
return ringBuffer->size();
}
@@ -364,7 +364,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount)
return true;
}
-bool QNonContiguousByteDeviceIoDeviceImpl::atEnd()
+bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() const
{
return eof == true;
}
@@ -387,7 +387,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset()
return false;
}
-qint64 QNonContiguousByteDeviceIoDeviceImpl::size()
+qint64 QNonContiguousByteDeviceIoDeviceImpl::size() const
{
// note that this is different from the size() implementation of QIODevice!
@@ -397,7 +397,7 @@ qint64 QNonContiguousByteDeviceIoDeviceImpl::size()
return device->size() - initialPosition;
}
-qint64 QNonContiguousByteDeviceIoDeviceImpl::pos()
+qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() const
{
if (device->isSequential())
return -1;
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index 6664870864..bb0b533831 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -66,10 +66,10 @@ class Q_CORE_EXPORT QNonContiguousByteDevice : public QObject
public:
virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0;
virtual bool advanceReadPointer(qint64 amount) = 0;
- virtual bool atEnd() = 0;
- virtual qint64 pos() { return -1; }
+ virtual bool atEnd() const = 0;
+ virtual qint64 pos() const { return -1; }
virtual bool reset() = 0;
- virtual qint64 size() = 0;
+ virtual qint64 size() const = 0;
virtual ~QNonContiguousByteDevice();
@@ -107,10 +107,10 @@ public:
~QNonContiguousByteDeviceByteArrayImpl();
const char* readPointer(qint64 maximumLength, qint64 &len) 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;
- qint64 size() Q_DECL_OVERRIDE;
- qint64 pos() Q_DECL_OVERRIDE;
+ qint64 size() const Q_DECL_OVERRIDE;
+ qint64 pos() const Q_DECL_OVERRIDE;
protected:
QByteArray* byteArray;
qint64 currentPosition;
@@ -123,10 +123,10 @@ public:
~QNonContiguousByteDeviceRingBufferImpl();
const char* readPointer(qint64 maximumLength, qint64 &len) 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;
- qint64 size() Q_DECL_OVERRIDE;
- qint64 pos() Q_DECL_OVERRIDE;
+ qint64 size() const Q_DECL_OVERRIDE;
+ qint64 pos() const Q_DECL_OVERRIDE;
protected:
QSharedPointer<QRingBuffer> ringBuffer;
qint64 currentPosition;
@@ -141,10 +141,10 @@ public:
~QNonContiguousByteDeviceIoDeviceImpl();
const char* readPointer(qint64 maximumLength, qint64 &len) 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;
- qint64 size() Q_DECL_OVERRIDE;
- qint64 pos() Q_DECL_OVERRIDE;
+ qint64 size() const Q_DECL_OVERRIDE;
+ qint64 pos() const Q_DECL_OVERRIDE;
protected:
QIODevice* device;
QByteArray* currentReadBuffer;
@@ -164,9 +164,9 @@ public:
~QNonContiguousByteDeviceBufferImpl();
const char* readPointer(qint64 maximumLength, qint64 &len) 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;
- qint64 size() Q_DECL_OVERRIDE;
+ qint64 size() const Q_DECL_OVERRIDE;
protected:
QBuffer* buffer;
QByteArray byteArray;
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index ddbbc7f4e6..cec125d7a5 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -214,7 +214,7 @@ public:
{
}
- qint64 pos() Q_DECL_OVERRIDE
+ qint64 pos() const Q_DECL_OVERRIDE
{
return m_pos;
}
@@ -254,7 +254,7 @@ public:
return true;
}
- bool atEnd() Q_DECL_OVERRIDE
+ bool atEnd() const Q_DECL_OVERRIDE
{
if (m_amount > 0)
return false;
@@ -284,7 +284,7 @@ public:
return b;
}
- qint64 size() Q_DECL_OVERRIDE
+ qint64 size() const Q_DECL_OVERRIDE
{
return m_size;
}