diff options
author | crupest <crupest@outlook.com> | 2021-06-07 20:42:28 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-06-07 20:42:28 +0800 |
commit | 3ac9362b11383574aca40b33bee55bee3970171c (patch) | |
tree | da4e0cdf14801dfa4f549431aa365fa47a758899 /computer-network-experiment/Common.h | |
parent | 45ea1ec04953380ea50e346ba0f1b2eeda0c2dd3 (diff) | |
download | life-3ac9362b11383574aca40b33bee55bee3970171c.tar.gz life-3ac9362b11383574aca40b33bee55bee3970171c.tar.bz2 life-3ac9362b11383574aca40b33bee55bee3970171c.zip |
...
Diffstat (limited to 'computer-network-experiment/Common.h')
-rw-r--r-- | computer-network-experiment/Common.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/computer-network-experiment/Common.h b/computer-network-experiment/Common.h index c3b6094..6886e38 100644 --- a/computer-network-experiment/Common.h +++ b/computer-network-experiment/Common.h @@ -17,6 +17,10 @@ inline auto &error_stream = std::wcerr; inline String ConvertCharString(std::string_view s) {
return cru::ToUtf16WString(s);
}
+
+inline std::string ConvertCharStringBack(StringView s) {
+ return cru::ToUtf8(s);
+}
#else
using Char = char;
using String = std::string;
@@ -27,6 +31,7 @@ inline auto &error_stream = std::cerr; #define CRUT(string_literal) string_literal
inline String ConvertCharString(std::string_view s) { return String(s); }
+inline std::string ConvertCharStringBack(StringView s) { return {s}; }
#endif
int Main();
@@ -34,10 +39,6 @@ int Main(); [[noreturn]] void PrintErrorMessageAndExit(StringView message,
bool print_last_error = true);
-#ifdef WIN32
-void InitWSA();
-#endif
-
int CloseSocket(int socket);
void BeforeExit();
@@ -45,4 +46,4 @@ void BeforeExit(); String ReadInputLine();
void SafeSend(int socket, std::string_view buffer);
-std::string SafeReadUntil(int socket, char c, std::string& rest);
+std::string SafeReadUntil(int socket, char c, std::string &rest);
|