--- a/nbproject/configurations.xml Sat Jun 12 20:31:23 2021 +0200
+++ b/nbproject/configurations.xml Sat Jun 12 20:43:07 2021 +0200
@@ -48,9 +48,9 @@
<in>AbstractParser.cpp</in>
<in>AbstractParser.h</in>
<in>BasicASN1Reader.h</in>
- <in>DOMBuildingSAXContentHandler.h</in>
+ <in>DOMBuildingXMLContentHandler.h</in>
<in>GenericASN1ContentHandler.h</in>
- <in>SAXContentHandler.h</in>
+ <in>XMLContentHandler.h</in>
</df>
<in>XMLDocumentConstructor.h</in>
<in>relpipe-in-xmltable.cpp</in>
@@ -122,7 +122,7 @@
</item>
<item path="src/lib/BasicASN1Reader.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="src/lib/DOMBuildingSAXContentHandler.h"
+ <item path="src/lib/DOMBuildingXMLContentHandler.h"
ex="false"
tool="3"
flavor2="0">
@@ -132,7 +132,7 @@
tool="3"
flavor2="0">
</item>
- <item path="src/lib/SAXContentHandler.h" ex="false" tool="3" flavor2="0">
+ <item path="src/lib/XMLContentHandler.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/relpipe-in-xmltable.cpp" ex="false" tool="1" flavor2="0">
<ccTool flags="0">
@@ -185,7 +185,7 @@
</item>
<item path="src/lib/BasicASN1Reader.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="src/lib/DOMBuildingSAXContentHandler.h"
+ <item path="src/lib/DOMBuildingXMLContentHandler.h"
ex="false"
tool="3"
flavor2="0">
@@ -195,7 +195,7 @@
tool="3"
flavor2="0">
</item>
- <item path="src/lib/SAXContentHandler.h" ex="false" tool="3" flavor2="0">
+ <item path="src/lib/XMLContentHandler.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/relpipe-in-xmltable.cpp" ex="false" tool="1" flavor2="0">
<ccTool flags="0">
--- a/src/XMLDocumentConstructor.h Sat Jun 12 20:31:23 2021 +0200
+++ b/src/XMLDocumentConstructor.h Sat Jun 12 20:43:07 2021 +0200
@@ -22,7 +22,7 @@
#include "lib/BasicASN1Reader.h"
#include "lib/GenericASN1ContentHandler.h"
-#include "lib/DOMBuildingSAXContentHandler.h"
+#include "lib/DOMBuildingXMLContentHandler.h"
namespace relpipe {
namespace in {
@@ -44,7 +44,7 @@
relpipe::in::asn1::lib::BasicASN1Reader reader;
std::shared_ptr<relpipe::in::asn1::lib::GenericASN1ContentHandler> asn1handler = make_shared<relpipe::in::asn1::lib::GenericASN1ContentHandler>();
- std::shared_ptr<relpipe::in::asn1::lib::DOMBuildingSAXContentHandler> saxHandler = make_shared<relpipe::in::asn1::lib::DOMBuildingSAXContentHandler>(parser->get_document());
+ std::shared_ptr<relpipe::in::asn1::lib::DOMBuildingXMLContentHandler> saxHandler = make_shared<relpipe::in::asn1::lib::DOMBuildingXMLContentHandler>(parser->get_document());
asn1handler->addHandler(saxHandler);
reader.addHandler(asn1handler);
--- a/src/lib/DOMBuildingSAXContentHandler.h Sat Jun 12 20:31:23 2021 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/**
- * Relational pipes
- * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-#include <libxml++-2.6/libxml++/libxml++.h>
-
-#include "SAXContentHandler.h"
-
-namespace relpipe {
-namespace in {
-namespace asn1 {
-namespace lib {
-
-class DOMBuildingSAXContentHandler : public SAXContentHandler {
-private:
- xmlpp::Document* document;
-
-public:
-
- DOMBuildingSAXContentHandler(xmlpp::Document* document) : document(document) {
- document->create_root_node("DOMBuildingSAXContentHandler"); // FIXME: real implementation
- }
-
- void writeStartElement(const std::string& name, const std::vector<std::string>& attributes) override {
- }
-
- void writeEndElement() override {
- }
-
- void writeCharacters(const std::string& text) override {
- }
-
- void writeComment(const std::string& text, bool addSpaces) override {
- document->get_root_node()->add_child_comment(addSpaces ? " " + text + " " : text);
- }
-
-};
-
-}
-}
-}
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/DOMBuildingXMLContentHandler.h Sat Jun 12 20:43:07 2021 +0200
@@ -0,0 +1,56 @@
+/**
+ * Relational pipes
+ * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#include <libxml++-2.6/libxml++/libxml++.h>
+
+#include "XMLContentHandler.h"
+
+namespace relpipe {
+namespace in {
+namespace asn1 {
+namespace lib {
+
+class DOMBuildingXMLContentHandler : public XMLContentHandler {
+private:
+ xmlpp::Document* document;
+
+public:
+
+ DOMBuildingXMLContentHandler(xmlpp::Document* document) : document(document) {
+ document->create_root_node("DOMBuildingXMLContentHandler"); // FIXME: real implementation
+ }
+
+ void writeStartElement(const std::string& name, const std::vector<std::string>& attributes) override {
+ }
+
+ void writeEndElement() override {
+ }
+
+ void writeCharacters(const std::string& text) override {
+ }
+
+ void writeComment(const std::string& text, bool addSpaces) override {
+ document->get_root_node()->add_child_comment(addSpaces ? " " + text + " " : text);
+ }
+
+};
+
+}
+}
+}
+}
--- a/src/lib/GenericASN1ContentHandler.h Sat Jun 12 20:31:23 2021 +0200
+++ b/src/lib/GenericASN1ContentHandler.h Sat Jun 12 20:43:07 2021 +0200
@@ -17,7 +17,7 @@
#pragma once
#include "ASN1ContentHandler.h"
-#include "SAXContentHandler.h"
+#include "XMLContentHandler.h"
namespace relpipe {
namespace in {
@@ -31,10 +31,10 @@
*/
class GenericASN1ContentHandler : public ASN1ContentHandler {
private:
- SAXContentHandlerProxy handlers;
+ XMLContentHandlerProxy handlers;
public:
- void addHandler(std::shared_ptr<SAXContentHandler> handler) {
+ void addHandler(std::shared_ptr<XMLContentHandler> handler) {
handlers.addHandler(handler);
}
--- a/src/lib/SAXContentHandler.h Sat Jun 12 20:31:23 2021 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/**
- * Relational pipes
- * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-namespace relpipe {
-namespace in {
-namespace asn1 {
-namespace lib {
-
-class SAXContentHandler {
-public:
-
- virtual ~SAXContentHandler() = default;
-
- virtual void writeStartElement(const std::string& name, const std::vector<std::string>& attributes = {}) = 0;
- virtual void writeEndElement() = 0;
- virtual void writeCharacters(const std::string& text) = 0;
- virtual void writeComment(const std::string& text, bool addSpaces = true) = 0;
-
-};
-
-class SAXContentHandlerProxy : SAXContentHandler {
-private:
- std::vector<std::shared_ptr<SAXContentHandler>> handlers;
-public:
-
- void addHandler(std::shared_ptr<SAXContentHandler> handler) {
- handlers.push_back(handler);
- }
-
-#define handler for (auto ___h : handlers) ___h
-
- void writeStartElement(const std::string& name, const std::vector<std::string>& attributes = {}) {
- handler->writeStartElement(name, attributes);
- }
-
- void writeEndElement() {
- handler->writeEndElement();
- }
-
- void writeCharacters(const std::string& text) {
- handler->writeCharacters(text);
- }
-
- void writeComment(const std::string& text, bool addSpaces = true) {
- handler->writeComment(text, addSpaces);
- }
-
-#undef handler
-
-};
-
-}
-}
-}
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/XMLContentHandler.h Sat Jun 12 20:43:07 2021 +0200
@@ -0,0 +1,70 @@
+/**
+ * Relational pipes
+ * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+namespace relpipe {
+namespace in {
+namespace asn1 {
+namespace lib {
+
+class XMLContentHandler {
+public:
+
+ virtual ~XMLContentHandler() = default;
+
+ virtual void writeStartElement(const std::string& name, const std::vector<std::string>& attributes = {}) = 0;
+ virtual void writeEndElement() = 0;
+ virtual void writeCharacters(const std::string& text) = 0;
+ virtual void writeComment(const std::string& text, bool addSpaces = true) = 0;
+
+};
+
+class XMLContentHandlerProxy : XMLContentHandler {
+private:
+ std::vector<std::shared_ptr<XMLContentHandler>> handlers;
+public:
+
+ void addHandler(std::shared_ptr<XMLContentHandler> handler) {
+ handlers.push_back(handler);
+ }
+
+#define handler for (auto ___h : handlers) ___h
+
+ void writeStartElement(const std::string& name, const std::vector<std::string>& attributes = {}) {
+ handler->writeStartElement(name, attributes);
+ }
+
+ void writeEndElement() {
+ handler->writeEndElement();
+ }
+
+ void writeCharacters(const std::string& text) {
+ handler->writeCharacters(text);
+ }
+
+ void writeComment(const std::string& text, bool addSpaces = true) {
+ handler->writeComment(text, addSpaces);
+ }
+
+#undef handler
+
+};
+
+}
+}
+}
+}