#pragma once #include "CmEditorPrerequisites.h" namespace CamelotEditor { class Preferences { public: void setValue(const String& key, const String& value, CamelotFramework::UINT32 arrayIdx = 0); void addValue(const String& key, const String& value); const String& getValue(const String& key, const String& defaultValue = StringUtil::BLANK, CamelotFramework::UINT32 arrayIdx = 0); void setValue(const String& key, const int value, CamelotFramework::UINT32 arrayIdx = 0); void addValue(const String& key, const int value); int getValue(const String& key, int defaultValue = 0, CamelotFramework::UINT32 arrayIdx = 0); void setValue(const String& key, float value, CamelotFramework::UINT32 arrayIdx = 0); void addValue(const String& key, float value); float getValue(const String& key, float defaultValue = 0.0f, CamelotFramework::UINT32 arrayIdx = 0); CamelotFramework::UINT32 getNumValues(const String& key); void save(const String& path, bool overwrite = true) const; void load(const String& path); private: struct PrefStringEntries { Vector::type entries; }; struct PrefIntEntries { Vector::type entries; }; struct PrefFloatEntries { Vector::type entries; }; enum ValueMapType { VMT_String, VMT_Int, VMT_Float }; struct KeyMapIndex { ValueMapType mapType; CamelotFramework::UINT32 entryIdx; }; struct EntryToSave { String name; String value; }; Map::type mKeys; Vector::type mStringEntries; Vector::type mIntEntries; Vector::type mFloatEntries; bool isKeyValid(const String& key) const; }; }