Telnet++  3.1.0.2
A C++ library for interacting with Telnet streams
variable.hpp
1 #pragma once
2 
3 #include "telnetpp/core.hpp"
4 
5 #include <boost/container/small_vector.hpp>
6 
7 #include <iosfwd>
8 #include <variant>
9 #include <vector>
10 
11 namespace telnetpp::options::msdp {
12 
13 struct variable;
14 
15 using string_value = telnetpp::byte_storage;
16 using array_value = boost::container::small_vector<string_value, 4>;
17 using table_value = std::vector<variable>;
18 
19 //* =========================================================================
23 //* =========================================================================
24 using value_type = std::variant<string_value, array_value, table_value>;
25 
26 //* =========================================================================
30 //* =========================================================================
31 struct TELNETPP_EXPORT variable
32 {
33  //* =====================================================================
35  //* =====================================================================
37 
38  //* =====================================================================
40  //* =====================================================================
41  variable(telnetpp::byte_storage name, string_value value);
42 
43  //* =====================================================================
45  //* =====================================================================
46  variable(telnetpp::byte_storage name, array_value array_values);
47 
48  //* =====================================================================
50  //* =====================================================================
51  variable(telnetpp::byte_storage name, table_value table_values);
52 
53  telnetpp::byte_storage name_;
54  value_type value_;
55 };
56 
57 //* =========================================================================
59 //* =========================================================================
60 TELNETPP_EXPORT
61 bool operator==(variable const &lhs, variable const &rhs);
62 
63 //* =========================================================================
65 //* =========================================================================
66 TELNETPP_EXPORT
67 bool operator!=(variable const &lhs, variable const &rhs);
68 
69 //* =========================================================================
71 //* =========================================================================
72 TELNETPP_EXPORT
73 std::ostream &operator<<(std::ostream &out, variable const &var);
74 
75 } // namespace telnetpp::options::msdp
A variant that can either be a string, an array of string, or an array of telnetpp::options::msdp::va...
An implementation of the Mud Server Data Protocol.
Definition: client.hpp:6
TELNETPP_EXPORT bool operator!=(variable const &lhs, variable const &rhs)
Inequality operator.
Definition: variable.cpp:54
TELNETPP_EXPORT std::ostream & operator<<(std::ostream &out, variable const &var)
Stream Output operator.
Definition: variable.cpp:62
TELNETPP_EXPORT bool operator==(variable const &lhs, variable const &rhs)
Equality operator.
Definition: variable.cpp:46
A structure that represents a named value.
Definition: variable.hpp:32