aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/cru/ui/mapper/ThicknessMapper.hpp22
-rw-r--r--src/common/CMakeLists.txt3
-rw-r--r--src/ui/mapper/ThicknessMapper.cpp11
-rw-r--r--vcpkg.json3
4 files changed, 37 insertions, 2 deletions
diff --git a/include/cru/ui/mapper/ThicknessMapper.hpp b/include/cru/ui/mapper/ThicknessMapper.hpp
new file mode 100644
index 00000000..90d1ef46
--- /dev/null
+++ b/include/cru/ui/mapper/ThicknessMapper.hpp
@@ -0,0 +1,22 @@
+#pragma once
+#include "Mapper.hpp"
+
+#include "../Base.hpp"
+#include "cru/common/Base.hpp"
+#include "cru/xml/XmlNode.hpp"
+
+namespace cru::ui::mapper {
+class ThicknessMapper : public BasicMapper<Thickness> {
+ public:
+ CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ThicknessMapper)
+
+ public:
+ bool SupportMapFromString() override { return true; }
+ bool SupportMapFromXml() override { return true; }
+ bool XmlElementIsOfThisType(xml::XmlElementNode* node) override;
+
+ protected:
+ std::unique_ptr<Thickness> DoMapFromString(String str) override;
+ std::unique_ptr<Thickness> DoMapFromXml(xml::XmlElementNode* node) override;
+};
+} // namespace cru::ui::mapper
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 92ef3d4c..300fa03e 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -27,5 +27,6 @@ else()
target_compile_definitions(cru_base PUBLIC CRU_PLATFORM_LINUX)
endif()
+find_package(double-conversion CONFIG REQUIRED)
find_package(Microsoft.GSL CONFIG REQUIRED)
-target_link_libraries(cru_base PUBLIC Microsoft.GSL::GSL)
+target_link_libraries(cru_base PUBLIC Microsoft.GSL::GSL double-conversion::double-conversion)
diff --git a/src/ui/mapper/ThicknessMapper.cpp b/src/ui/mapper/ThicknessMapper.cpp
new file mode 100644
index 00000000..684d0a4b
--- /dev/null
+++ b/src/ui/mapper/ThicknessMapper.cpp
@@ -0,0 +1,11 @@
+#include "cru/ui/mapper/ThicknessMapper.hpp"
+#include "cru/xml/XmlNode.hpp"
+
+namespace cru::ui::mapper {
+bool ThicknessMapper::XmlElementIsOfThisType(xml::XmlElementNode *node) {
+ if (node->GetTag() == u"Thickness") {
+ return true;
+ }
+ return false;
+}
+} // namespace cru::ui::mapper
diff --git a/vcpkg.json b/vcpkg.json
index a2bb1f4c..1a110ef9 100644
--- a/vcpkg.json
+++ b/vcpkg.json
@@ -4,6 +4,7 @@
"version": "0.0.1",
"dependencies": [
"ms-gsl",
- "gtest"
+ "gtest",
+ "double-conversion"
]
}