You.i Engine
CYITextMarkupParser Class Referenceabstract

Detailed Description

A class that implements a text markup parser. Such a class takes text with in-line markup as input, and outputs parsed text (without markup) and a list of text styles.

#include <utility/YiTextMarkupParser.h>

Inheritance diagram for CYITextMarkupParser:

Public Member Functions

virtual ~CYITextMarkupParser ()
 
virtual bool ParseMarkup (const CYIString &rMarkupText, const CYITextSceneNode::YI_TEXT_STYLE_DEF &rDefaultStyle, const CYICustomMarkupTagsProvider *pExternalTagsProvider, bool logErrors, CYIString *pParsedText, std::vector< CYITextSceneNode::YI_TEXT_STYLE_DEF > *pStyles) const =0
 Parses marked-up text and extracts the text without markup and the text styles. More...
 

Constructor & Destructor Documentation

◆ ~CYITextMarkupParser()

virtual CYITextMarkupParser::~CYITextMarkupParser ( )
inlinevirtual

Member Function Documentation

◆ ParseMarkup()

virtual bool CYITextMarkupParser::ParseMarkup ( const CYIString rMarkupText,
const CYITextSceneNode::YI_TEXT_STYLE_DEF rDefaultStyle,
const CYICustomMarkupTagsProvider pExternalTagsProvider,
bool  logErrors,
CYIString pParsedText,
std::vector< CYITextSceneNode::YI_TEXT_STYLE_DEF > *  pStyles 
) const
pure virtual

Parses marked-up text and extracts the text without markup and the text styles.

This function has two inputs, and two outputs. The inputs to the parser are the marked up text (e.g. text with in-line markup) rMarkupText, and a default text style rDefaultStyle. The default text style is used to 'fill in' gaps in the text markup (since it isn't necessary to specify all styles in the marked-up text). The outputs of the function are a text string with markup removed, pParsedText, and a vector of text styles, pStyles. The outputs are provided as pointers – if the provided pointers are null, the corresponding output will not be written to.

External styles may be provided through the pExternalTagsProvider pointer. If non-null, the pointer is expected to point to a class that can provide tags for given names. The expected format of those tags is dependent on the parser implementation, but generally the external tags follow the same format as the internal tags.

Note
Implemented parsers may make use of internal state to parse and may make use of system classes.
The behaviour when invalid markup is encountered varies between parser implementations. Generally, invalid tags will be left in-line, and an error is logged (if logErrors is true)
Returns
true if markupText was parsed without errors.

Implemented in CYIYouIMarkupParser.


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