Telnet++ 4.0.0.9
A C++ library for interacting with Telnet streams
Loading...
Searching...
No Matches
command.hpp
1#pragma once
2
3#include "telnetpp/core.hpp"
4
5#include <iosfwd>
6
7namespace telnetpp {
8
9//* =========================================================================
11//* =========================================================================
12class TELNETPP_EXPORT command
13{
14public:
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
30private:
31 command_type command_;
32};
33
34//* =========================================================================
36//* =========================================================================
37constexpr bool operator==(command const &lhs, command const &rhs) noexcept
38{
39 return lhs.value() == rhs.value();
40}
41
42//* =========================================================================
44//* =========================================================================
45constexpr bool operator<(command const &lhs, command const &rhs) noexcept
46{
47 return lhs.value() < rhs.value();
48}
49
50//* =========================================================================
52//* =========================================================================
53TELNETPP_EXPORT
54std::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