diff --git a/Jupiter/Config.cpp b/Jupiter/Config.cpp index b8b6969..ecd6683 100644 --- a/Jupiter/Config.cpp +++ b/Jupiter/Config.cpp @@ -93,9 +93,9 @@ bool Jupiter::Config::write() return this->write(m_name.c_str()); } -bool Jupiter::Config::write(const char *) +bool Jupiter::Config::write(const char *in_filename) { - return false; + return this->write_internal(in_filename); } bool Jupiter::Config::write(const Jupiter::ReadableString &in_filename) @@ -134,6 +134,11 @@ bool Jupiter::Config::read_internal(const char *) return false; } +bool Jupiter::Config::write_internal(const char *) +{ + return false; +} + void Jupiter::Config::Buffer::set_length(size_t in_length) { this->length = in_length; diff --git a/Jupiter/Config.h b/Jupiter/Config.h index 477ccf9..5e908c7 100644 --- a/Jupiter/Config.h +++ b/Jupiter/Config.h @@ -150,7 +150,7 @@ namespace Jupiter * @param in_filename Name of the file to write to * @return True on success, false otherwise */ - virtual bool write(const char *in_filename); + bool write(const char *in_filename); /** * @brief Writes config data to a file @@ -221,6 +221,7 @@ namespace Jupiter protected: virtual bool read_internal(const char *in_filename); + virtual bool write_internal(const char *in_filename); /** Name of this Config section. This is empty or the filename at the root level. */ Jupiter::CStringS m_name; diff --git a/Jupiter/INIConfig.cpp b/Jupiter/INIConfig.cpp index 3b6f5cf..ce92230 100644 --- a/Jupiter/INIConfig.cpp +++ b/Jupiter/INIConfig.cpp @@ -85,7 +85,7 @@ void Jupiter::INIConfig::write_helper(FILE *in_file, const Jupiter::Config *in_s } } -bool Jupiter::INIConfig::write(const char *in_filename) +bool Jupiter::INIConfig::write_internal(const char *in_filename) { // Open file FILE *file = fopen(in_filename, "wb"); diff --git a/Jupiter/INIConfig.h b/Jupiter/INIConfig.h index 56b8eac..0e47442 100644 --- a/Jupiter/INIConfig.h +++ b/Jupiter/INIConfig.h @@ -36,20 +36,13 @@ namespace Jupiter { /** * @brief INI-based Config class + * @see Jupiter::Config */ class JUPITER_API INIConfig : public Jupiter::Config { - public: - /** - * @brief Writes config data to a file - * - * @param in_filename Name of the file to write to - * @return True on success, false otherwise - */ - bool write(const char *in_filename); - private: - bool read_internal(const char *in_filename); + bool read_internal(const char *in_filename) override; + bool write_internal(const char *in_filename) override; void write_helper(FILE *in_file, const Jupiter::Config *in_section, size_t in_depth); }; } diff --git a/Jupiter/Plugin.cpp b/Jupiter/Plugin.cpp index b4b7455..a37541a 100644 --- a/Jupiter/Plugin.cpp +++ b/Jupiter/Plugin.cpp @@ -107,7 +107,7 @@ const Jupiter::ReadableString &Jupiter::Plugin::getName() const return Jupiter::Plugin::name; } -const Jupiter::Config &Jupiter::Plugin::getConfig() const +Jupiter::Config &Jupiter::Plugin::getConfig() { return Jupiter::Plugin::config; } diff --git a/Jupiter/Plugin.h b/Jupiter/Plugin.h index 39a6ba2..297ebb0 100644 --- a/Jupiter/Plugin.h +++ b/Jupiter/Plugin.h @@ -96,7 +96,7 @@ namespace Jupiter * * @return Plugin's configuration file. */ - Jupiter::Config &getConfig() const; + Jupiter::Config &getConfig(); /** * @brief Initializes the plugin.