Minetest  5.4.0
EnrichedString Class Reference

#include <enriched_string.h>

+ Collaboration diagram for EnrichedString:

Public Member Functions

 EnrichedString ()
 
 EnrichedString (const std::wstring &s, const irr::video::SColor &color=irr::video::SColor(255, 255, 255, 255))
 
 EnrichedString (const wchar_t *str, const irr::video::SColor &color=irr::video::SColor(255, 255, 255, 255))
 
 EnrichedString (const std::wstring &string, const std::vector< irr::video::SColor > &colors)
 
void clear ()
 
void operator= (const wchar_t *str)
 
void addAtEnd (const std::wstring &s, const irr::video::SColor &color)
 
void addChar (const EnrichedString &source, size_t i)
 
void addCharNoColor (wchar_t c)
 
EnrichedString substr (size_t pos=0, size_t len=std::string::npos) const
 
EnrichedString operator+ (const EnrichedString &other) const
 
void operator+= (const EnrichedString &other)
 
const wchar_t * c_str () const
 
const std::vector< irr::video::SColor > & getColors () const
 
const std::wstring & getString () const
 
void setDefaultColor (const irr::video::SColor &color)
 
void updateDefaultColor ()
 
const irr::video::SColor & getDefaultColor () const
 
bool operator== (const EnrichedString &other) const
 
bool operator!= (const EnrichedString &other) const
 
bool empty () const
 
size_t size () const
 
bool hasBackground () const
 
irr::video::SColor getBackground () const
 
void setBackground (const irr::video::SColor &color)
 

Private Attributes

std::wstring m_string
 
std::vector< irr::video::SColor > m_colors
 
bool m_has_background
 
irr::video::SColor m_default_color
 
irr::video::SColor m_background
 
size_t m_default_length = 0
 

Constructor & Destructor Documentation

◆ EnrichedString() [1/4]

EnrichedString::EnrichedString ( )

◆ EnrichedString() [2/4]

EnrichedString::EnrichedString ( const std::wstring &  s,
const irr::video::SColor &  color = irr::video::SColor(255, 255, 255, 255) 
)

◆ EnrichedString() [3/4]

EnrichedString::EnrichedString ( const wchar_t *  str,
const irr::video::SColor &  color = irr::video::SColor(255, 255, 255, 255) 
)

◆ EnrichedString() [4/4]

EnrichedString::EnrichedString ( const std::wstring &  string,
const std::vector< irr::video::SColor > &  colors 
)

Member Function Documentation

◆ addAtEnd()

void EnrichedString::addAtEnd ( const std::wstring &  s,
const irr::video::SColor &  color 
)

References parseColorString(), split(), and wide_to_utf8().

+ Here is the call graph for this function:

◆ addChar()

void EnrichedString::addChar ( const EnrichedString source,
size_t  i 
)

References m_colors, and m_string.

◆ addCharNoColor()

void EnrichedString::addCharNoColor ( wchar_t  c)

◆ c_str()

const wchar_t * EnrichedString::c_str ( ) const

Referenced by GUIEngine::GUIEngine(), irr::gui::CGUITTFont::draw(), GUIChatConsole::drawText(), ChatBuffer::formatChatLine(), GameUI::updateProfiler(), and GUIEngine::updateTopLeftTextSize().

+ Here is the caller graph for this function:

◆ clear()

void EnrichedString::clear ( )

◆ empty()

bool EnrichedString::empty ( ) const
inline

References m_string.

Referenced by ChatBuffer::formatChatLine(), and ChatBackend::getRecentChat().

+ Here is the caller graph for this function:

◆ getBackground()

irr::video::SColor EnrichedString::getBackground ( ) const
inline

References m_background.

Referenced by TestUtilities::testEnrichedString().

+ Here is the caller graph for this function:

◆ getColors()

const std::vector< SColor > & EnrichedString::getColors ( ) const

Referenced by irr::gui::CGUITTFont::draw(), and TestUtilities::testEnrichedString().

+ Here is the caller graph for this function:

◆ getDefaultColor()

const irr::video::SColor& EnrichedString::getDefaultColor ( ) const
inline

References m_default_color.

◆ getString()

const std::wstring & EnrichedString::getString ( ) const

Referenced by irr::gui::CGUITTFont::draw(), ChatBuffer::formatChatLine(), and TestUtilities::testEnrichedString().

+ Here is the caller graph for this function:

◆ hasBackground()

bool EnrichedString::hasBackground ( ) const
inline

References m_has_background.

Referenced by GUIFormSpecMenu::showTooltip().

+ Here is the caller graph for this function:

◆ operator!=()

bool EnrichedString::operator!= ( const EnrichedString other) const
inline

◆ operator+()

EnrichedString EnrichedString::operator+ ( const EnrichedString other) const

◆ operator+=()

void EnrichedString::operator+= ( const EnrichedString other)

References m_colors, m_default_length, and m_string.

◆ operator=()

void EnrichedString::operator= ( const wchar_t *  str)

References translate_string().

+ Here is the call graph for this function:

◆ operator==()

bool EnrichedString::operator== ( const EnrichedString other) const
inline

References m_colors, and m_string.

◆ setBackground()

void EnrichedString::setBackground ( const irr::video::SColor &  color)
inline

References m_background, and m_has_background.

Referenced by GUIFormSpecMenu::showTooltip(), and GameUI::updateProfiler().

+ Here is the caller graph for this function:

◆ setDefaultColor()

void EnrichedString::setDefaultColor ( const irr::video::SColor &  color)

Referenced by GUIFormSpecMenu::showTooltip(), substr(), and TestUtilities::testEnrichedString().

+ Here is the caller graph for this function:

◆ size()

size_t EnrichedString::size ( ) const
inline

References m_string.

Referenced by GUIChatConsole::drawText(), ChatBuffer::formatChatLine(), and substr().

+ Here is the caller graph for this function:

◆ substr()

EnrichedString EnrichedString::substr ( size_t  pos = 0,
size_t  len = std::string::npos 
) const

References m_background, m_default_length, m_has_background, setDefaultColor(), and size().

Referenced by ChatBuffer::formatChatLine(), and TestUtilities::testEnrichedString().

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

◆ updateDefaultColor()

void EnrichedString::updateDefaultColor ( )

References sanity_check.

Member Data Documentation

◆ m_background

irr::video::SColor EnrichedString::m_background
private

◆ m_colors

std::vector<irr::video::SColor> EnrichedString::m_colors
private

Referenced by addChar(), operator+=(), and operator==().

◆ m_default_color

irr::video::SColor EnrichedString::m_default_color
private

Referenced by getDefaultColor().

◆ m_default_length

size_t EnrichedString::m_default_length = 0
private

Referenced by operator+=(), and substr().

◆ m_has_background

bool EnrichedString::m_has_background
private

◆ m_string

std::wstring EnrichedString::m_string
private

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