From 74bb9cd27242b9320f99ff4d2b50c3051576cc14 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 8 Feb 2022 16:53:51 +0800 Subject: ... --- include/cru/ui/mapper/BorderStyleMapper.h | 20 +++++ include/cru/ui/mapper/BorderStyleMapper.hpp | 20 ----- include/cru/ui/mapper/BrushMapper.h | 20 +++++ include/cru/ui/mapper/BrushMapper.hpp | 20 ----- include/cru/ui/mapper/ColorMapper.h | 19 +++++ include/cru/ui/mapper/ColorMapper.hpp | 19 ----- include/cru/ui/mapper/CornerRadiusMapper.h | 17 ++++ include/cru/ui/mapper/CornerRadiusMapper.hpp | 17 ---- include/cru/ui/mapper/CursorMapper.h | 21 +++++ include/cru/ui/mapper/CursorMapper.hpp | 21 ----- include/cru/ui/mapper/FontMapper.h | 19 +++++ include/cru/ui/mapper/FontMapper.hpp | 19 ----- include/cru/ui/mapper/Mapper.h | 92 ++++++++++++++++++++++ include/cru/ui/mapper/Mapper.hpp | 92 ---------------------- include/cru/ui/mapper/MapperRegistry.h | 58 ++++++++++++++ include/cru/ui/mapper/MapperRegistry.hpp | 58 -------------- include/cru/ui/mapper/PointMapper.h | 18 +++++ include/cru/ui/mapper/PointMapper.hpp | 18 ----- include/cru/ui/mapper/SizeMapper.h | 18 +++++ include/cru/ui/mapper/SizeMapper.hpp | 18 ----- include/cru/ui/mapper/ThicknessMapper.h | 22 ++++++ include/cru/ui/mapper/ThicknessMapper.hpp | 22 ------ include/cru/ui/mapper/style/AndConditionMapper.h | 25 ++++++ include/cru/ui/mapper/style/AndConditionMapper.hpp | 25 ------ include/cru/ui/mapper/style/BorderStylerMapper.h | 28 +++++++ include/cru/ui/mapper/style/BorderStylerMapper.hpp | 28 ------- .../ui/mapper/style/ClickStateConditionMapper.h | 26 ++++++ .../ui/mapper/style/ClickStateConditionMapper.hpp | 26 ------ include/cru/ui/mapper/style/CursorStylerMapper.h | 26 ++++++ include/cru/ui/mapper/style/CursorStylerMapper.hpp | 26 ------ include/cru/ui/mapper/style/FocusConditionMapper.h | 26 ++++++ .../cru/ui/mapper/style/FocusConditionMapper.hpp | 26 ------ include/cru/ui/mapper/style/HoverConditionMapper.h | 26 ++++++ .../cru/ui/mapper/style/HoverConditionMapper.hpp | 26 ------ include/cru/ui/mapper/style/IConditionMapper.h | 17 ++++ include/cru/ui/mapper/style/IConditionMapper.hpp | 17 ---- include/cru/ui/mapper/style/IStylerMapper.h | 17 ++++ include/cru/ui/mapper/style/IStylerMapper.hpp | 17 ---- include/cru/ui/mapper/style/NoConditionMapper.h | 29 +++++++ include/cru/ui/mapper/style/NoConditionMapper.hpp | 29 ------- include/cru/ui/mapper/style/OrConditionMapper.h | 25 ++++++ include/cru/ui/mapper/style/OrConditionMapper.hpp | 25 ------ include/cru/ui/mapper/style/StyleRuleMapper.h | 20 +++++ include/cru/ui/mapper/style/StyleRuleMapper.hpp | 20 ----- include/cru/ui/mapper/style/StyleRuleSetMapper.h | 21 +++++ include/cru/ui/mapper/style/StyleRuleSetMapper.hpp | 21 ----- 46 files changed, 610 insertions(+), 610 deletions(-) create mode 100644 include/cru/ui/mapper/BorderStyleMapper.h delete mode 100644 include/cru/ui/mapper/BorderStyleMapper.hpp create mode 100644 include/cru/ui/mapper/BrushMapper.h delete mode 100644 include/cru/ui/mapper/BrushMapper.hpp create mode 100644 include/cru/ui/mapper/ColorMapper.h delete mode 100644 include/cru/ui/mapper/ColorMapper.hpp create mode 100644 include/cru/ui/mapper/CornerRadiusMapper.h delete mode 100644 include/cru/ui/mapper/CornerRadiusMapper.hpp create mode 100644 include/cru/ui/mapper/CursorMapper.h delete mode 100644 include/cru/ui/mapper/CursorMapper.hpp create mode 100644 include/cru/ui/mapper/FontMapper.h delete mode 100644 include/cru/ui/mapper/FontMapper.hpp create mode 100644 include/cru/ui/mapper/Mapper.h delete mode 100644 include/cru/ui/mapper/Mapper.hpp create mode 100644 include/cru/ui/mapper/MapperRegistry.h delete mode 100644 include/cru/ui/mapper/MapperRegistry.hpp create mode 100644 include/cru/ui/mapper/PointMapper.h delete mode 100644 include/cru/ui/mapper/PointMapper.hpp create mode 100644 include/cru/ui/mapper/SizeMapper.h delete mode 100644 include/cru/ui/mapper/SizeMapper.hpp create mode 100644 include/cru/ui/mapper/ThicknessMapper.h delete mode 100644 include/cru/ui/mapper/ThicknessMapper.hpp create mode 100644 include/cru/ui/mapper/style/AndConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/AndConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/BorderStylerMapper.h delete mode 100644 include/cru/ui/mapper/style/BorderStylerMapper.hpp create mode 100644 include/cru/ui/mapper/style/ClickStateConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/ClickStateConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/CursorStylerMapper.h delete mode 100644 include/cru/ui/mapper/style/CursorStylerMapper.hpp create mode 100644 include/cru/ui/mapper/style/FocusConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/FocusConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/HoverConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/HoverConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/IConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/IConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/IStylerMapper.h delete mode 100644 include/cru/ui/mapper/style/IStylerMapper.hpp create mode 100644 include/cru/ui/mapper/style/NoConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/NoConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/OrConditionMapper.h delete mode 100644 include/cru/ui/mapper/style/OrConditionMapper.hpp create mode 100644 include/cru/ui/mapper/style/StyleRuleMapper.h delete mode 100644 include/cru/ui/mapper/style/StyleRuleMapper.hpp create mode 100644 include/cru/ui/mapper/style/StyleRuleSetMapper.h delete mode 100644 include/cru/ui/mapper/style/StyleRuleSetMapper.hpp (limited to 'include/cru/ui/mapper') diff --git a/include/cru/ui/mapper/BorderStyleMapper.h b/include/cru/ui/mapper/BorderStyleMapper.h new file mode 100644 index 00000000..d585639f --- /dev/null +++ b/include/cru/ui/mapper/BorderStyleMapper.h @@ -0,0 +1,20 @@ +#pragma once +#include "Mapper.h" +#include "cru/ui/style/ApplyBorderStyleInfo.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper { +class CRU_UI_API BorderStyleMapper + : public BasicMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(BorderStyleMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + ui::style::ApplyBorderStyleInfo DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/BorderStyleMapper.hpp b/include/cru/ui/mapper/BorderStyleMapper.hpp deleted file mode 100644 index 7a574f38..00000000 --- a/include/cru/ui/mapper/BorderStyleMapper.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "Mapper.hpp" -#include "cru/ui/style/ApplyBorderStyleInfo.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API BorderStyleMapper - : public BasicMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(BorderStyleMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - ui::style::ApplyBorderStyleInfo DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/BrushMapper.h b/include/cru/ui/mapper/BrushMapper.h new file mode 100644 index 00000000..be70e89e --- /dev/null +++ b/include/cru/ui/mapper/BrushMapper.h @@ -0,0 +1,20 @@ +#pragma once +#include "Mapper.h" +#include "cru/common/Base.h" +#include "cru/platform/graphics/Brush.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper { +class BrushMapper : public BasicRefMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(BrushMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + std::shared_ptr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/BrushMapper.hpp b/include/cru/ui/mapper/BrushMapper.hpp deleted file mode 100644 index b2021076..00000000 --- a/include/cru/ui/mapper/BrushMapper.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "Mapper.hpp" -#include "cru/common/Base.hpp" -#include "cru/platform/graphics/Brush.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper { -class BrushMapper : public BasicRefMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(BrushMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - std::shared_ptr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/ColorMapper.h b/include/cru/ui/mapper/ColorMapper.h new file mode 100644 index 00000000..785f1ca9 --- /dev/null +++ b/include/cru/ui/mapper/ColorMapper.h @@ -0,0 +1,19 @@ +#pragma once +#include "Mapper.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper { +class CRU_UI_API ColorMapper : public BasicMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ColorMapper) + + public: + bool SupportMapFromString() override { return true; } + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + Color DoMapFromString(String str) override; + Color DoMapFromXml(xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/ColorMapper.hpp b/include/cru/ui/mapper/ColorMapper.hpp deleted file mode 100644 index d96ca74b..00000000 --- a/include/cru/ui/mapper/ColorMapper.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Mapper.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API ColorMapper : public BasicMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ColorMapper) - - public: - bool SupportMapFromString() override { return true; } - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - Color DoMapFromString(String str) override; - Color DoMapFromXml(xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/CornerRadiusMapper.h b/include/cru/ui/mapper/CornerRadiusMapper.h new file mode 100644 index 00000000..b8998a1b --- /dev/null +++ b/include/cru/ui/mapper/CornerRadiusMapper.h @@ -0,0 +1,17 @@ +#pragma once + +#include "Mapper.h" + +namespace cru::ui::mapper { +class CRU_UI_API CornerRadiusMapper : public BasicMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CornerRadiusMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + CornerRadius DoMapFromXml(xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/CornerRadiusMapper.hpp b/include/cru/ui/mapper/CornerRadiusMapper.hpp deleted file mode 100644 index 4d83f2de..00000000 --- a/include/cru/ui/mapper/CornerRadiusMapper.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "Mapper.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API CornerRadiusMapper : public BasicMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CornerRadiusMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - CornerRadius DoMapFromXml(xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/CursorMapper.h b/include/cru/ui/mapper/CursorMapper.h new file mode 100644 index 00000000..d98a798c --- /dev/null +++ b/include/cru/ui/mapper/CursorMapper.h @@ -0,0 +1,21 @@ +#pragma once +#include "Mapper.h" +#include "cru/platform/gui/Cursor.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper { +class CRU_UI_API CursorMapper : public BasicRefMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CursorMapper); + + public: + bool SupportMapFromString() override { return true; } + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + std::shared_ptr DoMapFromString(String str) override; + std::shared_ptr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/CursorMapper.hpp b/include/cru/ui/mapper/CursorMapper.hpp deleted file mode 100644 index 6cb61d87..00000000 --- a/include/cru/ui/mapper/CursorMapper.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "Mapper.hpp" -#include "cru/platform/gui/Cursor.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API CursorMapper : public BasicRefMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CursorMapper); - - public: - bool SupportMapFromString() override { return true; } - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - std::shared_ptr DoMapFromString(String str) override; - std::shared_ptr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/FontMapper.h b/include/cru/ui/mapper/FontMapper.h new file mode 100644 index 00000000..545b94d8 --- /dev/null +++ b/include/cru/ui/mapper/FontMapper.h @@ -0,0 +1,19 @@ +#pragma once +#include "Mapper.h" +#include "cru/common/Base.h" +#include "cru/platform/graphics/Font.h" + +namespace cru::ui::mapper { +class FontMapper : public BasicRefMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(FontMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + std::shared_ptr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/FontMapper.hpp b/include/cru/ui/mapper/FontMapper.hpp deleted file mode 100644 index ad8c43b5..00000000 --- a/include/cru/ui/mapper/FontMapper.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Mapper.hpp" -#include "cru/common/Base.hpp" -#include "cru/platform/graphics/Font.hpp" - -namespace cru::ui::mapper { -class FontMapper : public BasicRefMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(FontMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - std::shared_ptr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/Mapper.h b/include/cru/ui/mapper/Mapper.h new file mode 100644 index 00000000..fa7f8cef --- /dev/null +++ b/include/cru/ui/mapper/Mapper.h @@ -0,0 +1,92 @@ +#pragma once +#include "../Base.h" + +#include "cru/common/ClonablePtr.h" +#include "cru/common/Exception.h" +#include "cru/xml/XmlNode.h" + +#include +#include +#include +#include + +namespace cru::ui::mapper { +template +class BasicMapper; + +class CRU_UI_API MapperBase : public Object { + public: + explicit MapperBase(std::type_index type_index); + + CRU_DELETE_COPY(MapperBase) + CRU_DELETE_MOVE(MapperBase) + + ~MapperBase() override = default; + + public: + std::type_index GetTypeIndex() const { return type_index_; } + + template + BasicMapper* StaticCast() { + return static_cast*>(this); + } + + template + BasicMapper* DynamicCast() { + return dynamic_cast*>(this); + } + + virtual bool SupportMapFromString() { return false; } + virtual bool SupportMapFromXml() { return false; } + virtual bool XmlElementIsOfThisType(xml::XmlElementNode* node) { + return false; + } + + private: + std::type_index type_index_; +}; + +template +class CRU_UI_API BasicMapper : public MapperBase { + public: + static_assert(std::is_default_constructible_v, + "T must be default constructible."); + + BasicMapper() : MapperBase(typeid(T)) {} + + CRU_DELETE_COPY(BasicMapper) + CRU_DELETE_MOVE(BasicMapper) + + ~BasicMapper() override = default; + + virtual T MapFromString(String str) { + if (!SupportMapFromString()) { + throw Exception(u"This mapper does not support map from string."); + } + + return DoMapFromString(str); + } + + T MapFromXml(xml::XmlElementNode* node) { + if (!SupportMapFromXml()) { + throw Exception(u"This mapper does not support map from xml."); + } + + if (!XmlElementIsOfThisType(node)) { + throw Exception(u"This xml element is not of mapping type."); + } + + return DoMapFromXml(node); + } + + protected: + virtual T DoMapFromString(String str) { return {}; } + virtual T DoMapFromXml(xml::XmlElementNode* node) { return {}; } +}; + +template +using BasicRefMapper = BasicMapper>; + +template +using BasicPtrMapper = BasicMapper>; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/Mapper.hpp b/include/cru/ui/mapper/Mapper.hpp deleted file mode 100644 index c52bec70..00000000 --- a/include/cru/ui/mapper/Mapper.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once -#include "../Base.hpp" - -#include "cru/common/ClonablePtr.hpp" -#include "cru/common/Exception.hpp" -#include "cru/xml/XmlNode.hpp" - -#include -#include -#include -#include - -namespace cru::ui::mapper { -template -class BasicMapper; - -class CRU_UI_API MapperBase : public Object { - public: - explicit MapperBase(std::type_index type_index); - - CRU_DELETE_COPY(MapperBase) - CRU_DELETE_MOVE(MapperBase) - - ~MapperBase() override = default; - - public: - std::type_index GetTypeIndex() const { return type_index_; } - - template - BasicMapper* StaticCast() { - return static_cast*>(this); - } - - template - BasicMapper* DynamicCast() { - return dynamic_cast*>(this); - } - - virtual bool SupportMapFromString() { return false; } - virtual bool SupportMapFromXml() { return false; } - virtual bool XmlElementIsOfThisType(xml::XmlElementNode* node) { - return false; - } - - private: - std::type_index type_index_; -}; - -template -class CRU_UI_API BasicMapper : public MapperBase { - public: - static_assert(std::is_default_constructible_v, - "T must be default constructible."); - - BasicMapper() : MapperBase(typeid(T)) {} - - CRU_DELETE_COPY(BasicMapper) - CRU_DELETE_MOVE(BasicMapper) - - ~BasicMapper() override = default; - - virtual T MapFromString(String str) { - if (!SupportMapFromString()) { - throw Exception(u"This mapper does not support map from string."); - } - - return DoMapFromString(str); - } - - T MapFromXml(xml::XmlElementNode* node) { - if (!SupportMapFromXml()) { - throw Exception(u"This mapper does not support map from xml."); - } - - if (!XmlElementIsOfThisType(node)) { - throw Exception(u"This xml element is not of mapping type."); - } - - return DoMapFromXml(node); - } - - protected: - virtual T DoMapFromString(String str) { return {}; } - virtual T DoMapFromXml(xml::XmlElementNode* node) { return {}; } -}; - -template -using BasicRefMapper = BasicMapper>; - -template -using BasicPtrMapper = BasicMapper>; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/MapperRegistry.h b/include/cru/ui/mapper/MapperRegistry.h new file mode 100644 index 00000000..29d26156 --- /dev/null +++ b/include/cru/ui/mapper/MapperRegistry.h @@ -0,0 +1,58 @@ +#pragma once + +#include "Mapper.h" + +#include +#include + +namespace cru::ui::mapper { +class CRU_UI_API MapperRegistry { + public: + static MapperRegistry* GetInstance(); + + MapperRegistry(); + + CRU_DELETE_COPY(MapperRegistry) + CRU_DELETE_MOVE(MapperRegistry) + + ~MapperRegistry(); + + const std::vector& GetAllMappers() const { return mapper_list_; } + + template + BasicMapper* GetMapper() const { + for (auto mapper : mapper_list_) { + if (mapper->GetTypeIndex() == typeid(T)) { + return static_cast*>(mapper); + } + } + return nullptr; + } + + template + BasicRefMapper* GetRefMapper() const { + return GetMapper>(); + } + + template + BasicPtrMapper* GetPtrMapper() const { + return GetMapper>(); + } + + template + std::vector GetMappersByInterface() const { + std::vector result; + for (auto mapper : mapper_list_) { + auto m = dynamic_cast(mapper); + if (m) result.push_back(m); + } + return result; + } + + void RegisterMapper(MapperBase* mapper); + void UnregisterMapper(MapperBase* mapper); + + private: + std::vector mapper_list_; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/MapperRegistry.hpp b/include/cru/ui/mapper/MapperRegistry.hpp deleted file mode 100644 index 1c02be49..00000000 --- a/include/cru/ui/mapper/MapperRegistry.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include "Mapper.hpp" - -#include -#include - -namespace cru::ui::mapper { -class CRU_UI_API MapperRegistry { - public: - static MapperRegistry* GetInstance(); - - MapperRegistry(); - - CRU_DELETE_COPY(MapperRegistry) - CRU_DELETE_MOVE(MapperRegistry) - - ~MapperRegistry(); - - const std::vector& GetAllMappers() const { return mapper_list_; } - - template - BasicMapper* GetMapper() const { - for (auto mapper : mapper_list_) { - if (mapper->GetTypeIndex() == typeid(T)) { - return static_cast*>(mapper); - } - } - return nullptr; - } - - template - BasicRefMapper* GetRefMapper() const { - return GetMapper>(); - } - - template - BasicPtrMapper* GetPtrMapper() const { - return GetMapper>(); - } - - template - std::vector GetMappersByInterface() const { - std::vector result; - for (auto mapper : mapper_list_) { - auto m = dynamic_cast(mapper); - if (m) result.push_back(m); - } - return result; - } - - void RegisterMapper(MapperBase* mapper); - void UnregisterMapper(MapperBase* mapper); - - private: - std::vector mapper_list_; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/PointMapper.h b/include/cru/ui/mapper/PointMapper.h new file mode 100644 index 00000000..83dd135b --- /dev/null +++ b/include/cru/ui/mapper/PointMapper.h @@ -0,0 +1,18 @@ +#pragma once +#include "Mapper.h" + +namespace cru::ui::mapper { +class CRU_UI_API PointMapper : public BasicMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(PointMapper) + + public: + bool SupportMapFromString() override { return true; } + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + Point DoMapFromString(String str) override; + Point DoMapFromXml(xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/PointMapper.hpp b/include/cru/ui/mapper/PointMapper.hpp deleted file mode 100644 index b1837fe1..00000000 --- a/include/cru/ui/mapper/PointMapper.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "Mapper.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API PointMapper : public BasicMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(PointMapper) - - public: - bool SupportMapFromString() override { return true; } - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - Point DoMapFromString(String str) override; - Point DoMapFromXml(xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/SizeMapper.h b/include/cru/ui/mapper/SizeMapper.h new file mode 100644 index 00000000..6cf3eb9a --- /dev/null +++ b/include/cru/ui/mapper/SizeMapper.h @@ -0,0 +1,18 @@ +#pragma once +#include "Mapper.h" + +namespace cru::ui::mapper { +class CRU_UI_API SizeMapper : public BasicMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(SizeMapper) + + public: + bool SupportMapFromString() override { return true; } + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + Size DoMapFromString(String str) override; + Size DoMapFromXml(xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/SizeMapper.hpp b/include/cru/ui/mapper/SizeMapper.hpp deleted file mode 100644 index 6ab4b97d..00000000 --- a/include/cru/ui/mapper/SizeMapper.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "Mapper.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API SizeMapper : public BasicMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(SizeMapper) - - public: - bool SupportMapFromString() override { return true; } - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - Size DoMapFromString(String str) override; - Size DoMapFromXml(xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/ThicknessMapper.h b/include/cru/ui/mapper/ThicknessMapper.h new file mode 100644 index 00000000..10f6c87e --- /dev/null +++ b/include/cru/ui/mapper/ThicknessMapper.h @@ -0,0 +1,22 @@ +#pragma once +#include "Mapper.h" + +#include "../Base.h" +#include "cru/common/Base.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper { +class CRU_UI_API ThicknessMapper : public BasicMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ThicknessMapper) + + public: + bool SupportMapFromString() override { return true; } + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + Thickness DoMapFromString(String str) override; + Thickness DoMapFromXml(xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/ThicknessMapper.hpp b/include/cru/ui/mapper/ThicknessMapper.hpp deleted file mode 100644 index 4ffbeb9b..00000000 --- a/include/cru/ui/mapper/ThicknessMapper.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once -#include "Mapper.hpp" - -#include "../Base.hpp" -#include "cru/common/Base.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper { -class CRU_UI_API ThicknessMapper : public BasicMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ThicknessMapper) - - public: - bool SupportMapFromString() override { return true; } - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - Thickness DoMapFromString(String str) override; - Thickness DoMapFromXml(xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper diff --git a/include/cru/ui/mapper/style/AndConditionMapper.h b/include/cru/ui/mapper/style/AndConditionMapper.h new file mode 100644 index 00000000..142637a7 --- /dev/null +++ b/include/cru/ui/mapper/style/AndConditionMapper.h @@ -0,0 +1,25 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API AndConditionMapper + : public BasicPtrMapper, + public virtual IConditionMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(AndConditionMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/AndConditionMapper.hpp b/include/cru/ui/mapper/style/AndConditionMapper.hpp deleted file mode 100644 index 747e496d..00000000 --- a/include/cru/ui/mapper/style/AndConditionMapper.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "IConditionMapper.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API AndConditionMapper - : public BasicPtrMapper, - public virtual IConditionMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(AndConditionMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/BorderStylerMapper.h b/include/cru/ui/mapper/style/BorderStylerMapper.h new file mode 100644 index 00000000..da09989b --- /dev/null +++ b/include/cru/ui/mapper/style/BorderStylerMapper.h @@ -0,0 +1,28 @@ +#pragma once +#include "../Mapper.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/mapper/style/IStylerMapper.h" +#include "cru/ui/style/Styler.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API BorderStylerMapper + : public BasicPtrMapper, + public virtual IStylerMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(BorderStylerMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapStylerFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/BorderStylerMapper.hpp b/include/cru/ui/mapper/style/BorderStylerMapper.hpp deleted file mode 100644 index 2f48550c..00000000 --- a/include/cru/ui/mapper/style/BorderStylerMapper.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "cru/common/ClonablePtr.hpp" -#include "cru/ui/mapper/style/IStylerMapper.hpp" -#include "cru/ui/style/Styler.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API BorderStylerMapper - : public BasicPtrMapper, - public virtual IStylerMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(BorderStylerMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapStylerFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/ClickStateConditionMapper.h b/include/cru/ui/mapper/style/ClickStateConditionMapper.h new file mode 100644 index 00000000..0c25646c --- /dev/null +++ b/include/cru/ui/mapper/style/ClickStateConditionMapper.h @@ -0,0 +1,26 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" +#include "cru/ui/style/Condition.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API ClickStateConditionMapper + : public BasicPtrMapper, + public virtual IConditionMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ClickStateConditionMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + public: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp b/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp deleted file mode 100644 index 63577641..00000000 --- a/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "IConditionMapper.hpp" -#include "cru/ui/style/Condition.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API ClickStateConditionMapper - : public BasicPtrMapper, - public virtual IConditionMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ClickStateConditionMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - public: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/CursorStylerMapper.h b/include/cru/ui/mapper/style/CursorStylerMapper.h new file mode 100644 index 00000000..37c3ade9 --- /dev/null +++ b/include/cru/ui/mapper/style/CursorStylerMapper.h @@ -0,0 +1,26 @@ +#pragma once +#include "../Mapper.h" +#include "cru/ui/mapper/style/IStylerMapper.h" +#include "cru/ui/style/Styler.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API CursorStylerMapper + : public BasicPtrMapper, + public virtual IStylerMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CursorStylerMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapStylerFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/CursorStylerMapper.hpp b/include/cru/ui/mapper/style/CursorStylerMapper.hpp deleted file mode 100644 index 2b0c62a8..00000000 --- a/include/cru/ui/mapper/style/CursorStylerMapper.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "cru/ui/mapper/style/IStylerMapper.hpp" -#include "cru/ui/style/Styler.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API CursorStylerMapper - : public BasicPtrMapper, - public virtual IStylerMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CursorStylerMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapStylerFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/FocusConditionMapper.h b/include/cru/ui/mapper/style/FocusConditionMapper.h new file mode 100644 index 00000000..bc7264d1 --- /dev/null +++ b/include/cru/ui/mapper/style/FocusConditionMapper.h @@ -0,0 +1,26 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" +#include "cru/ui/style/Condition.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API FocusConditionMapper + : public BasicPtrMapper, + public virtual IConditionMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(FocusConditionMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/FocusConditionMapper.hpp b/include/cru/ui/mapper/style/FocusConditionMapper.hpp deleted file mode 100644 index 00809850..00000000 --- a/include/cru/ui/mapper/style/FocusConditionMapper.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "IConditionMapper.hpp" -#include "cru/ui/style/Condition.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API FocusConditionMapper - : public BasicPtrMapper, - public virtual IConditionMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(FocusConditionMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/HoverConditionMapper.h b/include/cru/ui/mapper/style/HoverConditionMapper.h new file mode 100644 index 00000000..c897f672 --- /dev/null +++ b/include/cru/ui/mapper/style/HoverConditionMapper.h @@ -0,0 +1,26 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" +#include "cru/ui/style/Condition.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API HoverConditionMapper + : public BasicPtrMapper, + public virtual IConditionMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(HoverConditionMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/HoverConditionMapper.hpp b/include/cru/ui/mapper/style/HoverConditionMapper.hpp deleted file mode 100644 index bbd840f0..00000000 --- a/include/cru/ui/mapper/style/HoverConditionMapper.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "IConditionMapper.hpp" -#include "cru/ui/style/Condition.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API HoverConditionMapper - : public BasicPtrMapper, - public virtual IConditionMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(HoverConditionMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/IConditionMapper.h b/include/cru/ui/mapper/style/IConditionMapper.h new file mode 100644 index 00000000..7610dc8d --- /dev/null +++ b/include/cru/ui/mapper/style/IConditionMapper.h @@ -0,0 +1,17 @@ +#pragma once +#include "../../Base.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/mapper/Mapper.h" +#include "cru/ui/style/Condition.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper::style { +struct CRU_UI_API IConditionMapper : virtual Interface { + bool XmlElementIsOfThisType(xml::XmlElementNode* node) { + return dynamic_cast(this)->XmlElementIsOfThisType(node); + } + + virtual ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) = 0; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/IConditionMapper.hpp b/include/cru/ui/mapper/style/IConditionMapper.hpp deleted file mode 100644 index 3fa7d10a..00000000 --- a/include/cru/ui/mapper/style/IConditionMapper.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -#include "../../Base.hpp" -#include "cru/common/ClonablePtr.hpp" -#include "cru/ui/mapper/Mapper.hpp" -#include "cru/ui/style/Condition.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper::style { -struct CRU_UI_API IConditionMapper : virtual Interface { - bool XmlElementIsOfThisType(xml::XmlElementNode* node) { - return dynamic_cast(this)->XmlElementIsOfThisType(node); - } - - virtual ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) = 0; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/IStylerMapper.h b/include/cru/ui/mapper/style/IStylerMapper.h new file mode 100644 index 00000000..4c2ecd16 --- /dev/null +++ b/include/cru/ui/mapper/style/IStylerMapper.h @@ -0,0 +1,17 @@ +#pragma once +#include "../../Base.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/mapper/Mapper.h" +#include "cru/ui/style/Styler.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper::style { +struct CRU_UI_API IStylerMapper : virtual Interface { + bool XmlElementIsOfThisType(xml::XmlElementNode* node) { + return dynamic_cast(this)->XmlElementIsOfThisType(node); + } + + virtual ClonablePtr MapStylerFromXml( + xml::XmlElementNode* node) = 0; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/IStylerMapper.hpp b/include/cru/ui/mapper/style/IStylerMapper.hpp deleted file mode 100644 index d00f39be..00000000 --- a/include/cru/ui/mapper/style/IStylerMapper.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -#include "../../Base.hpp" -#include "cru/common/ClonablePtr.hpp" -#include "cru/ui/mapper/Mapper.hpp" -#include "cru/ui/style/Styler.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper::style { -struct CRU_UI_API IStylerMapper : virtual Interface { - bool XmlElementIsOfThisType(xml::XmlElementNode* node) { - return dynamic_cast(this)->XmlElementIsOfThisType(node); - } - - virtual ClonablePtr MapStylerFromXml( - xml::XmlElementNode* node) = 0; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/NoConditionMapper.h b/include/cru/ui/mapper/style/NoConditionMapper.h new file mode 100644 index 00000000..bc7ce623 --- /dev/null +++ b/include/cru/ui/mapper/style/NoConditionMapper.h @@ -0,0 +1,29 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" +#include "cru/common/Base.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/style/Condition.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API NoConditionMapper + : public BasicPtrMapper, + public virtual IConditionMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(NoConditionMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/NoConditionMapper.hpp b/include/cru/ui/mapper/style/NoConditionMapper.hpp deleted file mode 100644 index ed3a9699..00000000 --- a/include/cru/ui/mapper/style/NoConditionMapper.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "IConditionMapper.hpp" -#include "cru/common/Base.hpp" -#include "cru/common/ClonablePtr.hpp" -#include "cru/ui/style/Condition.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API NoConditionMapper - : public BasicPtrMapper, - public virtual IConditionMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(NoConditionMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/OrConditionMapper.h b/include/cru/ui/mapper/style/OrConditionMapper.h new file mode 100644 index 00000000..e93484b4 --- /dev/null +++ b/include/cru/ui/mapper/style/OrConditionMapper.h @@ -0,0 +1,25 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API OrConditionMapper + : public BasicPtrMapper, + public virtual IConditionMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(OrConditionMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + ClonablePtr MapConditionFromXml( + xml::XmlElementNode* node) override { + return MapFromXml(node); + } + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/OrConditionMapper.hpp b/include/cru/ui/mapper/style/OrConditionMapper.hpp deleted file mode 100644 index 21a402c2..00000000 --- a/include/cru/ui/mapper/style/OrConditionMapper.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "IConditionMapper.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API OrConditionMapper - : public BasicPtrMapper, - public virtual IConditionMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(OrConditionMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - ClonablePtr MapConditionFromXml( - xml::XmlElementNode* node) override { - return MapFromXml(node); - } - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/StyleRuleMapper.h b/include/cru/ui/mapper/style/StyleRuleMapper.h new file mode 100644 index 00000000..cba4872c --- /dev/null +++ b/include/cru/ui/mapper/style/StyleRuleMapper.h @@ -0,0 +1,20 @@ +#pragma once +#include "../Mapper.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/style/StyleRule.h" +#include "cru/xml/XmlNode.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API StyleRuleMapper : public BasicPtrMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(StyleRuleMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + ClonablePtr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/StyleRuleMapper.hpp b/include/cru/ui/mapper/style/StyleRuleMapper.hpp deleted file mode 100644 index ce5ccf00..00000000 --- a/include/cru/ui/mapper/style/StyleRuleMapper.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "../Mapper.hpp" -#include "cru/common/ClonablePtr.hpp" -#include "cru/ui/style/StyleRule.hpp" -#include "cru/xml/XmlNode.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API StyleRuleMapper : public BasicPtrMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(StyleRuleMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - ClonablePtr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/StyleRuleSetMapper.h b/include/cru/ui/mapper/style/StyleRuleSetMapper.h new file mode 100644 index 00000000..95f745e5 --- /dev/null +++ b/include/cru/ui/mapper/style/StyleRuleSetMapper.h @@ -0,0 +1,21 @@ +#pragma once +#include +#include "../../style/StyleRuleSet.h" +#include "../Mapper.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API StyleRuleSetMapper + : public BasicRefMapper { + public: + CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(StyleRuleSetMapper) + + public: + bool SupportMapFromXml() override { return true; } + bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + + protected: + std::shared_ptr DoMapFromXml( + xml::XmlElementNode* node) override; +}; +; +} // namespace cru::ui::mapper::style diff --git a/include/cru/ui/mapper/style/StyleRuleSetMapper.hpp b/include/cru/ui/mapper/style/StyleRuleSetMapper.hpp deleted file mode 100644 index 66b95f4a..00000000 --- a/include/cru/ui/mapper/style/StyleRuleSetMapper.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include -#include "../../style/StyleRuleSet.hpp" -#include "../Mapper.hpp" - -namespace cru::ui::mapper::style { -class CRU_UI_API StyleRuleSetMapper - : public BasicRefMapper { - public: - CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(StyleRuleSetMapper) - - public: - bool SupportMapFromXml() override { return true; } - bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; - - protected: - std::shared_ptr DoMapFromXml( - xml::XmlElementNode* node) override; -}; -; -} // namespace cru::ui::mapper::style -- cgit v1.2.3