nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
chat.h
Go to the documentation of this file.
1#ifndef NANOMMO_PROTOCOL_CHAT_H_
2#define NANOMMO_PROTOCOL_CHAT_H_
3
4#include <cstddef>
5#include <optional>
6#include <string>
7#include <string_view>
8
9namespace nanommo {
10
11/// The longest line a player can say, in bytes. A character takes one to
12/// four bytes in UTF-8, so that's at least fifty characters.
13constexpr std::size_t kMaxChatLength = 200;
14
15/// The line as the other players get it: control characters, such as a new
16/// line, become spaces, and the spaces at either end go. Nothing if that
17/// leaves nothing, or if the line is longer than kMaxChatLength.
18std::optional<std::string> CleanChat(std::string_view text);
19
20} // namespace nanommo
21
22#endif // NANOMMO_PROTOCOL_CHAT_H_
Definition chat.cc:9
constexpr std::size_t kMaxChatLength
Definition chat.h:13
std::optional< std::string > CleanChat(std::string_view text)
Definition chat.cc:11