CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::AttributedString Class Reference

A string that has associated attributes (such as visual style, hyperlinks, or accessibility data) for portions of its text. More...

#include <CeresEngine/Foundation/AttributedString.hpp>

Public Member Functions

 AttributedString (String string)
 
template<typename T >
const TgetAttribute (const UInt32 &charIdx) const
 
template<typename T >
void setAttribute (const CharRange &range, T &&attribute)
 

Private Attributes

String string
 The character contents of the attributed string as an String object.
 
HashMap< String, intattributes
 

Detailed Description

A string that has associated attributes (such as visual style, hyperlinks, or accessibility data) for portions of its text.

An AttributedString object manages character strings and associated sets of attributes (for example, font and kerning) that apply to individual characters or ranges of characters in the string. An association of characters and their attributes is called an attributed string.

An attributed string identifies attributes by name, using an HashMap object to store a value under the given name. You can assign any attribute name/value pair you wish to a range of characters—it is up to the application to interpret custom attributes.

Be aware that comparisons of AttributedString objects using the operator== look for exact equality. The comparison includes both a character-by-character string equality check and an equality check of all attributes. Such a comparison is not likely to yield a match if the string has many attributes, such as attachments, lists, and tables, for example.

Constructor & Destructor Documentation

◆ AttributedString()

CeresEngine::AttributedString::AttributedString ( String  string)

Member Function Documentation

◆ getAttribute()

template<typename T >
const T & CeresEngine::AttributedString::getAttribute ( const UInt32 charIdx) const

◆ setAttribute()

template<typename T >
void CeresEngine::AttributedString::setAttribute ( const CharRange range,
T &&  attribute 
)

Member Data Documentation

◆ attributes

HashMap<String, int> CeresEngine::AttributedString::attributes
private

◆ string

String CeresEngine::AttributedString::string
private

The character contents of the attributed string as an String object.


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