Leosac  0.8.0
Open Source Access Control
Leosac::Tools::Visitor< T > Class Template Reference

A Visitor object. More...

#include <Visitor.hpp>

+ Inheritance diagram for Leosac::Tools::Visitor< T >:
+ Collaboration diagram for Leosac::Tools::Visitor< T >:

Public Types

using VisitableT = std::remove_reference_t< std::remove_const_t< T > >

Public Member Functions

virtual void visit (const VisitableT &)
virtual void visit (VisitableT &visitable)
- Public Member Functions inherited from Leosac::Tools::BaseVisitor
virtual ~BaseVisitor ()=default
virtual void cannot_visit (const IVisitable &)
 Invoked when the visitable cannot be visited by the visitor. More...

Detailed Description

template<typename T>
class Leosac::Tools::Visitor< T >

A Visitor object.

By subclassing this class, an object will be able to visit objects of type T.

For this to work, the T object needs to subclass IVisitable and use the MAKE_VISITABLE() macro.

The Visitor<T> class declare and define 2 visit() methods. One for const Visitable and one for non-const Visitable. By default the non-const version forward the call to the const version.

Definition at line 64 of file Visitor.hpp.

Member Typedef Documentation

◆ VisitableT

template<typename T >
using Leosac::Tools::Visitor< T >::VisitableT = std::remove_reference_t<std::remove_const_t<T> >

Definition at line 67 of file Visitor.hpp.

Member Function Documentation

◆ visit() [1/2]

template<typename T >
virtual void Leosac::Tools::Visitor< T >::visit ( const VisitableT )

Definition at line 74 of file Visitor.hpp.

◆ visit() [2/2]

template<typename T >
virtual void Leosac::Tools::Visitor< T >::visit ( VisitableT visitable)

Definition at line 77 of file Visitor.hpp.

The documentation for this class was generated from the following file: