Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
EnrichedString Class Reference

#include <enriched_string.h>

+ Collaboration diagram for EnrichedString:

Public Member Functions

 EnrichedString ()
 
 EnrichedString (std::wstring_view s, const video::SColor &color=video::SColor(255, 255, 255, 255))
 
 EnrichedString (std::wstring_view string, const std::vector< video::SColor > &colors)
 
EnrichedStringoperator= (std::wstring_view s)
 
void clear ()
 
void addAtEnd (std::wstring_view s, video::SColor color)
 
void addChar (const EnrichedString &source, size_t i)
 
void addCharNoColor (wchar_t c)
 
EnrichedString getNextLine (size_t *pos) const
 
EnrichedString substr (size_t pos=0, size_t len=std::string::npos) const
 
EnrichedString operator+ (const EnrichedString &other) const
 
void operator+= (const EnrichedString &other)
 
void operator+= (std::wstring_view other)
 
const wchar_t * c_str () const
 
const std::vector< video::SColor > & getColors () const
 
const std::wstring & getString () const
 
void setDefaultColor (video::SColor color)
 
void updateDefaultColor ()
 
const 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
 
video::SColor getBackground () const
 
void setBackground (video::SColor color)
 

Private Attributes

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

Constructor & Destructor Documentation

◆ EnrichedString() [1/3]

EnrichedString::EnrichedString ( )

References clear().

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

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

◆ EnrichedString() [2/3]

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

◆ EnrichedString() [3/3]

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

Member Function Documentation

◆ addAtEnd()

void EnrichedString::addAtEnd ( std::wstring_view s,
video::SColor color )

References m_background, m_colors, m_default_color, m_default_length, m_has_background, m_string, parseColorString(), split(), and wide_to_utf8().

Referenced by operator=().

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

◆ addChar()

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

References m_colors, and m_string.

Referenced by irr::gui::StaticText::updateText().

+ Here is the caller graph for this function:

◆ addCharNoColor()

void EnrichedString::addCharNoColor ( wchar_t c)

References m_colors, m_default_color, and m_string.

Referenced by irr::gui::StaticText::updateText().

+ Here is the caller graph for this function:

◆ c_str()

const wchar_t * EnrichedString::c_str ( ) const
inline

References getString().

Referenced by GUIEngine::GUIEngine(), irr::gui::CGUITTFont::draw(), Hud::drawLuaElements(), setStaticText(), irr::gui::StaticText::setText(), GameUI::updateProfiler(), irr::gui::StaticText::updateText(), and GUIEngine::updateTopLeftTextSize().

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

◆ clear()

void EnrichedString::clear ( )

References m_background, m_colors, m_default_color, m_default_length, m_has_background, and m_string.

Referenced by EnrichedString(), operator=(), and irr::gui::StaticText::updateText().

+ Here is the caller graph for this function:

◆ empty()

bool EnrichedString::empty ( ) const
inline

References m_string.

◆ getBackground()

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

References m_background.

Referenced by irr::gui::StaticText::getBackgroundColor(), TestUtilities::testEnrichedString(), and irr::gui::StaticText::updateText().

+ Here is the caller graph for this function:

◆ getColors()

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

References m_colors.

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

+ Here is the caller graph for this function:

◆ getDefaultColor()

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

References m_default_color.

Referenced by irr::gui::StaticText::getOverrideColor().

+ Here is the caller graph for this function:

◆ getNextLine()

EnrichedString EnrichedString::getNextLine ( size_t * pos) const

References getString(), and substr().

Referenced by Hud::drawLuaElements(), and GUIFormSpecMenu::parseLabel().

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

◆ getString()

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

References m_string.

Referenced by c_str(), ChatBuffer::formatChatLine(), getNextLine(), TestUtilities::testEnrichedString(), and irr::gui::StaticText::updateText().

+ Here is the caller graph for this function:

◆ hasBackground()

bool EnrichedString::hasBackground ( ) const
inline

References m_has_background.

Referenced by irr::gui::StaticText::getBackgroundColor(), GUIFormSpecMenu::showTooltip(), and irr::gui::StaticText::updateText().

+ 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+=() [1/2]

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

References m_colors, m_default_length, m_string, and updateDefaultColor().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

void EnrichedString::operator+= ( std::wstring_view other)
inline

References EnrichedString().

+ Here is the call graph for this function:

◆ operator=()

EnrichedString & EnrichedString::operator= ( std::wstring_view s)

References addAtEnd(), clear(), m_default_color, and 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 ( video::SColor color)
inline

References m_background, and m_has_background.

Referenced by irr::gui::StaticText::setBackgroundColor(), GUIFormSpecMenu::showTooltip(), and GameUI::updateProfiler().

+ Here is the caller graph for this function:

◆ setDefaultColor()

void EnrichedString::setDefaultColor ( video::SColor color)
inline

References m_default_color, and updateDefaultColor().

Referenced by ChatBuffer::formatChatLine(), irr::gui::StaticText::setOverrideColor(), GUIFormSpecMenu::showTooltip(), substr(), and TestUtilities::testEnrichedString().

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

◆ size()

size_t EnrichedString::size ( ) const
inline

References m_string.

Referenced by Hud::drawLuaElements(), ChatBuffer::formatChatLine(), GUIFormSpecMenu::parseLabel(), substr(), and irr::gui::StaticText::updateText().

+ Here is the caller graph for this function:

◆ substr()

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

References EnrichedString(), m_background, m_colors, m_default_color, m_default_length, m_has_background, m_string, setDefaultColor(), and size().

Referenced by ChatBuffer::formatChatLine(), getNextLine(), TestUtilities::testEnrichedString(), and irr::gui::StaticText::updateText().

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

◆ updateDefaultColor()

void EnrichedString::updateDefaultColor ( )

References m_colors, m_default_color, m_default_length, and sanity_check.

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_background

video::SColor EnrichedString::m_background
private

◆ m_colors

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

◆ m_default_color

video::SColor EnrichedString::m_default_color
private

◆ m_default_length

size_t EnrichedString::m_default_length = 0
private

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