--- a/src/lib/DOMBuildingSAXContentHandler.h Sat Jun 12 19:15:58 2021 +0200
+++ b/src/lib/DOMBuildingSAXContentHandler.h Sat Jun 12 20:31:23 2021 +0200
@@ -35,15 +35,18 @@
document->create_root_node("DOMBuildingSAXContentHandler"); // FIXME: real implementation
}
- void abc() override {
- document->get_root_node()->add_child("abc");
- };
+ void writeStartElement(const std::string& name, const std::vector<std::string>& attributes) override {
+ }
+
+ void writeEndElement() override {
+ }
- void def(int a) override {
- };
+ void writeCharacters(const std::string& text) override {
+ }
- void ghi(int a, int b) 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 19:15:58 2021 +0200
+++ b/src/lib/GenericASN1ContentHandler.h Sat Jun 12 20:31:23 2021 +0200
@@ -42,7 +42,7 @@
}
void abc() override {
- handlers.abc();
+ handlers.writeComment("abc");
};
void def(int a) override {
--- a/src/lib/SAXContentHandler.h Sat Jun 12 19:15:58 2021 +0200
+++ b/src/lib/SAXContentHandler.h Sat Jun 12 20:31:23 2021 +0200
@@ -26,13 +26,14 @@
virtual ~SAXContentHandler() = default;
- virtual void abc() = 0; // FIXME: remove dummy method
- virtual void def(int a) = 0; // FIXME: remove dummy method
- virtual void ghi(int a, int b) = 0; // FIXME: remove dummy method
+ 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 : public SAXContentHandler {
+class SAXContentHandlerProxy : SAXContentHandler {
private:
std::vector<std::shared_ptr<SAXContentHandler>> handlers;
public:
@@ -43,16 +44,20 @@
#define handler for (auto ___h : handlers) ___h
- void abc() override {
- handler->abc();
+ void writeStartElement(const std::string& name, const std::vector<std::string>& attributes = {}) {
+ handler->writeStartElement(name, attributes);
}
- void def(int a) override {
- handler->def(a);
+ void writeEndElement() {
+ handler->writeEndElement();
}
- void ghi(int a, int b) override {
- handler->ghi(a, b);
+ void writeCharacters(const std::string& text) {
+ handler->writeCharacters(text);
+ }
+
+ void writeComment(const std::string& text, bool addSpaces = true) {
+ handler->writeComment(text, addSpaces);
}
#undef handler