Loki  0.1.7
Loki::Visitor Class Reference

#include <Visitor.h>

Inheritance diagram for Loki::Visitor:

Detailed Description

The building block of Acyclic Visitor

Usage

Defining the visitable class:

class RasterBitmap : public BaseVisitable<>
{
public:
};

Way 1 to define a visitor:

class SomeVisitor :
public BaseVisitor // required
public Visitor<RasterBitmap>,
public Visitor<Paragraph>
{
public:
void Visit(RasterBitmap&); // visit a RasterBitmap
void Visit(Paragraph &); // visit a Paragraph
};

Way 2 to define the visitor:

class SomeVisitor :
public BaseVisitor // required
public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)>
{
public:
void Visit(RasterBitmap&); // visit a RasterBitmap
void Visit(Paragraph &); // visit a Paragraph
};

Way 3 to define the visitor:

class SomeVisitor :
public BaseVisitor // required
public Visitor<Seq<RasterBitmap, Paragraph>::Type>
{
public:
void Visit(RasterBitmap&); // visit a RasterBitmap
void Visit(Paragraph &); // visit a Paragraph
};
Using const visit functions:

Defining the visitable class (true for const):

class RasterBitmap : public BaseVisitable<void, DefaultCatchAll, true>
{
public:
};

Defining the visitor which only calls const member functions:

class SomeVisitor :
public BaseVisitor // required
public Visitor<RasterBitmap, void, true>,
{
public:
void Visit(const RasterBitmap&); // visit a RasterBitmap by a const member function
};
Example:

test/Visitor/main.cpp


The documentation for this class was generated from the following file:
LOKI_DEFINE_VISITABLE
#define LOKI_DEFINE_VISITABLE()
Definition: Visitor.h:302
LOKI_DEFINE_CONST_VISITABLE
#define LOKI_DEFINE_CONST_VISITABLE()
Definition: Visitor.h:313