#ifndef CHAT_HEADER
#define CHAT_HEADER
-#include "irrlichttypes.h"
#include <string>
#include <vector>
#include <list>
+#include "irrlichttypes.h"
+#include "util/enriched_string.h"
+
// Chat console related classes
struct ChatLine
// age in seconds
f32 age;
// name of sending player, or empty if sent by server
- std::wstring name;
+ EnrichedString name;
// message text
- std::wstring text;
+ EnrichedString text;
+
+ ChatLine(const std::wstring &a_name, const std::wstring &a_text):
+ age(0.0),
+ name(a_name),
+ text(a_text)
+ {
+ }
- ChatLine(std::wstring a_name, std::wstring a_text):
+ ChatLine(const EnrichedString &a_name, const EnrichedString &a_text):
age(0.0),
name(a_name),
text(a_text)
struct ChatFormattedFragment
{
// text string
- std::wstring text;
+ EnrichedString text;
// starting column
u32 column;
// formatting
// Get number of lines currently in buffer.
u32 getLineCount() const;
- // Get scrollback size, maximum number of lines in buffer.
- u32 getScrollback() const;
// Get reference to i-th chat line.
const ChatLine& getLine(u32 index) const;
class ChatPrompt
{
public:
- ChatPrompt(std::wstring prompt, u32 history_limit);
+ ChatPrompt(const std::wstring &prompt, u32 history_limit);
~ChatPrompt();
// Input character or string
std::wstring getLine() const { return m_line; }
// Get section of line that is currently selected
- std::wstring getSelection() const
- { return m_line.substr(m_cursor, m_cursor_len); }
+ std::wstring getSelection() const { return m_line.substr(m_cursor, m_cursor_len); }
// Clear the current line
void clear();
// Get the recent messages buffer
ChatBuffer& getRecentBuffer();
// Concatenate all recent messages
- std::wstring getRecentChat();
+ EnrichedString getRecentChat();
// Get the console prompt
ChatPrompt& getPrompt();