diff options
author | crupest <crupest@outlook.com> | 2022-01-12 22:36:09 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-12 22:36:09 +0800 |
commit | c409caa8873e25699fc10ae435e8d123685f28f3 (patch) | |
tree | 16a0c0696f0e6d4c6856db0b7864652e2779b2b8 /include/cru/xml | |
parent | 7a42d92c10a4bc686244668dd0e3f903f30f2fae (diff) | |
download | cru-c409caa8873e25699fc10ae435e8d123685f28f3.tar.gz cru-c409caa8873e25699fc10ae435e8d123685f28f3.tar.bz2 cru-c409caa8873e25699fc10ae435e8d123685f28f3.zip |
...
Diffstat (limited to 'include/cru/xml')
-rw-r--r-- | include/cru/xml/Base.hpp | 11 | ||||
-rw-r--r-- | include/cru/xml/XmlNode.hpp | 12 | ||||
-rw-r--r-- | include/cru/xml/XmlParser.hpp | 4 |
3 files changed, 20 insertions, 7 deletions
diff --git a/include/cru/xml/Base.hpp b/include/cru/xml/Base.hpp new file mode 100644 index 00000000..5d6fe144 --- /dev/null +++ b/include/cru/xml/Base.hpp @@ -0,0 +1,11 @@ +#pragma once + +#ifdef CRU_PLATFORM_WINDOWS +#ifdef CRU_XML_EXPORT_API +#define CRU_XML_API __declspec(dllexport) +#else +#define CRU_XML_API __declspec(dllimport) +#endif +#else +#define CRU_XML_API +#endif diff --git a/include/cru/xml/XmlNode.hpp b/include/cru/xml/XmlNode.hpp index cf2543c9..38f09d14 100644 --- a/include/cru/xml/XmlNode.hpp +++ b/include/cru/xml/XmlNode.hpp @@ -1,5 +1,7 @@ #pragma once +#include "Base.hpp" + #include "cru/common/String.hpp" #include <algorithm> @@ -10,7 +12,7 @@ namespace cru::xml { class XmlElementNode; class XmlTextNode; -class XmlNode { +class CRU_XML_API XmlNode { friend XmlElementNode; public: @@ -40,7 +42,7 @@ class XmlNode { XmlElementNode* parent_ = nullptr; }; -class XmlTextNode : public XmlNode { +class CRU_XML_API XmlTextNode : public XmlNode { public: XmlTextNode() : XmlNode(Type::Text) {} explicit XmlTextNode(String text) @@ -61,7 +63,7 @@ class XmlTextNode : public XmlNode { String text_; }; -class XmlElementNode : public XmlNode { +class CRU_XML_API XmlElementNode : public XmlNode { public: XmlElementNode() : XmlNode(Type::Element) {} explicit XmlElementNode(String tag, @@ -86,9 +88,9 @@ class XmlElementNode : public XmlNode { } const std::vector<XmlNode*> GetChildren() const { return children_; } - int GetChildCount() const { return children_.size(); } + Index GetChildCount() const { return children_.size(); } String GetAttribute(const String& key) const { return attributes_.at(key); } - XmlNode* GetChildAt(int index) const { return children_[index]; } + XmlNode* GetChildAt(Index index) const { return children_[index]; } void AddAttribute(String key, String value); void AddChild(XmlNode* child); diff --git a/include/cru/xml/XmlParser.hpp b/include/cru/xml/XmlParser.hpp index 188a08f2..e916cc53 100644 --- a/include/cru/xml/XmlParser.hpp +++ b/include/cru/xml/XmlParser.hpp @@ -8,12 +8,12 @@ #include <optional> namespace cru::xml { -class XmlParsingException : public Exception { +class CRU_XML_API XmlParsingException : public Exception { public: using Exception::Exception; }; -class XmlParser { +class CRU_XML_API XmlParser { public: explicit XmlParser(String xml); |