Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
ChatBuffer Class Reference

#include <chat.h>

+ Collaboration diagram for ChatBuffer:

Public Member Functions

 ChatBuffer (u32 scrollback)
 
 ~ChatBuffer ()=default
 
void addLine (const std::wstring &name, const std::wstring &text)
 
void clear ()
 
u32 getLineCount () const
 
const ChatLinegetLine (u32 index) const
 
void step (f32 dtime)
 
void deleteOldest (u32 count)
 
void deleteByAge (f32 maxAge)
 
u32 getRows () const
 
void reformat (u32 cols, u32 rows)
 
const ChatFormattedLinegetFormattedLine (u32 row) const
 
void scroll (s32 rows)
 
void scrollAbsolute (s32 scroll)
 
void scrollBottom ()
 
bool getLinesModified () const
 
void resetLinesModified ()
 
u32 formatChatLine (const ChatLine &line, u32 cols, std::vector< ChatFormattedLine > &destination) const
 
void resize (u32 scrollback)
 

Protected Member Functions

s32 getTopScrollPos () const
 
s32 getBottomScrollPos () const
 

Private Attributes

u32 m_scrollback
 
std::vector< ChatLinem_unformatted
 
u32 m_cols = 0
 
u32 m_rows = 0
 
s32 m_scroll = 0
 
std::vector< ChatFormattedLinem_formatted
 
ChatFormattedLine m_empty_formatted_line
 
bool m_cache_clickable_chat_weblinks
 
irr::video::SColor m_cache_chat_weblink_color
 
bool m_lines_modified = true
 

Constructor & Destructor Documentation

◆ ChatBuffer()

ChatBuffer::ChatBuffer ( u32 scrollback)

References ChatFormattedLine::first, g_settings, Settings::get(), Settings::getBool(), m_cache_chat_weblink_color, m_cache_clickable_chat_weblinks, m_empty_formatted_line, m_scrollback, and parseColorString().

+ Here is the call graph for this function:

◆ ~ChatBuffer()

ChatBuffer::~ChatBuffer ( )
default

Member Function Documentation

◆ addLine()

void ChatBuffer::addLine ( const std::wstring & name,
const std::wstring & text )

References deleteOldest(), formatChatLine(), getBottomScrollPos(), m_cols, m_formatted, m_lines_modified, m_rows, m_scroll, m_scrollback, and m_unformatted.

Referenced by ChatBackend::addMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear()

void ChatBuffer::clear ( )

References m_formatted, m_lines_modified, m_scroll, and m_unformatted.

Referenced by ChatBackend::clearRecentChat().

+ Here is the caller graph for this function:

◆ deleteByAge()

void ChatBuffer::deleteByAge ( f32 maxAge)

References deleteOldest(), and m_unformatted.

Referenced by ChatBackend::step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteOldest()

void ChatBuffer::deleteOldest ( u32 count)

References getBottomScrollPos(), m_formatted, m_lines_modified, m_scroll, m_unformatted, sanity_check, and scrollAbsolute().

Referenced by addLine(), deleteByAge(), and resize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatChatLine()

u32 ChatBuffer::formatChatLine ( const ChatLine & line,
u32 cols,
std::vector< ChatFormattedLine > & destination ) const

References ChatFormattedFragment::column, ChatFormattedLine::first, ChatFormattedLine::fragments, EnrichedString::getString(), m_cache_chat_weblink_color, m_cache_clickable_chat_weblinks, EnrichedString::setDefaultColor(), EnrichedString::size(), EnrichedString::substr(), ChatFormattedFragment::text, ChatFormattedFragment::weblink, and wide_to_utf8().

Referenced by addLine(), and reformat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBottomScrollPos()

s32 ChatBuffer::getBottomScrollPos ( ) const
protected

References m_formatted, and m_rows.

Referenced by addLine(), deleteOldest(), reformat(), scrollAbsolute(), and scrollBottom().

+ Here is the caller graph for this function:

◆ getFormattedLine()

const ChatFormattedLine & ChatBuffer::getFormattedLine ( u32 row) const

References m_empty_formatted_line, m_formatted, and m_scroll.

Referenced by GUIChatConsole::drawText(), and GUIChatConsole::weblinkClick().

+ Here is the caller graph for this function:

◆ getLine()

const ChatLine & ChatBuffer::getLine ( u32 index) const

References getLineCount(), and m_unformatted.

Referenced by ChatBackend::getRecentChat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLineCount()

u32 ChatBuffer::getLineCount ( ) const

References m_unformatted.

Referenced by getLine(), and ChatBackend::getRecentChat().

+ Here is the caller graph for this function:

◆ getLinesModified()

bool ChatBuffer::getLinesModified ( ) const
inline

References m_lines_modified.

◆ getRows()

u32 ChatBuffer::getRows ( ) const

References m_rows.

Referenced by GUIChatConsole::drawPrompt(), GUIChatConsole::drawText(), ChatBackend::scrollPageDown(), and ChatBackend::scrollPageUp().

+ Here is the caller graph for this function:

◆ getTopScrollPos()

s32 ChatBuffer::getTopScrollPos ( ) const
protected

References m_formatted, and m_rows.

Referenced by scrollAbsolute().

+ Here is the caller graph for this function:

◆ reformat()

void ChatBuffer::reformat ( u32 cols,
u32 rows )

References formatChatLine(), getBottomScrollPos(), m_cols, m_formatted, m_rows, m_scroll, m_unformatted, scrollAbsolute(), and scrollBottom().

Referenced by ChatBackend::reformat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetLinesModified()

void ChatBuffer::resetLinesModified ( )
inline

References m_lines_modified.

Referenced by Game::updateChat().

+ Here is the caller graph for this function:

◆ resize()

void ChatBuffer::resize ( u32 scrollback)

References deleteOldest(), m_scrollback, and m_unformatted.

Referenced by ChatBackend::applySettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scroll()

void ChatBuffer::scroll ( s32 rows)

References m_scroll, and scrollAbsolute().

Referenced by ChatBackend::scroll(), scrollAbsolute(), ChatBackend::scrollPageDown(), and ChatBackend::scrollPageUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scrollAbsolute()

void ChatBuffer::scrollAbsolute ( s32 scroll)

References getBottomScrollPos(), getTopScrollPos(), m_scroll, and scroll().

Referenced by deleteOldest(), reformat(), and scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scrollBottom()

void ChatBuffer::scrollBottom ( )

References getBottomScrollPos(), and m_scroll.

Referenced by reformat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ step()

void ChatBuffer::step ( f32 dtime)

References m_unformatted.

Referenced by ChatBackend::step().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_cache_chat_weblink_color

irr::video::SColor ChatBuffer::m_cache_chat_weblink_color
private

Referenced by ChatBuffer(), and formatChatLine().

◆ m_cache_clickable_chat_weblinks

bool ChatBuffer::m_cache_clickable_chat_weblinks
private

Referenced by ChatBuffer(), and formatChatLine().

◆ m_cols

u32 ChatBuffer::m_cols = 0
private

Referenced by addLine(), and reformat().

◆ m_empty_formatted_line

ChatFormattedLine ChatBuffer::m_empty_formatted_line
private

Referenced by ChatBuffer(), and getFormattedLine().

◆ m_formatted

std::vector<ChatFormattedLine> ChatBuffer::m_formatted
private

◆ m_lines_modified

bool ChatBuffer::m_lines_modified = true
private

◆ m_rows

u32 ChatBuffer::m_rows = 0
private

◆ m_scroll

s32 ChatBuffer::m_scroll = 0
private

◆ m_scrollback

u32 ChatBuffer::m_scrollback
private

Referenced by ChatBuffer(), addLine(), and resize().

◆ m_unformatted

std::vector<ChatLine> ChatBuffer::m_unformatted
private

The documentation for this class was generated from the following files: