diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-01-09 12:24:44 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-01-09 13:33:44 +0100 |
commit | f75b851a59115fb84ffc0680816cb900c3c2bd55 (patch) | |
tree | 4b5ed9c049ae37c5874b22bde387ea7f41356234 | |
parent | bbf09d4de0413ab5ea173639511c95da00aca2ab (diff) |
Fixed the remaining API issues in QJsonValue
Removed all setFoo() methods and made
detach() private.
Change-Id: Ie84dc0a46bf19153745b5412feaf00b8957a7a8f
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
-rw-r--r-- | src/qjsonvalue.cpp | 35 | ||||
-rw-r--r-- | src/qjsonvalue.h | 14 | ||||
-rw-r--r-- | tests/auto/tst_qtjson.cpp | 8 |
3 files changed, 6 insertions, 51 deletions
diff --git a/src/qjsonvalue.cpp b/src/qjsonvalue.cpp index 25dfebf..5f598d7 100644 --- a/src/qjsonvalue.cpp +++ b/src/qjsonvalue.cpp @@ -241,41 +241,6 @@ QVariant QJsonValue::toVariant() const QJsonValue::Type QJsonValue::type() const { return t; - } - -void QJsonValue::setValue(bool b) -{ - *this = QJsonValue(b); -} - -void QJsonValue::setValue(double d) -{ - *this = QJsonValue(d); -} - -void QJsonValue::setValue(int i) -{ - *this = QJsonValue(i); -} - -void QJsonValue::setValue(const QString &s) -{ - *this = QJsonValue(s); -} - -void QJsonValue::setValue(const QLatin1String &s) -{ - *this = QJsonValue(s); -} - -void QJsonValue::setValue(const QJsonArray &a) -{ - *this = QJsonValue(a); -} - -void QJsonValue::setValue(const QJsonObject &o) -{ - *this = QJsonValue(o); } bool QJsonValue::toBool() const diff --git a/src/qjsonvalue.h b/src/qjsonvalue.h index 6b677b4..38335fc 100644 --- a/src/qjsonvalue.h +++ b/src/qjsonvalue.h @@ -86,15 +86,6 @@ public: inline bool isObject() const { return type() == Object; } inline bool isUndefined() const { return type() == Undefined; } - // ### remove! - void setValue(bool); - void setValue(double); - void setValue(int); - void setValue(const QString &); - void setValue(const QLatin1String &); - void setValue(const QJsonArray &); - void setValue(const QJsonObject &); - bool toBool() const; double toNumber() const; int toInt() const; @@ -105,9 +96,6 @@ public: bool operator==(const QJsonValue &other) const; bool operator!=(const QJsonValue &other) const; - // ### make private - void detach(); - private: // avoid implicit conversions from char * to bool inline QJsonValue(const void *) {} @@ -117,6 +105,8 @@ private: friend class QJsonObject; QJsonValue(Private::Data *d, Private::Base *b, const Private::Value& v); + void detach(); + // ### These should move to Private::Value int requiredStorage(bool *compressed) const; uint valueToStore(uint offset) const; diff --git a/tests/auto/tst_qtjson.cpp b/tests/auto/tst_qtjson.cpp index e2070a5..e74d678 100644 --- a/tests/auto/tst_qtjson.cpp +++ b/tests/auto/tst_qtjson.cpp @@ -127,7 +127,7 @@ void TestQtJson::testValueSimple() QCOMPARE(value.toObject(), QJsonObject()); QCOMPARE(value.toArray(), QJsonArray()); - value.setValue(999.); + value = 999.; QCOMPARE(value.type(), QJsonValue::Number); QCOMPARE(value.toNumber(), 999.); QCOMPARE(value.toInt(), 999); @@ -136,7 +136,7 @@ void TestQtJson::testValueSimple() QCOMPARE(value.toObject(), QJsonObject()); QCOMPARE(value.toArray(), QJsonArray()); - value.setValue(QLatin1String("test")); + value = QLatin1String("test"); QCOMPARE(value.toNumber(), 0.); QCOMPARE(value.toInt(), 0); QCOMPARE(value.toString(), QLatin1String("test")); @@ -144,7 +144,7 @@ void TestQtJson::testValueSimple() QCOMPARE(value.toObject(), QJsonObject()); QCOMPARE(value.toArray(), QJsonArray()); - value.setValue(true); + value = true; QCOMPARE(value.toNumber(), 0.); QCOMPARE(value.toInt(), 0); QCOMPARE(value.toString(), QString()); @@ -152,7 +152,7 @@ void TestQtJson::testValueSimple() QCOMPARE(value.toObject(), QJsonObject()); QCOMPARE(value.toArray(), QJsonArray()); - value.setValue(999); + value = 999; QCOMPARE(value.toNumber(), 999.); QCOMPARE(value.toInt(), 999); QCOMPARE(value.toString(), QString()); |