diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-04 22:06:39 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-04 22:06:39 +0800 |
| commit | 8bea03e0811588e741050b598b8123865b333999 (patch) | |
| tree | dab70865e53fca11960cb899454d64db9e8ed98d /src/toml/TomlDocument.cpp | |
| parent | 1a6111e3f02b0a9cff0f81fb524b4dfb7d69854b (diff) | |
| download | cru-8bea03e0811588e741050b598b8123865b333999.tar.gz cru-8bea03e0811588e741050b598b8123865b333999.tar.bz2 cru-8bea03e0811588e741050b598b8123865b333999.zip | |
Move toml to base.
Diffstat (limited to 'src/toml/TomlDocument.cpp')
| -rw-r--r-- | src/toml/TomlDocument.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/toml/TomlDocument.cpp b/src/toml/TomlDocument.cpp deleted file mode 100644 index af9e2ac8..00000000 --- a/src/toml/TomlDocument.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "cru/toml/TomlDocument.h" - -namespace cru::toml { -std::optional<std::string> TomlSection::GetValue(const std::string& key) const { - auto it = values_.find(key); - if (it == values_.end()) { - return std::nullopt; - } - return it->second; -} - -void TomlSection::SetValue(const std::string& key, std::string value) { - values_[key] = std::move(value); -} - -void TomlSection::DeleteValue(const std::string& key) { values_.erase(key); } - -TomlSection* TomlDocument::GetSection(const std::string& name) { - auto it = sections_.find(name); - if (it == sections_.end()) { - return nullptr; - } - return &it->second; -} - -const TomlSection* TomlDocument::GetSection(const std::string& name) const { - auto it = sections_.find(name); - if (it == sections_.end()) { - return nullptr; - } - return &it->second; -} - -TomlSection* TomlDocument::GetSectionOrCreate(const std::string& name) { - auto it = sections_.find(name); - if (it == sections_.end()) { - sections_[name] = TomlSection(); - return §ions_[name]; - } - return &it->second; -} - -void TomlDocument::SetSection(const std::string& name, TomlSection section) { - sections_[name] = std::move(section); -} - -void TomlDocument::DeleteSection(const std::string& name) { sections_.erase(name); } - -} // namespace cru::toml |
