Telnet++
A C++ library for interacting with Telnet streams
variable.hpp
1 #pragma once
2 
3 #include "telnetpp/core.hpp"
4 #include <boost/variant.hpp>
5 #include <initializer_list>
6 #include <string>
7 #include <vector>
8 
9 namespace telnetpp { namespace options { namespace msdp {
10 
11 struct variable;
12 
13 //* =========================================================================
17 //* =========================================================================
18 using value_type = boost::variant<
19  std::string,
20  std::vector<std::string>,
21  boost::recursive_wrapper<std::vector<variable>>
22 >;
23 
24 //* =========================================================================
28 //* =========================================================================
29 struct TELNETPP_EXPORT variable
30 {
31  //* =====================================================================
33  //* =====================================================================
34  variable();
35 
36  //* =====================================================================
38  //* =====================================================================
39  variable(
40  std::string const &name,
41  value_type const &value);
42 
43  //* =====================================================================
45  //* =====================================================================
46  variable(
47  std::string const &name,
48  std::initializer_list<std::string> const &array_values);
49 
50  //* =====================================================================
52  //* =====================================================================
53  variable(
54  std::string const &name,
55  std::initializer_list<variable> const &table_values);
56 
57  std::string name;
58  value_type value;
59 };
60 
61 //* =========================================================================
63 //* =========================================================================
64 TELNETPP_EXPORT
65 bool operator==(variable const &lhs, variable const &rhs);
66 
67 //* =========================================================================
69 //* =========================================================================
70 TELNETPP_EXPORT
71 bool operator!=(variable const &lhs, variable const &rhs);
72 
73 }}}
TELNETPP_EXPORT bool operator==(variable const &lhs, variable const &rhs)
Equality operator.
Definition: variable.cpp:81
A structure that represents a named value.
Definition: variable.hpp:29
TELNETPP_EXPORT bool operator!=(variable const &lhs, variable const &rhs)
Inequality operator.
Definition: variable.cpp:90
Definition: byte_converter.hpp:4
A variant that can either be a string, an array of string, or an array of telnetpp::options::msdp::va...
Definition: variable.hpp:11