diff options
author | crupest <crupest@outlook.com> | 2022-02-08 16:53:51 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-08 16:53:51 +0800 |
commit | 74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch) | |
tree | 744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/toml/TomlDocument.hpp | |
parent | b90c398de829d1ba5329651d75bae82f5e4085fe (diff) | |
download | cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2 cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip |
...
Diffstat (limited to 'include/cru/toml/TomlDocument.hpp')
-rw-r--r-- | include/cru/toml/TomlDocument.hpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/include/cru/toml/TomlDocument.hpp b/include/cru/toml/TomlDocument.hpp deleted file mode 100644 index 1e5caf71..00000000 --- a/include/cru/toml/TomlDocument.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include "Base.hpp" - -#include "cru/common/Base.hpp" -#include "cru/common/String.hpp" - -#include <optional> -#include <unordered_map> - -namespace cru::toml { -class CRU_TOML_API TomlSection { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(TomlSection) - CRU_DEFAULT_COPY(TomlSection) - CRU_DEFAULT_MOVE(TomlSection) - - public: - std::optional<String> GetValue(const String& key) const; - void SetValue(const String& key, String value); - void DeleteValue(const String& key); - - auto begin() { return values_.begin(); } - auto end() { return values_.end(); } - auto begin() const { return values_.begin(); } - auto end() const { return values_.end(); } - auto cbegin() const { return values_.cbegin(); } - auto cend() const { return values_.cend(); } - - private: - std::unordered_map<String, String> values_; -}; - -class CRU_TOML_API TomlDocument { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(TomlDocument) - CRU_DEFAULT_COPY(TomlDocument) - CRU_DEFAULT_MOVE(TomlDocument) - - public: - TomlSection* GetSection(const String& name); - TomlSection* GetSectionOrCreate(const String& name); - const TomlSection* GetSection(const String& name) const; - void SetSection(const String& name, TomlSection section); - void DeleteSection(const String& name); - - auto begin() { return sections_.begin(); } - auto end() { return sections_.end(); } - auto begin() const { return sections_.begin(); } - auto end() const { return sections_.end(); } - auto cbegin() const { return sections_.cbegin(); } - auto cend() const { return sections_.cend(); } - - private: - std::unordered_map<String, TomlSection> sections_; -}; -} // namespace cru::toml |