Telnet++
A C++ library for interacting with Telnet streams
element.hpp
1 #pragma once
2 
3 #include "telnetpp/command.hpp"
4 #include "telnetpp/negotiation.hpp"
5 #include "telnetpp/subnegotiation.hpp"
6 #include <boost/any.hpp>
7 #include <boost/variant.hpp>
8 #include <numeric>
9 #include <string>
10 #include <vector>
11 
12 namespace telnetpp {
13 
14 //* =========================================================================
19 //* =========================================================================
20 using element = boost::variant<
21  std::string,
22  negotiation,
23  subnegotiation,
24  command
25 >;
26 
27 //* =========================================================================
32 //* =========================================================================
33 using token = boost::variant<element, boost::any>;
34 
35 //* =========================================================================
40 //* =========================================================================
41 using stream_token = boost::variant<u8stream, boost::any>;
42 
43 //* =========================================================================
46 //* =========================================================================
48 {
49  using result_type = std::vector<token>;
50 
51  template <class InputIterator1, class InputIterator2>
52  std::vector<token> operator()(InputIterator1 begin, InputIterator2 end) const
53  {
54  return std::accumulate(
55  begin,
56  end,
57  std::vector<token>{},
58  [](auto &&lhs, auto &&rhs)
59  {
60  lhs.insert(lhs.end(), rhs.begin(), rhs.end());
61  return lhs;
62  });
63  }
64 };
65 
66 }
A combiner for tokens.
Definition: element.hpp:47
Definition: byte_converter.hpp:4