New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[settings] Serializer Interface #17062
[settings] Serializer Interface #17062
Conversation
7bbafde
to
c834e01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the current code guidelines.
xbmc/settings/lib/SettingsManager.h
Outdated
@@ -92,7 +90,7 @@ class CSettingsManager : public ISettingCreator, public ISettingControlCreator, | |||
\param root XML node | |||
\return True if the setting values were successfully saved, false otherwise | |||
*/ | |||
bool Save(TiXmlNode *root) const override; | |||
bool Save(TiXmlNode *root) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left-align
*
and&
to the base type they modify.
https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#52-pointer-and-reference-types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change only removes the override
keyword. Furthermore a following commit completely changes this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. if the commit which remove this line gets reverted the alignment will be wrong again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and if I either fix it in the same commit (which IMO is ugly) or in a cleanup commit and the whole PR is reverted it is also wrong again.
I completely agree that we should follow the coding guidelines in newly added code.
But as long as nobody has fixed all the existing code I'm not going to fix the coding style of every line I touch in existing code. That just makes it much more work to edit existing code and it puts the code into a completely messed up state coding style wise because some lines are fixed but most others are not which results in a mix of completely different coding styles throughout a file.
c834e01
to
671aab1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ISubSettings were only used in CSettings so no need to have them in CSettingsManager.
671aab1
to
cf8512a
Compare
…izer_interface [settings] Serializer Interface
Description
This PR introduces the
ISettingsValueSerializerInterface
and its first implementationCSettingsValueXmlSerializer
which generates the exact same output as the currently builtin settings XML serializer.Furthermore I noticed that the
ISubSettings
handling is currently integrated in the "generic"CSettingsManager
but is actually only used in the Kodi "GUI settings" specificCSettings
. It is not used for add-on settings or other settings in Kodi. Therefore it makes more sense to move this logic fromCSettingsManager
toCSettings
. This also allows us to directly use the newISettingsValueSerializerInterface
inCSettingsManager
instead of the hardcoded / builtin XML serialization.I plan to do similar work for deserializing settings values and for deserializing settings definitions.
Motivation and Context
For python based scrapers we want to be able to pass the path-specific scraper settings to the python scraper. Since JSON is much closer to python than XML we need a serializer to turn settings into JSON. Therefore I wanted to introduce a clean interface to be able to implement both XML and JSON serialization of settings values. The PR for JSON serialization and scraper integration will follow.
How Has This Been Tested?
I compared the generated
guisettings.xml
with the original one and they are identical (apart from the order of the settings values).Types of change
Checklist: