5#include "../core_export.hpp"
6#include "../collections/generic/sorted_dictionary.hpp"
7#include "../collections/specialized/string_collection.hpp"
8#include "../io/directory.hpp"
9#include "../io/file.hpp"
10#include "../io/path.hpp"
11#include "../iequatable.hpp"
17 namespace configuration {
92 bool auto_save() const noexcept;
110 void auto_save(
bool value) noexcept;
131 xtd::
string bottom_file_comment() const noexcept;
158 const
xtd::
string& file_path() const noexcept;
187 std::
optional<std::reference_wrapper<std::iostream>> stream() const noexcept;
210 xtd::
string top_file_comment() const noexcept;
239 using
object::equals;
249 virtual
void from_string(const
xtd::
string& text);
268 void load(const
xtd::
string& file_path);
271 void load(std::istream& stream);
279 xtd::
string read(const
xtd::
string& key, const
xtd::
string& default_value) noexcept;
286 template<typename type_t>
287 type_t read(const
xtd::
string& key, const type_t& default_value) {
303 template<
typename type_t>
305 return xtd::parse<type_t>(read_string(section, key,
xtd::string::format(
"{}", default_value)));
401 void remove_all_keys(const
xtd::
string& section) noexcept;
467 void save_as(const
xtd::
string& file_path);
471 void save_as(std::ostream& stream);
477 xtd::
string to_string() const noexcept override;
501 void write(const
xtd::
string& key, const
xtd::
string& value) noexcept;
524 template<typename type_t>
525 void write(const
xtd::
string& key, type_t&& value) {
576 template<
typename type_t>
619 bool auto_save_ =
false;
620 std::map<xtd::string, string_dictionary> after_key_value_comment_;
621 std::map<xtd::string, xtd::string> after_section_comment_;
622 std::map<xtd::string, string_dictionary> before_key_value_comment_;
623 std::map<xtd::string, xtd::string> before_section_comment_;
626 std::map<xtd::string, string_dictionary> key_value_comment_;
627 std::map<xtd::string, xtd::string> section_comment_;
628 std::map<xtd::string, string_dictionary> section_key_values_;
629 std::iostream* stream_ =
nullptr;
Represents text as a sequence of character units.
Definition basic_string.hpp:79
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.hpp:124
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:71
Represents an object for storing and retrieving configuration information using text files in INI for...
Definition file_settings.hpp:32
xtd::string read(const xtd::string §ion, const xtd::string &key, const xtd::string &default_value) noexcept
Reads a value for specified key in the specified section. If not found default value is used.
file_settings() noexcept=default
Initialize an xtd::configuration::file_settings without loading a file.
void write(const xtd::string §ion, const xtd::string &key, const xtd::string &value) noexcept
Writes a specified value for specified key in the specified section.
void remove(const xtd::string &key) noexcept
Removes the specified key from the global section.
void write(const xtd::string §ion, const xtd::string &key, type_t &&value)
Writes a specified value for specified key in the specified section.
Definition file_settings.hpp:577
void remove_all_keys() noexcept
Removes all keys from the global section.
xtd::collections::generic::sorted_dictionary< xtd::string, xtd::string > string_dictionary
Represents a xtd::collections::generic::sorted_dictionary with the key and the value strongly typed t...
Definition file_settings.hpp:38
void remove(const xtd::string §ion, const xtd::string &key) noexcept
Removes the specified key from the specified section.
type_t read(const xtd::string §ion, const xtd::string &key, const type_t &default_value)
Reads a value for specified key in the specified section. If not found default value is used.
Definition file_settings.hpp:304
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
std::map< key_t, value_t, helpers::comparer< key_t >, helpers::allocator< std::pair< const key_t, value_t > > > sorted_dictionary
Represents a collection of key/value pairs that are sorted on the key.
Definition sorted_dictionary.hpp:36
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::collections::generic::list< xtd::string > string_collection
Represents a collection of strings.
Definition string_collection.hpp:27
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.hpp:175
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10