-
Committer:
Stefan Brüns
-
Date:
2019-10-12 22:42:36 UTC
-
Revision ID:
git-v1:ecebbf85dc9196e9e492b7b0a3921a526ea12f49
Add standalone conversion functions for PropertyMap to Json and vice versa
Summary:
Baloo caches property data, and uses Json for serializing it. For storing,
it populates a QVariantMap, where multiple values for the same key are
stored as a QVariantList (QJsonObject::fromVariantMap only handles one
value per key). After deserialization, the KFileMetaData::PropertyMap
also contains QVariantLists for keys with multiple values.
To handle multiple property values per key correctly, do the serialization
and deserialization manually. This also save the temporary QVariantMap
on deserialization.
Add unit tests to test roundtrip from PropertyMap to JSon and back. This
is now possible as the serialization code is no longer done inline.
It makes it also easier to keep serialization and deserialization in
sync, as it is no longer in different files (src/file/result.cpp and
src/file/extractor/file.cpp).
Test Plan: ctest
Reviewers: #baloo, #frameworks, ngraham, poboiko, astippich
Reviewed By: #baloo, ngraham, astippich
Subscribers: mgallien, kde-frameworks-devel
Tags: #frameworks, #baloo
Differential Revision: https://phabricator.kde.org/D19087