#pragma once #include #include #include "Lib/mINI/src/mini/ini.h" #include "UltraController.h" #include "LUSMacros.h" namespace Ship { class GlobalCtx2; class ConfigFile { public: ConfigFile(std::shared_ptr Context, const std::string& Path); ~ConfigFile(); bool Save(); // Expose the ini values. mINI::INIMap& operator[](const std::string& Section); mINI::INIMap get(const std::string& Section); bool has(const std::string& Section); bool remove(const std::string& Section); void clear(); std::size_t size() const; std::shared_ptr GetContext() { return Context.lock(); } protected: bool CreateDefaultConfig(); private: mINI::INIFile File; mINI::INIStructure Val; std::weak_ptr Context; std::string Path; }; }