-
Notifications
You must be signed in to change notification settings - Fork 10
/
command.hpp
56 lines (46 loc) · 1.86 KB
/
command.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "telnetpp/core.hpp"
#include <iosfwd>
namespace telnetpp {
//* =========================================================================
/// \brief A class that encapsulates the value of a Telnet command.
//* =========================================================================
class TELNETPP_EXPORT command
{
public:
//* =====================================================================
/// \brief Constructor
//* =====================================================================
explicit constexpr command(command_type cmnd) noexcept : command_(cmnd)
{
}
//* =====================================================================
/// \brief Returns the value of the command.
//* =====================================================================
[[nodiscard]] constexpr command_type value() const noexcept
{
return command_;
}
private:
command_type command_;
};
//* =========================================================================
/// \brief Comparison function for commands
//* =========================================================================
constexpr bool operator==(command const &lhs, command const &rhs) noexcept
{
return lhs.value() == rhs.value();
}
//* =========================================================================
/// \brief Comparison function for commands
//* =========================================================================
constexpr bool operator<(command const &lhs, command const &rhs) noexcept
{
return lhs.value() < rhs.value();
}
//* =========================================================================
/// \brief Stream output for commands
//* =========================================================================
TELNETPP_EXPORT
std::ostream &operator<<(std::ostream &out, command const &cmd);
} // namespace telnetpp