# Visitor Class Reference
[Visitor]

`#include <Visitor.h>`

Inheritance diagram for Visitor:
[legend]

## Detailed Description

The building block of Acyclic Visitor

Usage

Defining the visitable class:

     class RasterBitmap : public BaseVisitable<>
     {
     public:
         LOKI_DEFINE_VISITABLE()
     };

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:
         LOKI_DEFINE_CONST_VISITABLE()
     };

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:

- Visitor.h