From 31422f87f729bd35bcebfb277d08b230424e3618 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 19 Jan 2022 23:14:21 +0800 Subject: ... --- include/cru/common/String.hpp | 2 ++ include/cru/ui/mapper/ThicknessMapper.hpp | 2 +- include/cru/xml/XmlNode.hpp | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/cru/common/String.hpp b/include/cru/common/String.hpp index e7688555..dac81e8d 100644 --- a/include/cru/common/String.hpp +++ b/include/cru/common/String.hpp @@ -233,6 +233,8 @@ class CRU_BASE_API String { float ParseToFloat(Index* processed_characters_count = nullptr) const; double ParseToDouble(Index* processed_characters_count = nullptr) const; + std::vector ParseToFloatList(value_type separator = u' '); + std::vector ParseToDoubleList(value_type separator = u' '); private: static char16_t kEmptyBuffer[1]; diff --git a/include/cru/ui/mapper/ThicknessMapper.hpp b/include/cru/ui/mapper/ThicknessMapper.hpp index 90d1ef46..68bbcf49 100644 --- a/include/cru/ui/mapper/ThicknessMapper.hpp +++ b/include/cru/ui/mapper/ThicknessMapper.hpp @@ -6,7 +6,7 @@ #include "cru/xml/XmlNode.hpp" namespace cru::ui::mapper { -class ThicknessMapper : public BasicMapper { +class CRU_UI_API ThicknessMapper : public BasicMapper { public: CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ThicknessMapper) diff --git a/include/cru/xml/XmlNode.hpp b/include/cru/xml/XmlNode.hpp index 38f09d14..0972037a 100644 --- a/include/cru/xml/XmlNode.hpp +++ b/include/cru/xml/XmlNode.hpp @@ -90,6 +90,14 @@ class CRU_XML_API XmlElementNode : public XmlNode { Index GetChildCount() const { return children_.size(); } String GetAttribute(const String& key) const { return attributes_.at(key); } + std::optional GetOptionalAttribute(const String& key) const { + auto it = attributes_.find(key); + if (it == attributes_.end()) { + return std::nullopt; + } + + return it->second; + } XmlNode* GetChildAt(Index index) const { return children_[index]; } void AddAttribute(String key, String value); -- cgit v1.2.3