|
CeresEngine 0.2.0
A game development framework
|
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 T & | getAttribute (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, int > | attributes |
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.
| CeresEngine::AttributedString::AttributedString | ( | String | string | ) |
|
private |
The character contents of the attributed string as an String object.