StormByte C++ Library: Network module 0.0.9999
StormByte-Network is a StormByte library module for handling and create network connections
Loading...
Searching...
No Matches
rw.hxx
1#pragma once
2
3#include <StormByte/network/visibility.h>
4
5#include <string>
6
11namespace StormByte::Network::Connection {
16 namespace Read {
21 enum class STORMBYTE_NETWORK_PUBLIC Result {
22 Success,
23 WouldBlock,
24 Closed,
25 Failed,
26 Timeout,
27 ShutdownRequest
28 };
29 }
30
35 namespace Write {
40 enum class STORMBYTE_NETWORK_PUBLIC Result {
41 Success,
42 Failed
43 };
44 }
45
51 constexpr STORMBYTE_NETWORK_PUBLIC std::string ToString(const StormByte::Network::Connection::Read::Result& result) noexcept {
52 switch (result) {
53 case StormByte::Network::Connection::Read::Result::Success:
54 return "Success";
55 case StormByte::Network::Connection::Read::Result::WouldBlock:
56 return "WouldBlock";
57 case StormByte::Network::Connection::Read::Result::Failed:
58 return "Failed";
59 case StormByte::Network::Connection::Read::Result::Closed:
60 return "Closed";
61 case StormByte::Network::Connection::Read::Result::Timeout:
62 return "Timeout";
63 case StormByte::Network::Connection::Read::Result::ShutdownRequest:
64 return "ShutdownRequest";
65 default:
66 return "Unknown";
67 }
68 }
69
75 constexpr STORMBYTE_NETWORK_PUBLIC std::string ToString(const StormByte::Network::Connection::Write::Result& result) noexcept {
76 switch (result) {
77 case StormByte::Network::Connection::Write::Result::Success:
78 return "Success";
79 case StormByte::Network::Connection::Write::Result::Failed:
80 return "Failed";
81 default:
82 return "Unknown";
83 }
84 }
85}
The namespace containing read items.
The namespace containing write items.