[Development] QJsonValue (was: Re: Qt 5.2 header diff: QtCore)

Marc Mutz marc.mutz at kdab.com
Tue Nov 5 11:44:41 CET 2013


On Tuesday, November 05, 2013 01:07:32 Thiago Macieira wrote:
> diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h
> index b8bdf55..c0ecdd2 100644
> --- a/src/corelib/json/qjsonvalue.h
> +++ b/src/corelib/json/qjsonvalue.h
> @@ -79,6 +79,7 @@ public:
>      QJsonValue(bool b);
>      QJsonValue(double n);
>      QJsonValue(int n);
> +    QJsonValue(qint64 n);
>      QJsonValue(const QString &s);
>      QJsonValue(QLatin1String s);
>      QJsonValue(const QJsonArray &a);
> @@ -102,6 +103,7 @@ public:
>      inline bool isUndefined() const { return type() == Undefined; }
>  
>      bool toBool(bool defaultValue = false) const;
> +    int toInt(int defaultValue = 0) const;
>      double toDouble(double defaultValue = 0) const;
>      QString toString(const QString &defaultValue = QString()) const;
>      QJsonArray toArray() const;
> @@ -157,6 +159,7 @@ public:
>      inline bool isUndefined() const { return type() ==
> QJsonValue::Undefined; } 
>      inline bool toBool() const { return toValue().toBool(); }
> +    inline int toInt() const { return toValue().toInt(); }
>      inline double toDouble() const { return toValue().toDouble(); }
>      inline QString toString() const { return toValue().toString(); }
>      QJsonArray toArray() const;
> @@ -176,7 +179,7 @@ private:
>      uint index : 31;
>  };

It seems there's no way to get the 64bit value back, once set with the new 
ctor.

And isn't the new ctor going to be ambiguous?



More information about the Development mailing list