fix: Auto calculate the settings size on serialization (#832)
* The constant SETTINGS_CONST was hardcoded and needed to be updated whenever an additional setting was added * This is no longer necessary as the settings size will be determined automatically on settings persistence * New settings need to be added (as previously) in saveToFile - that's it --- While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? YES --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
|
||||
// Forward declarations
|
||||
class FsFile;
|
||||
|
||||
class CrossPointSettings {
|
||||
private:
|
||||
// Private constructor for singleton
|
||||
@@ -190,6 +193,9 @@ class CrossPointSettings {
|
||||
}
|
||||
int getReaderFontId() const;
|
||||
|
||||
// If count_only is true, returns the number of settings items that would be written.
|
||||
uint8_t writeSettings(FsFile& file, bool count_only = false) const;
|
||||
|
||||
bool saveToFile() const;
|
||||
bool loadFromFile();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user