Telnet++
A C++ library for interacting with Telnet streams
routing_visitor.hpp
1 #pragma once
2 
3 #include "telnetpp/detail/command_router.hpp"
4 #include "telnetpp/detail/negotiation_router.hpp"
5 #include "telnetpp/detail/subnegotiation_router.hpp"
6 #include "telnetpp/element.hpp"
7 #include <functional>
8 #include <string>
9 
10 namespace telnetpp { namespace detail {
11 
12 //* =========================================================================
15 //* =========================================================================
16 class routing_visitor
17  : public boost::static_visitor<std::vector<telnetpp::token>>
18 {
19 public :
20  routing_visitor(
21  std::function<std::vector<telnetpp::token> (std::string const &)> on_text,
22  command_router &cmd_router,
23  negotiation_router &neg_router,
24  subnegotiation_router &sub_router);
25 
26  std::vector<telnetpp::token> operator()(std::string const &text);
27  std::vector<telnetpp::token> operator()(command const &cmd);
28  std::vector<telnetpp::token> operator()(negotiation const &neg);
29  std::vector<telnetpp::token> operator()(subnegotiation const &sub);
30 
31 private :
32  std::function<std::vector<telnetpp::token> (std::string const &)> on_text_;
33  command_router &command_router_;
34  negotiation_router &negotiation_router_;
35  subnegotiation_router &subnegotiation_router_;
36 };
37 
38 }}
Definition: byte_converter.hpp:4