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 5942 of file docnode.cpp.

5943{
5944 AUTO_TRACE();
5945 auto ns = AutoNodeStack(parser(),thisVariant());
5947
5948 Token tok = parser()->tokenizer.lex();
5949 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) // get the next token
5950 {
5951 switch(tok.value())
5952 {
5953 case TokenRetval::TK_WORD:
5955 break;
5956 case TokenRetval::TK_WHITESPACE:
5957 children().append<DocWhiteSpace>(parser(),thisVariant(),parser()->context.token->chars);
5958 break;
5959 case TokenRetval::TK_SYMBOL:
5960 {
5961 HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name);
5963 {
5964 children().append<DocSymbol>(parser(),thisVariant(),s);
5965 }
5966 else
5967 {
5968 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '{}' found",
5969 parser()->context.token->name);
5970 }
5971 }
5972 break;
5973 case TokenRetval::TK_COMMAND_AT:
5974 // fall through
5975 case TokenRetval::TK_COMMAND_BS:
5976 switch (Mappers::cmdMapper->map(parser()->context.token->name))
5977 {
5980 break;
5983 break;
5986 break;
5989 break;
5992 break;
5995 break;
5998 break;
6001 break;
6004 break;
6008 break;
6013 break;
6016 break;
6019 break;
6022 break;
6025 break;
6028 break;
6031 break;
6034 break;
6035 default:
6036 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command '{}' found",
6037 parser()->context.token->name);
6038 break;
6039 }
6040 break;
6041 default:
6042 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token {}",
6043 tok.to_string());
6044 break;
6045 }
6046 tok = parser()->tokenizer.lex();
6047 }
6048
6050
6051}
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:112
const Mapper< CommandType > * cmdMapper
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(), 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: