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 /include | |
| parent | 1a6111e3f02b0a9cff0f81fb524b4dfb7d69854b (diff) | |
| download | cru-8bea03e0811588e741050b598b8123865b333999.tar.gz cru-8bea03e0811588e741050b598b8123865b333999.tar.bz2 cru-8bea03e0811588e741050b598b8123865b333999.zip | |
Move toml to base.
Diffstat (limited to 'include')
| -rw-r--r-- | include/cru/base/toml/TomlDocument.h (renamed from include/cru/toml/TomlDocument.h) | 18 | ||||
| -rw-r--r-- | include/cru/base/toml/TomlParser.h (renamed from include/cru/toml/TomlParser.h) | 12 | ||||
| -rw-r--r-- | include/cru/toml/Base.h | 11 |
3 files changed, 7 insertions, 34 deletions
diff --git a/include/cru/toml/TomlDocument.h b/include/cru/base/toml/TomlDocument.h index 22442096..c0dc68af 100644 --- a/include/cru/toml/TomlDocument.h +++ b/include/cru/base/toml/TomlDocument.h @@ -1,20 +1,13 @@ #pragma once -#include "Base.h" - -#include "cru/base/Base.h" +#include "../Base.h" #include <optional> #include <unordered_map> #include <string> namespace cru::toml { -class CRU_TOML_API TomlSection { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(TomlSection) - CRU_DEFAULT_COPY(TomlSection) - CRU_DEFAULT_MOVE(TomlSection) - +class CRU_BASE_API TomlSection { public: std::optional<std::string> GetValue(const std::string& key) const; void SetValue(const std::string& key, std::string value); @@ -31,12 +24,7 @@ class CRU_TOML_API TomlSection { std::unordered_map<std::string, std::string> values_; }; -class CRU_TOML_API TomlDocument { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(TomlDocument) - CRU_DEFAULT_COPY(TomlDocument) - CRU_DEFAULT_MOVE(TomlDocument) - +class CRU_BASE_API TomlDocument { public: TomlSection* GetSection(const std::string& name); TomlSection* GetSectionOrCreate(const std::string& name); diff --git a/include/cru/toml/TomlParser.h b/include/cru/base/toml/TomlParser.h index b6532931..ac7d0217 100644 --- a/include/cru/toml/TomlParser.h +++ b/include/cru/base/toml/TomlParser.h @@ -1,24 +1,20 @@ #pragma once -#include "cru/base/Exception.h" -#include "cru/toml/TomlDocument.h" +#include "../Exception.h" +#include "TomlDocument.h" #include <optional> namespace cru::toml { // A very simple and tolerant TOML parser. -class CRU_TOML_API TomlParsingException : public Exception { +class CRU_BASE_API TomlParsingException : public Exception { public: using Exception::Exception; }; -class CRU_TOML_API TomlParser { +class CRU_BASE_API TomlParser : public Object { public: explicit TomlParser(std::string input); - - CRU_DELETE_COPY(TomlParser) - CRU_DELETE_MOVE(TomlParser) - ~TomlParser(); public: diff --git a/include/cru/toml/Base.h b/include/cru/toml/Base.h deleted file mode 100644 index 76c7ee71..00000000 --- a/include/cru/toml/Base.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef CRU_IS_DLL -#ifdef CRU_TOML_EXPORT_API -#define CRU_TOML_API __declspec(dllexport) -#else -#define CRU_TOML_API __declspec(dllimport) -#endif -#else -#define CRU_TOML_API -#endif |
