Telnet++  3.1.0.2
A C++ library for interacting with Telnet streams
command.hpp
1 #pragma once
2 
3 #include "telnetpp/core.hpp"
4 
5 #include <iosfwd>
6 
7 namespace telnetpp {
8 
9 //* =========================================================================
11 //* =========================================================================
12 class TELNETPP_EXPORT command
13 {
14 public:
15  //* =====================================================================
17  //* =====================================================================
18  explicit constexpr command(command_type cmnd) noexcept : command_(cmnd)
19  {
20  }
21 
22  //* =====================================================================
24  //* =====================================================================
25  [[nodiscard]] constexpr command_type value() const noexcept
26  {
27  return command_;
28  }
29 
30 private:
31  command_type command_;
32 };
33 
34 //* =========================================================================
36 //* =========================================================================
37 constexpr bool operator==(command const &lhs, command const &rhs) noexcept
38 {
39  return lhs.value() == rhs.value();
40 }
41 
42 //* =========================================================================
44 //* =========================================================================
45 constexpr bool operator<(command const &lhs, command const &rhs) noexcept
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 } // namespace telnetpp
A class that encapsulates the value of a Telnet command.
Definition: command.hpp:13
constexpr command_type value() const noexcept
Returns the value of the command.
Definition: command.hpp:25
constexpr command(command_type cmnd) noexcept
Constructor.
Definition: command.hpp:18