aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-19 23:14:21 +0800
committercrupest <crupest@outlook.com>2022-01-19 23:14:21 +0800
commit31422f87f729bd35bcebfb277d08b230424e3618 (patch)
treef4479c6da9dcc64a9a39e165ed0459efff051eb3 /include
parent2028bc4914638360fb756079dbddbdbe52676821 (diff)
downloadcru-31422f87f729bd35bcebfb277d08b230424e3618.tar.gz
cru-31422f87f729bd35bcebfb277d08b230424e3618.tar.bz2
cru-31422f87f729bd35bcebfb277d08b230424e3618.zip
...
Diffstat (limited to 'include')
-rw-r--r--include/cru/common/String.hpp2
-rw-r--r--include/cru/ui/mapper/ThicknessMapper.hpp2
-rw-r--r--include/cru/xml/XmlNode.hpp8
3 files changed, 11 insertions, 1 deletions
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<float> ParseToFloatList(value_type separator = u' ');
+ std::vector<double> 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<Thickness> {
+class CRU_UI_API ThicknessMapper : public BasicMapper<Thickness> {
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<String> 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);