Luanti 5.18.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 EnrichedString &name, const EnrichedString &text)
void clear ()
u32 getLineCount () const
const ChatLine & getLine (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 ChatFormattedLine & getFormattedLine (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)
s32 getScrollPosition () const
s32 getTopScrollPos () const
s32 getBottomScrollPos () const

Private Attributes

u32 m_scrollback
std::vector< ChatLine > m_unformatted
u32 m_cols = 0
u32 m_rows = 0
s32 m_scroll = 0
std::vector< ChatFormattedLine > m_formatted
ChatFormattedLine m_empty_formatted_line
bool m_cache_clickable_chat_weblinks
video::SColor m_cache_chat_weblink_color
bool m_lines_modified = true

Constructor & Destructor Documentation

◆ ChatBuffer()

ChatBuffer::ChatBuffer ( u32 scrollback)

References g_settings, 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

References scroll().

Here is the call graph for this function:

Member Function Documentation

◆ addLine()

void ChatBuffer::addLine ( const EnrichedString & name,
const EnrichedString & text )

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

Here is the call graph for this function:

◆ clear()

void ChatBuffer::clear ( )

◆ deleteByAge()

void ChatBuffer::deleteByAge ( f32 maxAge)

References deleteOldest(), and m_unformatted.

Here is the call 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

References m_formatted, and m_rows.

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

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().

Here is the caller graph for this function:

◆ getLine()

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

References getLineCount(), and m_unformatted.

Here is the call graph for this function:

◆ getLineCount()

u32 ChatBuffer::getLineCount ( ) const

References m_unformatted.

Referenced by getLine(), and GUIChatConsole::updateScrollbar().

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::drawText().

Here is the caller graph for this function:

◆ getScrollPosition()

s32 ChatBuffer::getScrollPosition ( ) const
inline

References m_scroll.

Referenced by GUIChatConsole::updateScrollbar().

Here is the caller graph for this function:

◆ getTopScrollPos()

s32 ChatBuffer::getTopScrollPos ( ) const

References m_formatted, and m_rows.

Referenced by scrollAbsolute(), and GUIChatConsole::updateScrollbar().

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().

Here is the call graph for this function:

◆ resetLinesModified()

void ChatBuffer::resetLinesModified ( )
inline

References m_lines_modified.

◆ resize()

void ChatBuffer::resize ( u32 scrollback)

References deleteOldest(), m_scrollback, and m_unformatted.

Here is the call graph for this function:

◆ scroll()

void ChatBuffer::scroll ( s32 rows)

References m_scroll, and scrollAbsolute().

Referenced by ~ChatBuffer(), and scrollAbsolute().

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.

Member Data Documentation

◆ m_cache_chat_weblink_color

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

◆ 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: