Doxygen
Loading...
Searching...
No Matches
DocText Class Reference

Root node of a text fragment. More...

#include <src/docnode.h>

+ Inheritance diagram for DocText:
+ Collaboration diagram for DocText:

Public Member Functions

 DocText (DocParser *parser)
 
void parse ()
 
bool isEmpty () const
 
- Public Member Functions inherited from DocCompoundNode
 DocCompoundNode (DocParser *parser, DocNodeVariant *parent)
 
DocNodeListchildren ()
 
const DocNodeListchildren () const
 
- Public Member Functions inherited from DocNode
 DocNode (DocParser *parser, DocNodeVariant *parent)
 
 ~DocNode ()=default
 
DocNodeVariantparent ()
 
const DocNodeVariantparent () const
 
DocNodeVariantthisVariant ()
 
const DocNodeVariantthisVariant () const
 
void setThisVariant (DocNodeVariant *thisVariant)
 
DocParserparser ()
 
const DocParserparser () const
 
void setParent (DocNodeVariant *parent)
 
bool isPreformatted () const
 

Additional Inherited Members

- Protected Types inherited from DocNode
enum  RefType { Unknown , Anchor , Section , Table }
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 

Detailed Description

Root node of a text fragment.

Definition at line 1297 of file docnode.h.

Constructor & Destructor Documentation

◆ DocText()

DocText::DocText ( DocParser * parser)
inline

Definition at line 1300 of file docnode.h.

1300: DocCompoundNode(parser,nullptr) {}
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
DocParser * parser()
Definition docnode.h:97

References DocCompoundNode::DocCompoundNode(), and DocNode::parser().

Member Function Documentation

◆ isEmpty()

bool DocText::isEmpty ( ) const
inline

Definition at line 1302 of file docnode.h.

1302{ return children().empty(); }
DocNodeList & children()
Definition docnode.h:142
bool empty() const
checks whether the container is empty
Definition growvector.h:140

References DocCompoundNode::children(), and GrowVector< T >::empty().

◆ parse()

void DocText::parse ( )

Definition at line 5934 of file docnode.cpp.

5935{
5936 AUTO_TRACE();
5937 auto ns = AutoNodeStack(parser(),thisVariant());
5939
5940 Token tok = parser()->tokenizer.lex();
5941 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) // get the next token
5942 {
5943 switch(tok.value())
5944 {
5945 case TokenRetval::TK_WORD:
5947 break;
5948 case TokenRetval::TK_WHITESPACE:
5949 children().append<DocWhiteSpace>(parser(),thisVariant(),parser()->context.token->chars);
5950 break;
5951 case TokenRetval::TK_SYMBOL:
5952 {
5953 HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name);
5955 {
5956 children().append<DocSymbol>(parser(),thisVariant(),s);
5957 }
5958 else
5959 {
5960 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '%s' found",
5961 qPrint(parser()->context.token->name));
5962 }
5963 }
5964 break;
5965 case TokenRetval::TK_COMMAND_AT:
5966 // fall through
5967 case TokenRetval::TK_COMMAND_BS:
5968 switch (Mappers::cmdMapper->map(parser()->context.token->name))
5969 {
5972 break;
5975 break;
5978 break;
5981 break;
5984 break;
5987 break;
5990 break;
5993 break;
5996 break;
6000 break;
6005 break;
6008 break;
6011 break;
6014 break;
6017 break;
6020 break;
6023 break;
6026 break;
6027 default:
6028 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command '%s' found",
6029 qPrint(parser()->context.token->name));
6030 break;
6031 }
6032 break;
6033 default:
6034 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s",
6035 tok.to_string());
6036 break;
6037 }
6038 tok = parser()->tokenizer.lex();
6039 }
6040
6042
6043}
DocNodeVariant * thisVariant()
Definition docnode.h:92
DocTokenizer tokenizer
DocParserContext context
void handleUnclosedStyleCommands()
static HtmlEntityMapper::SymType decodeSymbol(const QCString &symName)
Definition docnode.cpp:152
void setStateText()
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
TokenRetval value() const
bool is_any_of(ARGS... args) const
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
const Mapper< CommandType > * cmdMapper
const char * qPrint(const char *s)
Definition qcstring.h:672
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
Definition docnode.h:1393
TokenInfo * token
Definition docparser_p.h:92
QCString chars
QCString name

References DocNodeList::append(), AUTO_TRACE, TokenInfo::chars, DocCompoundNode::children(), CMD_AMP, CMD_AT, CMD_BSLASH, CMD_DCOLON, CMD_DOLLAR, CMD_EQUAL, CMD_EXCLAMATION, CMD_GREATER, CMD_HASH, CMD_LESS, CMD_MDASH, CMD_MINUS, CMD_NDASH, CMD_PERCENT, CMD_PLUS, CMD_PUNT, CMD_QUESTION, CMD_QUOTE, Mappers::cmdMapper, DocParser::context, DocSymbol::decodeSymbol(), DocParser::handleUnclosedStyleCommands(), Token::is_any_of(), DocTokenizer::lex(), TokenInfo::name, DocNode::parser(), qPrint(), DocTokenizer::setStateText(), HtmlEntityMapper::Sym_Amp, HtmlEntityMapper::Sym_At, HtmlEntityMapper::Sym_BSlash, HtmlEntityMapper::Sym_Dollar, HtmlEntityMapper::Sym_Dot, HtmlEntityMapper::Sym_DoubleColon, HtmlEntityMapper::Sym_Equal, HtmlEntityMapper::Sym_Exclam, HtmlEntityMapper::Sym_Greater, HtmlEntityMapper::Sym_Hash, HtmlEntityMapper::Sym_Less, HtmlEntityMapper::Sym_Minus, HtmlEntityMapper::Sym_Percent, HtmlEntityMapper::Sym_Plus, HtmlEntityMapper::Sym_Quest, HtmlEntityMapper::Sym_Quot, HtmlEntityMapper::Sym_Unknown, DocNode::thisVariant(), Token::to_string(), DocParserContext::token, DocParser::tokenizer, Token::value(), and warn_doc_error.


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