diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-24 17:19:40 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-24 21:02:08 +0100 |
commit | 34b14a8472f44f8517577756e033b92ebd4c5912 (patch) | |
tree | 66a0575156d0a17a835430137e218e2b3f04cc65 /src/corelib/json | |
parent | d34353a065c443aac20376cbd88323480d769183 (diff) | |
parent | edd555425a08f9e074f0a4d9333862636ccaae8d (diff) | |
download | qtbase-34b14a8472f44f8517577756e033b92ebd4c5912.tar.gz |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
examples/xml/htmlinfo/simpleexample.html
examples/xml/rsslisting/rsslisting.cpp
qmake/generators/win32/msbuild_objectmodel.cpp
src/3rdparty/harfbuzz-ng/src/hb-private.hh
src/corelib/global/qlogging.cpp
src/corelib/io/qstorageinfo_unix.cpp
src/corelib/thread/qwaitcondition_unix.cpp
src/gui/kernel/qguiapplication.cpp
src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
src/testlib/doc/src/qt-webpages.qdoc
tests/auto/other/qaccessibility/tst_qaccessibility.cpp
Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
Diffstat (limited to 'src/corelib/json')
-rw-r--r-- | src/corelib/json/qjson.cpp | 5 | ||||
-rw-r--r-- | src/corelib/json/qjsonarray.cpp | 13 | ||||
-rw-r--r-- | src/corelib/json/qjsonobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/json/qjsonvalue.cpp | 18 |
4 files changed, 30 insertions, 8 deletions
diff --git a/src/corelib/json/qjson.cpp b/src/corelib/json/qjson.cpp index 66078f3cc8..c3b58e59a5 100644 --- a/src/corelib/json/qjson.cpp +++ b/src/corelib/json/qjson.cpp @@ -200,6 +200,7 @@ bool Object::isValid() const if (tableOffset + length*sizeof(offset) > size) return false; + QString lastKey; for (uint i = 0; i < length; ++i) { offset entryOffset = table()[i]; if (entryOffset + sizeof(Entry) >= tableOffset) @@ -208,8 +209,12 @@ bool Object::isValid() const int s = e->size(); if (table()[i] + s > tableOffset) return false; + QString key = e->key(); + if (key < lastKey) + return false; if (!e->value.isValid(this)) return false; + lastKey = key; } return true; } diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index 1e4c668a4c..a993fd6ea4 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -531,8 +531,8 @@ bool QJsonArray::contains(const QJsonValue &value) const \a i must be a valid index position in the array (i.e., \c{0 <= i < size()}). - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can + The return value is of type \keyword QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type \keyword QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference. @@ -731,13 +731,14 @@ bool QJsonArray::operator!=(const QJsonArray &other) const /*! \fn QJsonValueRef QJsonArray::iterator::operator*() const + Returns a modifiable reference to the current item. You can change the value of an item by using operator*() on the left side of an assignment. - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can + The return value is of type \keyword QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type \keyword QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference. @@ -756,8 +757,8 @@ bool QJsonArray::operator!=(const QJsonArray &other) const This function is provided to make QJsonArray iterators behave like C++ pointers. - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can + The return value is of type \keyword QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type \keyword QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference. diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index bdedc3f17b..22bad6f8a2 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -264,6 +264,8 @@ QVariantHash QJsonObject::toVariantHash() const /*! Returns a list of all keys in this object. + + The list is sorted lexographically. */ QStringList QJsonObject::keys() const { diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 306cc1d15b..4845d8c876 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -74,6 +74,20 @@ QT_BEGIN_NAMESPACE conversions. This implies that converting to a type that is not stored in the value will return a default constructed return value. + \section1 QJsonValueRef + + QJsonValueRef is a helper class for QJsonArray and QJsonObject. + When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the element in the QJsonArray or QJsonObject + from which you got the reference. + + The following methods return QJsonValueRef: + \list + \li \l {QJsonArray}::operator[](int i) + \li \l {QJsonObject}::operator[](const QString & key) const + \endlist + \sa {JSON Support in Qt}, {JSON Save Game Example} */ @@ -419,13 +433,13 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) The QJsonValue types will be converted as follows: - \value Null {QVariant::}{QVariant()} + \value Null \l {QVariant::}{QVariant()} \value Bool QMetaType::Bool \value Double QMetaType::Double \value String QString \value Array QVariantList \value Object QVariantMap - \value Undefined {QVariant::}{QVariant()} + \value Undefined \l {QVariant::}{QVariant()} \sa fromVariant() */ |