diff options
author | Liang Qi <liang.qi@nokia.com> | 2012-03-20 07:07:03 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-06 15:32:45 +0200 |
commit | 54d9fd61e13f7369c831ab76503f7619d60c0cfd (patch) | |
tree | b8931b56e581773c9538ce0a1278342d1e88042d /src/corelib/json/qjsonvalue.h | |
parent | d6bb52b1961fcd93d301fa91d4284d45b17b8844 (diff) |
Add default value for getters in QJsonValue
Done-with: Debao Zhang <dbzhang800@gmail.com>
Change-Id: I3ddd8dd89dc75d91ac9977bf9b6eb3174d7669e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/json/qjsonvalue.h')
-rw-r--r-- | src/corelib/json/qjsonvalue.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h index 69dcc0640a..386bee25a4 100644 --- a/src/corelib/json/qjsonvalue.h +++ b/src/corelib/json/qjsonvalue.h @@ -103,11 +103,13 @@ public: inline bool isObject() const { return type() == Object; } inline bool isUndefined() const { return type() == Undefined; } - bool toBool() const; - double toDouble() const; - QString toString() const; + bool toBool(bool defaultValue = false) const; + double toDouble(double defaultValue = 0) const; + QString toString(const QString &defaultValue = QString()) const; QJsonArray toArray() const; + QJsonArray toArray(const QJsonArray &defaultValue) const; QJsonObject toObject() const; + QJsonObject toObject(const QJsonObject &defaultValue) const; bool operator==(const QJsonValue &other) const; bool operator!=(const QJsonValue &other) const; |