Telnet++
A C++ library for interacting with Telnet streams
command.hpp
1 #pragma once
2 
3 #include "telnetpp/core.hpp"
4 #include <iosfwd>
5 
6 namespace telnetpp {
7 
8 //* =========================================================================
10 //* =========================================================================
11 class TELNETPP_EXPORT command
12 {
13 public :
14  //* =====================================================================
16  //* =====================================================================
17  explicit constexpr command(u8 command)
18  : command_(command)
19  {
20  }
21 
22  //* =====================================================================
24  //* =====================================================================
25  constexpr u8 value() const
26  {
27  return command_;
28  }
29 
30 private :
31  u8 command_;
32 };
33 
34 //* =========================================================================
36 //* =========================================================================
37 constexpr bool operator==(command const &lhs, command const &rhs)
38 {
39  return lhs.value() == rhs.value();
40 }
41 
42 //* =========================================================================
44 //* =========================================================================
45 constexpr bool operator<(command const &lhs, command const &rhs)
46 {
47  return lhs.value() < rhs.value();
48 }
49 
50 //* =========================================================================
52 //* =========================================================================
53 TELNETPP_EXPORT
54 std::ostream &operator<<(std::ostream &out, command const &cmd);
55 
56 }
constexpr u8 value() const
Returns the value of the command.
Definition: command.hpp:25
constexpr command(u8 command)
Constructor.
Definition: command.hpp:17
A class that encapsulates the value of a Telnet command.
Definition: command.hpp:11
Definition: byte_converter.hpp:4