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

Stefan BrĂ¼ns noreply at phabricator.kde.org
Sat Mar 30 17:16:47 GMT 2019


bruns added a comment.


  In D19087#440361 <https://phabricator.kde.org/D19087#440361>, @astippich wrote:
  
  > This still alters the map during deserialization. Lists are converted into multi single properties afterwards. As I said, due to backwards-compatibility lists should stay lists.
  
  
  
  
  1. No extractor inserts lists, just single values.
  2. Extractors are allowed and do insert different values for the same property.
  
  -> Lists do not exists as property values. Supporting lists were a new feature.
  
  Both SimpleExtractionResult::properties() (used by the temp extractor) and Baloo::File::properties() return a KFileMetadata::PropertyMap, and it seems only logical both behave likewise. SimpleExtractionResult::properties() already returns the properties one by one, now Baloo::File::properties() does the same.
  
  The current behavior of the Baloo serialization (and thus the deserialization result) is illogical - when you insert a single value, you get back a single non-list QVariant, when inserting multiple values, this is silently converted to a QVariantList. The return type depends on the number of values. The SimpleExtractionResult behavior is consistent - `PropertyMap::find()` returns the first value, `PropertyMap::values()`returns all values, independent on the number of values.
  
  Given the choice between an inconsistent and illogical behavior on one hand, and consistent and logical on the other, I definitely prefer the second one.

REPOSITORY
  R293 Baloo

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

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


More information about the Kde-frameworks-devel mailing list