aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-04 22:06:39 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-04 22:06:39 +0800
commit8bea03e0811588e741050b598b8123865b333999 (patch)
treedab70865e53fca11960cb899454d64db9e8ed98d /src
parent1a6111e3f02b0a9cff0f81fb524b4dfb7d69854b (diff)
downloadcru-8bea03e0811588e741050b598b8123865b333999.tar.gz
cru-8bea03e0811588e741050b598b8123865b333999.tar.bz2
cru-8bea03e0811588e741050b598b8123865b333999.zip
Move toml to base.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/base/CMakeLists.txt2
-rw-r--r--src/base/toml/TomlDocument.cpp (renamed from src/toml/TomlDocument.cpp)6
-rw-r--r--src/base/toml/TomlParser.cpp (renamed from src/toml/TomlParser.cpp)7
-rw-r--r--src/toml/CMakeLists.txt6
5 files changed, 10 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9f9c205f..d4df1752 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,6 +2,4 @@ add_subdirectory(base)
add_subdirectory(platform)
add_subdirectory(ui)
add_subdirectory(parse)
-add_subdirectory(toml)
-
add_subdirectory(ThemeBuilder)
diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt
index ef5afe3c..3cffb125 100644
--- a/src/base/CMakeLists.txt
+++ b/src/base/CMakeLists.txt
@@ -14,6 +14,8 @@ add_library(CruBase
io/MemoryStream.cpp
log/Logger.cpp
log/StdioLogTarget.cpp
+ toml/TomlDocument.cpp
+ toml/TomlParser.cpp
xml/XmlNode.cpp
xml/XmlParser.cpp
)
diff --git a/src/toml/TomlDocument.cpp b/src/base/toml/TomlDocument.cpp
index af9e2ac8..fa155c80 100644
--- a/src/toml/TomlDocument.cpp
+++ b/src/base/toml/TomlDocument.cpp
@@ -1,4 +1,4 @@
-#include "cru/toml/TomlDocument.h"
+#include "cru/base/toml/TomlDocument.h"
namespace cru::toml {
std::optional<std::string> TomlSection::GetValue(const std::string& key) const {
@@ -44,6 +44,8 @@ void TomlDocument::SetSection(const std::string& name, TomlSection section) {
sections_[name] = std::move(section);
}
-void TomlDocument::DeleteSection(const std::string& name) { sections_.erase(name); }
+void TomlDocument::DeleteSection(const std::string& name) {
+ sections_.erase(name);
+}
} // namespace cru::toml
diff --git a/src/toml/TomlParser.cpp b/src/base/toml/TomlParser.cpp
index 1aea5b73..a45af712 100644
--- a/src/toml/TomlParser.cpp
+++ b/src/base/toml/TomlParser.cpp
@@ -1,6 +1,6 @@
-#include "cru/toml/TomlParser.h"
+#include "cru/base/toml/TomlParser.h"
#include "cru/base/StringUtil.h"
-#include "cru/toml/TomlDocument.h"
+#include "cru/base/toml/TomlDocument.h"
namespace cru::toml {
TomlParser::TomlParser(std::string input) : input_(std::move(input)) {}
@@ -18,7 +18,8 @@ TomlDocument TomlParser::Parse() {
}
void TomlParser::DoParse(TomlDocument& document) {
- std::vector<std::string> lines = cru::string::Split(input_, "\n", cru::string::SplitOptions::RemoveSpace);
+ std::vector<std::string> lines =
+ cru::string::Split(input_, "\n", cru::string::SplitOptions::RemoveSpace);
std::string current_section_name;
diff --git a/src/toml/CMakeLists.txt b/src/toml/CMakeLists.txt
deleted file mode 100644
index 33b31b8f..00000000
--- a/src/toml/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-add_library(CruToml
- TomlDocument.cpp
- TomlParser.cpp
-)
-target_compile_definitions(CruToml PRIVATE CRU_TOML_EXPORT_API)
-target_link_libraries(CruToml PUBLIC CruBase)