D19087: Add standalone conversion functions for PropertyMap to Json and vice versa

Alexander Stippich noreply at phabricator.kde.org
Tue Feb 19 20:51:23 GMT 2019


astippich requested changes to this revision.
astippich added a comment.
This revision now requires changes to proceed.


  The stringlist case is still not handled. And a test case for multiple ints (2 ReleaseYear properties) will also likely fail. When going with JSON, I think this has to be done by always inserting values as an array (even if there is only one value), and removing this during deserialization. Stringlist will then be an array in an array in JSON. That will ensure that the map is of the same structure as it was put in, and this should also be possible to do in a backwards compatible way.
  
  What do you think of using QDataStream here? This would require a db version bump, of course.

INLINE COMMENTS

> astippich wrote in propertydata.cpp:83
> I think that will break all properties containing doubles, of which there are a few.

Now ints are converted to doubles, which is not fatal, but IMHO also not very clean either. But since JSON only knows doubles, this is what we get. Only way out in this case is to query PropertyInfo::valueType, and do the conversion based on this.

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D19087

To: bruns, #baloo, #frameworks, ngraham, poboiko, astippich
Cc: kde-frameworks-devel, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190219/e86a75ba/attachment.html>


More information about the Kde-frameworks-devel mailing list