summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-01-09 12:28:28 +0100
committerLars Knoll <lars.knoll@nokia.com>2012-01-09 13:33:50 +0100
commitea327b79730279db89aeefd5eb1dc0ce0ffa1423 (patch)
tree1a3e599ef8b922838a1d38bf731ebba065dd749c
parentf75b851a59115fb84ffc0680816cb900c3c2bd55 (diff)
Make QJsonObject/Array::detach() private
Change-Id: I58c1f5ad60f78423b819fc118a5ec2590a2ece88 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
-rw-r--r--src/qjsonarray.h6
-rw-r--r--src/qjsonobject.h5
-rw-r--r--tests/auto/tst_qtjson.cpp6
3 files changed, 5 insertions, 12 deletions
diff --git a/src/qjsonarray.h b/src/qjsonarray.h
index 0ad2779..e094207 100644
--- a/src/qjsonarray.h
+++ b/src/qjsonarray.h
@@ -86,15 +86,15 @@ public:
bool operator==(const QJsonArray &other) const;
bool operator!=(const QJsonArray &other) const;
- // ### make private
- void detach(uint reserve = 0);
-
private:
friend class Private::Data;
friend class QJsonValue;
friend class QJsonDocument;
+
QJsonArray(Private::Data *data, Private::Array *array);
void compact() const;
+ void detach(uint reserve = 0);
+
Private::Data *d;
Private::Array *a;
};
diff --git a/src/qjsonobject.h b/src/qjsonobject.h
index de46cdd..29910b7 100644
--- a/src/qjsonobject.h
+++ b/src/qjsonobject.h
@@ -78,15 +78,14 @@ public:
bool operator==(const QJsonObject &other) const;
bool operator!=(const QJsonObject &other) const;
- // mkae private
- void detach(uint reserve = 0);
-
private:
friend class Private::Data;
friend class QJsonValue;
friend class QJsonDocument;
friend class QJsonParser;
+
QJsonObject(Private::Data *data, Private::Object *object);
+ void detach(uint reserve = 0);
void compact() const;
Private::Data *d;
diff --git a/tests/auto/tst_qtjson.cpp b/tests/auto/tst_qtjson.cpp
index e74d678..f2e40c5 100644
--- a/tests/auto/tst_qtjson.cpp
+++ b/tests/auto/tst_qtjson.cpp
@@ -577,9 +577,6 @@ void TestQtJson::nullArrays()
QCOMPARE(nullArray.last(), QJsonValue(QJsonValue::Undefined));
nullArray.removeAt(0);
nullArray.removeAt(-1);
-
- nullArray.detach(16);
- QCOMPARE(nullArray, QJsonArray());
}
void TestQtJson::nullObject()
@@ -599,9 +596,6 @@ void TestQtJson::nullObject()
QCOMPARE(nullObject.take("foo"), QJsonValue(QJsonValue::Undefined));
QCOMPARE(nullObject.contains("foo"), false);
- nullObject.detach(16);
- QCOMPARE(nullObject, QJsonObject());
-
nullObject.insert("foo", QString("bar"));
nullObject.remove("foo");