92 [[nodiscard]] auto
auto_save() const noexcept ->
bool;
242 [[nodiscard]] auto
equals(const
xtd::
object& obj) const noexcept ->
bool override;
282 [[nodiscard]] auto
read(const
xtd::
string& key, const
xtd::
string& default_value) noexcept ->
xtd::
string;
289 template<class type_t>
290 [[nodiscard]] auto
read(const
xtd::
string& key, const type_t& default_value) -> type_t {
306 template<
class type_t>
308 return xtd::parse<type_t>(read_string(section, key, xtd::string::format(
"{}", default_value)));
504 auto
write(const
xtd::
string& key, const
xtd::
string& value) noexcept ->
void;
527 template<class type_t>
528 auto
write(const
xtd::
string& key, type_t&& value) ->
void {
579 template<
class type_t>
581 write_string(section, key, xtd::string::format(
"{}", value));
622 bool auto_save_ =
false;
632 std::iostream* stream_ =
nullptr;
static const basic_string empty_string
Definition basic_string.hpp:111
auto auto_save() const noexcept -> bool
Gets whether save should be called on the xtd::configuration::file_settings destructor.
auto equals(const xtd::object &obj) const noexcept -> bool override
Indicates whether the current object is equal to another object of the same type.
auto load(const xtd::string &file_path) -> void
Loads settings from specified file.
auto write(const xtd::string &key, const xtd::string &value) noexcept -> void
Writes a specified value for specified key in the global section.
auto read(const xtd::string §ion, const xtd::string &key, const type_t &default_value) -> type_t
Reads a value for specified key in the specified section. If not found default value is used.
Definition file_settings.hpp:307
auto write(const xtd::string §ion, const xtd::string &key, type_t &&value) -> void
Writes a specified value for specified key in the specified section.
Definition file_settings.hpp:580
auto keys() const noexcept -> string_collection
Gets all keys from global section.
auto bottom_file_comment() const noexcept -> xtd::string
Gets bottom file comment text.
file_settings() noexcept=default
Initialize an xtd::configuration::file_settings without loading a file.
auto remove_all_keys() noexcept -> void
Removes all keys from the global section.
auto save_as(const xtd::string &file_path) -> void
Save current settings in the specified file path.
virtual auto from_string(const xtd::string &text) -> void
Sets the current settings with parsing the xtd::string in INI format.
auto top_file_comment() const noexcept -> xtd::string
Gets top file comment text.
auto read(const xtd::string &key, const xtd::string &default_value) noexcept -> xtd::string
Reads a value for specified key in the global section. If not found default value is used.
auto read(const xtd::string §ion, const xtd::string &key, const xtd::string &default_value) noexcept -> xtd::string
Reads a value for specified key in the specified section. If not found default value is used.
auto write(const xtd::string §ion, const xtd::string &key, const xtd::string &value) noexcept -> void
Writes a specified value for specified key in the specified section.
auto key_values() const noexcept -> string_dictionary
Gets all key-value pairs from global section.
xtd::collections::specialized::string_collection string_collection
Represents a collection of strings.
Definition file_settings.hpp:41
auto reset() -> void
Reset current settings.
auto save() -> void
Save current settings.
auto remove(const xtd::string &key) noexcept -> void
Removes the specified key from the global section.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current setting in INI format.
auto remove(const xtd::string §ion, const xtd::string &key) noexcept -> void
Removes the specified key from the specified section.
auto file_path() const noexcept -> const xtd::string &
Gets the file path of the current instance.
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
auto sections() const noexcept -> string_collection
Gets all sections.
auto stream() const noexcept -> std::optional< xtd::ref< std::iostream > >
Gets the stream of the current instance.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
object()=default
Create a new instance of the ultimate base class object.
Contains core_export_ keyword.
Contains xtd::io::directory class.
Contains xtd::io::file class.
std::map< key_t, value_t, lesser_t, allocator_t > sorted_dictionary
Represents a collection of key/value pairs that are sorted on the key.
Definition sorted_dictionary.hpp:38
#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
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
xtd::reference_wrapper_object< type_t > ref
The xtd::ref object is a reference wrapper.
Definition ref.hpp:25
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
value_t parse(const std::string &str)
Convert a string into a type.
Definition parse.hpp:34
@ other
The operating system is other.
Definition platform_id.hpp:60
Contains xtd::iequatable interface.
Contains the types that provide the programming model for handling configuration data.
Definition file_settings.hpp:17
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::io::path class.
Contains xtd::collections::generic::sorted_dictionary <key_t, value_t> class.
Contains xtd::collections::specialized::string_collection alias.