|
Source-highlight Library
|
Translates specific character sequences into corresponding ones; it can also use regular expression for the characters to be translated. More...
#include <chartranslator.h>


Public Member Functions | |
| CharTranslator (PreFormatterPtr f=PreFormatterPtr()) | |
| void | set_translation (const std::string &s1, const std::string &s2) |
| Adds a translation pair. | |
| const std::string | toString () const |
| returns a string representation: what we translate and into what we translate | |
| void | setPreFormatter (PreFormatterPtr f) |
| Sets the nested preformatter. | |
| const std::string | preformat (const std::string &text) |
| Preformats the passed string (public version) | |
Protected Member Functions | |
| virtual const std::string | doPreformat (const std::string &text) |
| The actual preformatting (char translation) | |
Private Attributes | |
| PreFormatterPtr | decorator |
| the possible nested preformatter (Decorator pattern) | |
Translates specific character sequences into corresponding ones; it can also use regular expression for the characters to be translated.
This is useful for translating some characters in the input which are special characters in the output formats, e.g., & in LaTeX, or < in HTML.
| srchilite::CharTranslator::CharTranslator | ( | PreFormatterPtr | f = PreFormatterPtr() | ) |
| f | the decorated preformatter |
|
protectedvirtual |
The actual preformatting (char translation)
| text | what to translate |
Reimplemented from srchilite::PreFormatter.
|
inherited |
Preformats the passed string (public version)
| text | the string to be preformatted |
| void srchilite::CharTranslator::set_translation | ( | const std::string & | s1, |
| const std::string & | s2 | ||
| ) |
Adds a translation pair.
| s1 | what to translate |
| s2 | the translated expression |
|
inherited |
Sets the nested preformatter.
| f | the nested (decorated) preformatter |