Cleanup in content_mapblock (#5746)
[oweals/minetest.git] / src / chat.h
index db4146d35ba8ffd59dd6d2cf0159959a90a727b2..b7c6b74b90a8d1594972ea828b6fd55cd8cba8fa 100644 (file)
@@ -20,11 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #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
@@ -32,11 +34,18 @@ 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)
@@ -47,7 +56,7 @@ struct ChatLine
 struct ChatFormattedFragment
 {
        // text string
-       std::wstring text;
+       EnrichedString text;
        // starting column
        u32 column;
        // formatting
@@ -77,8 +86,6 @@ public:
 
        // 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;
 
@@ -139,7 +146,7 @@ private:
 class ChatPrompt
 {
 public:
-       ChatPrompt(std::wstring prompt, u32 history_limit);
+       ChatPrompt(const std::wstring &prompt, u32 history_limit);
        ~ChatPrompt();
 
        // Input character or string
@@ -153,8 +160,7 @@ public:
        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();
@@ -260,7 +266,7 @@ public:
        // Get the recent messages buffer
        ChatBuffer& getRecentBuffer();
        // Concatenate all recent messages
-       std::wstring getRecentChat();
+       EnrichedString getRecentChat();
        // Get the console prompt
        ChatPrompt& getPrompt();