--- a/src/lib/XMLContentHandler.h Fri Jul 02 00:42:01 2021 +0200
+++ b/src/lib/XMLContentHandler.h Sat Jul 03 18:56:15 2021 +0200
@@ -16,7 +16,7 @@
*/
#pragma once
-#include <vector>
+#include "ProxyVector.h"
namespace relpipe {
namespace in {
@@ -39,33 +39,29 @@
class XMLContentHandlerProxy : XMLContentHandler {
private:
- std::vector<std::shared_ptr<XMLContentHandler>> handlers;
+ ProxyVector<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 = {}) override {
- handler->writeStartElement(name, attributes);
+ handlers.forward(&XMLContentHandler::writeStartElement, name, attributes);
}
void writeEndElement() override {
- handler->writeEndElement();
+ handlers.forward(&XMLContentHandler::writeEndElement);
}
void writeCharacters(const std::string& value) override {
- handler->writeCharacters(value);
+ handlers.forward(&XMLContentHandler::writeCharacters, value);
}
void writeComment(const std::string& value, bool addSpaces = true) override {
- handler->writeComment(value, addSpaces);
+ handlers.forward(&XMLContentHandler::writeComment, value, addSpaces);
}
-#undef handler
-
};
}