|
MUSX Document Model
|
Wrapper class for interpreting and rendering Enigma-style strings with insert handling. More...
#include <EnigmaString.h>
Public Member Functions | |
| EnigmaParsingContext () | |
| Null constructor. | |
| EnigmaParsingContext (dom::MusxInstance< dom::TextsBase > rawText, dom::Cmper forPartId, std::optional< dom::Cmper > forPageId=std::nullopt, EnigmaString::TextInsertCallback insertFunc=EnigmaString::defaultInsertsCallback) | |
| Constructor. | |
| operator bool () const noexcept | |
| Check whether the context holds a valid raw text pointer. | |
| std::string | getText (bool trimTags=false, EnigmaString::AccidentalStyle accidentalStyle=EnigmaString::AccidentalStyle::Ascii, const std::unordered_set< std::string_view > &ignoreTags={}) const |
| Return displayable text with Enigma tags converted. | |
| bool | parseEnigmaText (const EnigmaString::TextChunkCallback &onText, const EnigmaString::TextInsertCallback &onInsert, const EnigmaString::EnigmaParsingOptions &options={}) const |
| Parse the Enigma text into structured chunks with insert handling. | |
| bool | parseEnigmaText (const EnigmaString::TextChunkCallback &onText, const EnigmaString::EnigmaParsingOptions &options={}) const |
| Parse the Enigma text into structured chunks with insert handling. | |
| dom::MusxInstance< dom::FontInfo > | parseFirstFontInfo () const |
| Returns a shared pointer to a FontInfo instance that reflects the first font information in the text. | |
| dom::MusxInstance< dom::TextsBase > | getRawText () const |
| Get the raw text pointer. | |
| dom::Cmper | getRequestedPartId () const |
| Get the requested part id. | |
| std::optional< int > | getPageNumber () const |
| Get the page number that was supplied, if any. | |
Public Attributes | |
| std::string | affixText |
| Prefix or suffix to be passed in parsing options. | |
| bool | affixIsPrefix {} |
| True if affixText is a prefix; false if it is a suffix. | |
Wrapper class for interpreting and rendering Enigma-style strings with insert handling.
This class provides implementations of getText() and parseEnigmaText() that retrieve the raw text from a TextsBase object, either directly or by ID, and perform substitution of special insert commands such as ^page, ^date, etc.
|
inline |
Constructor.
| rawText | The raw text to use |
| forPartId | The linked part ID to use for ^partname and ^totpages inserts |
| forPageId | The value to use as page number for ^page inserts. ("#" is inserted if not provided, mimicing Finale behavior.) |
| insertFunc | A common handler for insert conversions. |
| std::string musx::util::EnigmaParsingContext::getText | ( | bool | trimTags = false, |
| EnigmaString::AccidentalStyle | accidentalStyle = EnigmaString::AccidentalStyle::Ascii, |
||
| const std::unordered_set< std::string_view > & | ignoreTags = {} |
||
| ) | const |
Return displayable text with Enigma tags converted.
| trimTags | Whether to trim unknown tags or dump them into the output. |
| accidentalStyle | The accidental substitution style to use. (ASCII, Unicode, SMuFL) |
| ignoreTags | A list of tags to ignore. (Normally only used internally.) |
|
inline |
Parse the Enigma text into structured chunks with insert handling.
| onText | The handler for font and text style changes. |
| options | The options for the parsing session. |
| bool musx::util::EnigmaParsingContext::parseEnigmaText | ( | const EnigmaString::TextChunkCallback & | onText, |
| const EnigmaString::TextInsertCallback & | onInsert, | ||
| const EnigmaString::EnigmaParsingOptions & | options = {} |
||
| ) | const |
Parse the Enigma text into structured chunks with insert handling.
| onText | The handler for font and text style changes. |
| onInsert | The handler for insert conversions. This function is called first. If it returns a string, the default insert value is skipped. |
| options | The options for the parsing session. |