From c3ff41b0c222b979b45ba35db15b5c78c26e0849 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 12 Jul 2018 12:08:46 -0500 Subject: [PATCH] Moved read_ini and write_ini to cpp file, added more comments --- xs/src/libslic3r/Config.cpp | 10 ++++++++++ xs/src/libslic3r/Config.hpp | 15 +++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index ec0b1b576..2dc1a2bf1 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -56,6 +56,16 @@ Config::set(const t_config_option_key& opt_key, const double value) { } +void +read_ini(const std::string& file) +{ +} + +void +write_ini(const std::string& file) const +{ +} + } // namespace Slic3r diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index 43e7f6ca5..e2e9a6c34 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -27,13 +27,24 @@ using config_ptr = std::shared_ptr; class Config : public DynamicPrintConfig { public: + + /// Factory method to construct a Config with all default values loaded. static std::shared_ptr new_from_defaults(); + + /// Factory method to construct a Config with specific default values loaded. static std::shared_ptr new_from_defaults(std::initializer_list init); + + /// Factory method to construct a Config with specific default values loaded. static std::shared_ptr new_from_defaults(t_config_option_keys init); + + /// Factory method to construct a Config from CLI options. static std::shared_ptr new_from_cli(const int& argc, const char* argv[]); - void write_ini(const std::string& file) { save(file); } - void read_ini(const std::string& file) { load(file); } + /// Write a windows-style opt=value ini file with categories from the configuration store. + void write_ini(const std::string& file) const; + + /// Parse a windows-style opt=value ini file with categories and load the configuration store. + void read_ini(const std::string& file); /// Template function to retrieve and cast in hopefully a slightly nicer /// format than longwinded dynamic_cast<>