aboutsummaryrefslogtreecommitdiff
path: root/include/cru/xml
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-12 23:13:10 +0800
committerGitHub <noreply@github.com>2022-01-12 23:13:10 +0800
commit276ae73fa444c16f34a379ae9d8f58c883056b4a (patch)
tree96f4d7103976836e918b4fa1db0fdbb80777986e /include/cru/xml
parent01f98ce88950cdb729f5db58bf26f2fffa1c326c (diff)
parent65c799c5339ba37bea2217b168e96b15aceaef85 (diff)
downloadcru-276ae73fa444c16f34a379ae9d8f58c883056b4a.tar.gz
cru-276ae73fa444c16f34a379ae9d8f58c883056b4a.tar.bz2
cru-276ae73fa444c16f34a379ae9d8f58c883056b4a.zip
Merge pull request #44 from crupest/dev
Windows development.
Diffstat (limited to 'include/cru/xml')
-rw-r--r--include/cru/xml/Base.hpp11
-rw-r--r--include/cru/xml/XmlNode.hpp12
-rw-r--r--include/cru/xml/XmlParser.hpp4
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);