|
Doxygen
|
Singleton helper class to map html entities to other formats. More...
#include <src/htmlentity.h>
Classes | |
| struct | PerlSymb |
Public Member Functions | |
| SymType | name2sym (const DString &symName) const |
| Give code of the requested HTML entity name. | |
| const char * | utf8 (SymType symb, bool useInPrintf=false) const |
| Access routine to the UTF8 code of the HTML entity. | |
| const char * | html (SymType symb, bool useInPrintf=false) const |
| Access routine to the html code of the HTML entity. | |
| const char * | xml (SymType symb) const |
| Access routine to the XML code of the HTML entity. | |
| const char * | docbook (SymType symb) const |
| Access routine to the docbook code of the HTML entity. | |
| const char * | latex (SymType symb) const |
| Access routine to the LaTeX code of the HTML entity. | |
| const char * | man (SymType symb) const |
| Access routine to the man code of the HTML entity. | |
| const char * | rtf (SymType symb) const |
| Access routine to the RTF code of the HTML entity. | |
| const PerlSymb * | perl (SymType symb) const |
| Access routine to the perl struct with the perl code of the HTML entity. | |
| void | writeXMLSchema (TextStream &t) |
| DString | convertCharEntitiesToUTF8 (const DString &s) const |
| template<class T> | |
| const char * | writeHtmlEntity (T &result, const char *s, HtmlEntityMapperFunc &&mapper, const char *fallback) |
Static Public Member Functions | |
| static HtmlEntityMapper & | instance () |
| Returns the one and only instance of the HTML entity mapper. | |
Private Member Functions | |
| void | validate () |
| Routine to check if the entries of the html_entities are numbered correctly. | |
| HtmlEntityMapper () | |
| ~HtmlEntityMapper () | |
Private Attributes | |
| std::unordered_map< std::string, SymType > | m_name2sym |
Static Private Attributes | |
| static HtmlEntityMapper * | s_instance |
Singleton helper class to map html entities to other formats.
Definition at line 29 of file htmlentity.h.
| using HtmlEntityMapper::HtmlEntityMapperFunc = std::function<DString(SymType)> |
Definition at line 116 of file htmlentity.h.
| Enumerator | |
|---|---|
| Perl_unknown | |
| Perl_string | |
| Perl_char | |
| Perl_symbol | |
| Perl_umlaut | |
| Perl_acute | |
| Perl_grave | |
| Perl_circ | |
| Perl_slash | |
| Perl_tilde | |
| Perl_cedilla | |
| Perl_ring | |
Definition at line 94 of file htmlentity.h.
Definition at line 32 of file htmlentity.h.
|
private |
Definition at line 326 of file htmlentity.cpp.
References g_htmlEntities, m_name2sym, and validate().
Referenced by instance().
|
private |
Definition at line 335 of file htmlentity.cpp.
Definition at line 494 of file htmlentity.cpp.
References DString::data(), DString::DString(), DString::empty(), end(), DString::length(), name2sym(), DString::reserve(), DString::substr(), Sym_Unknown, and utf8().
Referenced by convertToJSString(), getSQLDocBlock(), and parseCommentAsText().
| const char * HtmlEntityMapper::docbook | ( | HtmlEntityMapper::SymType | symb | ) | const |
Access routine to the docbook code of the HTML entity.
| symb | Code of the requested HTML entity |
nullptr is returned. Definition at line 403 of file htmlentity.cpp.
References g_htmlEntities.
Referenced by DocbookGenerator::convertToDocbook(), and DocbookDocVisitor::operator()().
| const char * HtmlEntityMapper::html | ( | HtmlEntityMapper::SymType | symb, |
| bool | useInPrintf = false ) const |
Access routine to the html code of the HTML entity.
| symb | Code of the requested HTML entity |
| useInPrintf | If true the result will be escaped such that it can be used in a printf string pattern |
nullptr is returned. Definition at line 374 of file htmlentity.cpp.
References g_htmlEntities, and Sym_Percent.
Referenced by HtmlDocVisitor::filter(), HtmlDocVisitor::operator()(), and TextDocVisitor::operator()().
|
static |
Returns the one and only instance of the HTML entity mapper.
Definition at line 340 of file htmlentity.cpp.
References HtmlEntityMapper().
Referenced by DocbookGenerator::convertToDocbook(), convertToJSString(), convertToXML(), DocSymbol::decodeSymbol(), HtmlDocVisitor::filter(), ManDocVisitor::filter(), RTFDocVisitor::filter(), filterLatexString(), generateSqlite3ForPage(), generateXML(), generateXMLForPage(), generateXMLForRequirement(), generateXMLForRequirements(), getSQLDocBlock(), DocbookDocVisitor::operator()(), HtmlDocVisitor::operator()(), LatexDocVisitor::operator()(), ManDocVisitor::operator()(), PerlModDocVisitor::operator()(), PrintDocVisitor::operator()(), RTFDocVisitor::operator()(), TextDocVisitor::operator()(), XmlDocVisitor::operator()(), and parseCommentAsText().
| const char * HtmlEntityMapper::latex | ( | HtmlEntityMapper::SymType | symb | ) | const |
Access routine to the LaTeX code of the HTML entity.
| symb | Code of the requested HTML entity |
nullptr is returned. Definition at line 414 of file htmlentity.cpp.
References g_htmlEntities.
Referenced by filterLatexString(), and LatexDocVisitor::operator()().
| const char * HtmlEntityMapper::man | ( | HtmlEntityMapper::SymType | symb | ) | const |
Access routine to the man code of the HTML entity.
| symb | Code of the requested HTML entity |
nullptr is returned. Definition at line 425 of file htmlentity.cpp.
References g_htmlEntities.
Referenced by ManDocVisitor::filter(), and ManDocVisitor::operator()().
| HtmlEntityMapper::SymType HtmlEntityMapper::name2sym | ( | const DString & | symName | ) | const |
Give code of the requested HTML entity name.
| symName | HTML entity name without & and ; |
Definition at line 459 of file htmlentity.cpp.
References m_name2sym, DString::str(), and Sym_Unknown.
Referenced by convertCharEntitiesToUTF8(), DocSymbol::decodeSymbol(), and writeHtmlEntity().
| const HtmlEntityMapper::PerlSymb * HtmlEntityMapper::perl | ( | HtmlEntityMapper::SymType | symb | ) | const |
Access routine to the perl struct with the perl code of the HTML entity.
| symb | Code of the requested HTML entity |
symb field and in the HtmlEntityMapper::Perl_unknown in the type field. Definition at line 448 of file htmlentity.cpp.
References g_htmlEntities.
Referenced by PerlModDocVisitor::operator()().
| const char * HtmlEntityMapper::rtf | ( | HtmlEntityMapper::SymType | symb | ) | const |
Access routine to the RTF code of the HTML entity.
| symb | Code of the requested HTML entity |
nullptr is returned. Definition at line 436 of file htmlentity.cpp.
References g_htmlEntities.
Referenced by RTFDocVisitor::filter(), and RTFDocVisitor::operator()().
| const char * HtmlEntityMapper::utf8 | ( | HtmlEntityMapper::SymType | symb, |
| bool | useInPrintf = false ) const |
Access routine to the UTF8 code of the HTML entity.
| symb | Code of the requested HTML entity |
| useInPrintf | If true the result will be escaped such that it can be used in a printf string pattern |
nullptr is returned. Definition at line 354 of file htmlentity.cpp.
References g_htmlEntities, and Sym_Percent.
Referenced by convertCharEntitiesToUTF8(), and PrintDocVisitor::operator()().
|
private |
Routine to check if the entries of the html_entities are numbered correctly.
in case of a mismatch a warning message is given.
Definition at line 481 of file htmlentity.cpp.
References g_htmlEntities, and warn_uncond.
Referenced by HtmlEntityMapper().
|
inline |
Writes an HTML entity for the current symbol and advances the input pointer.
| T | Type of the output sink used to write encoded output. |
| result | Output target receiving the encoded entity or fallback text. |
| s | Pointer to the start of a potential HTML entity in the input text. |
| mapper | Callback that maps a entity symbol type to its HTML entity string. |
| fallback | Fallback string written when no entity mapping is available. |
Definition at line 127 of file htmlentity.h.
References DString::DString(), name2sym(), and Sym_Unknown.
Referenced by DocbookGenerator::convertToDocbook(), convertToXML(), HtmlDocVisitor::filter(), ManDocVisitor::filter(), RTFDocVisitor::filter(), and filterLatexString().
| void HtmlEntityMapper::writeXMLSchema | ( | TextStream & | t | ) |
Definition at line 465 of file htmlentity.cpp.
References DString::at(), DString::empty(), DString::endsWith(), g_htmlEntities, DString::length(), and DString::mid().
Referenced by generateXML().
| const char * HtmlEntityMapper::xml | ( | HtmlEntityMapper::SymType | symb | ) | const |
Access routine to the XML code of the HTML entity.
| symb | Code of the requested HTML entity |
nullptr is returned. Definition at line 392 of file htmlentity.cpp.
References g_htmlEntities.
Referenced by convertToXML(), and XmlDocVisitor::operator()().
|
private |
Definition at line 157 of file htmlentity.h.
Referenced by HtmlEntityMapper(), and name2sym().
|
staticprivate |
Definition at line 156 of file htmlentity.h.