eteran / qjson4

A Qt4 library providing an API compatible with Qt5's JSON implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pull-request: 1) Add forward header 2) Added isInt+toInt

GoogleCodeExporter opened this issue · comments

Lot of thanks for this library. I extended it to make it proper work against 
some (GPLv2) Qt4/Qt5-code. Following both commits:

1) Add forward header
https://code.google.com/r/sebastiansauerkdab-qjson4/source/detail?r=742a00ac50f6
026732d66b80f2e866dd9eda9da2

2) Added isInt+toInt and defaultValue for toBool/toInt/toDouble
https://code.google.com/r/sebastiansauerkdab-qjson4/source/detail?r=742a00ac50f6
026732d66b80f2e866dd9eda9da2

Original issue reported on code.google.com by sebastia...@gmail.com on 15 Feb 2015 at 5:10

Thanks for the patches!

One thing though, some of your changes (as far as I can tell) implement some 
things which are not in the Qt5 API looking at 
http://doc.qt.io/qt-5/qjsonvalue.html and related.

There does not appear to be a QJsonValue::isInt() function. The documents imply 
that the user should test with isDouble(). Specifically, it says "If type() is 
not Double or the value is not a whole number, the defaultValue will be 
returned."

So, I'll be looking over the patches and will merge in the changes which fit 
with the Qt API. Honestly, I agree with the notion of having an IsInt function, 
but I also want the library to be forward compatible too. So If someone uses 
it, they can easily change there code to be Qt5 and won't start getting 
compiler errors.

Original comment by evan.teran on 19 Feb 2015 at 6:29

  • Changed state: Accepted

Commit e2a1014 synchronized the API with Qt 5.5, which includes toInt() and related functions.