Tanl Linguistic Pipeline |
Define Visitable classes as:. More...
#include <Visitor.h>
Define Visitable classes as:.
class Element : public Visitable<> { public: VISITABLE_ACCEPT() };
class SubElement : public Element { public: VISITABLE_ACCEPT() };
Define a Visitor as:
class SomeVisitor : public IVisitor, public Visitor<Element>, public Visitor<SubElement> { public: void accept(Element&) { ... } void accept(SubElement&) { ... } };
Optionally the visitor accept method may want to return values:
class Element : public Visitable<Element*>
and the visitor defines:
Element* SomeVisitor::accept(Element&) { ... }
Inspired by