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

Node representing a Html description list. More...

#include <src/docnode.h>

Inheritance diagram for DocHtmlDescList:
Collaboration diagram for DocHtmlDescList:

Public Member Functions

 DocHtmlDescList (DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
const HtmlAttribListattribs () const
Token parse ()
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

Private Attributes

HtmlAttribList m_attribs

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

Node representing a Html description list.

Definition at line 900 of file docnode.h.

Constructor & Destructor Documentation

◆ DocHtmlDescList()

DocHtmlDescList::DocHtmlDescList ( DocParser * parser,
DocNodeVariant * parent,
const HtmlAttribList & attribs )
inline

Definition at line 903 of file docnode.h.

903 :
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:141
const HtmlAttribList & attribs() const
Definition docnode.h:905
HtmlAttribList m_attribs
Definition docnode.h:909
DocParser * parser()
Definition docnode.h:98
DocNodeVariant * parent()
Definition docnode.h:90

References attribs(), DocCompoundNode::DocCompoundNode(), m_attribs, DocNode::parent(), and DocNode::parser().

Member Function Documentation

◆ attribs()

const HtmlAttribList & DocHtmlDescList::attribs ( ) const
inline

Definition at line 905 of file docnode.h.

905{ return m_attribs; }

References m_attribs.

Referenced by classEqualsReflist(), DocHtmlDescList(), and HtmlDocVisitor::operator()().

◆ parse()

Token DocHtmlDescList::parse ( )

Definition at line 2572 of file docnode.cpp.

2573{
2574 AUTO_TRACE();
2575 Token retval = Token::make_RetVal_OK();
2576 auto ns = AutoNodeStack(parser(),thisVariant());
2577
2578 // get next token
2579 Token tok=parser()->tokenizer.lex();
2580 // skip whitespace
2581 while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex();
2582 // should find a html tag now
2583 if (tok.is(TokenRetval::TK_HTMLTAG))
2584 {
2585 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
2586 if (tagId==HtmlTagType::HTML_DT && !parser()->context.token->endTag) // found <dt> tag
2587 {
2588 // continue
2589 }
2590 else // found some other tag
2591 {
2592 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but "
2593 "found <{}> instead!",parser()->context.token->name);
2594 parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name);
2595 goto enddesclist;
2596 }
2597 }
2598 else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment
2599 {
2600 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking"
2601 " for a html description title");
2602 goto enddesclist;
2603 }
2604 else // token other than html token
2605 {
2606 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but found {} token instead!",
2607 tok.to_string());
2608 goto enddesclist;
2609 }
2610
2611 do
2612 {
2613 children().append<DocHtmlDescTitle>(parser(),thisVariant(),parser()->context.token->attribs);
2614 DocHtmlDescTitle *dt = children().get_last<DocHtmlDescTitle>();
2615 children().append<DocHtmlDescData>(parser(),thisVariant());
2616 DocHtmlDescData *dd = children().get_last<DocHtmlDescData>();
2617 retval=dt->parse();
2618 if (retval.is(TokenRetval::RetVal_DescData))
2619 {
2620 retval=dd->parse();
2621 while (retval.is(TokenRetval::RetVal_DescData))
2622 {
2623 children().append<DocHtmlDescData>(parser(),thisVariant());
2624 dd = children().get_last<DocHtmlDescData>();
2625 retval=dd->parse();
2626 }
2627 }
2628 else if (!retval.is(TokenRetval::RetVal_DescTitle))
2629 {
2630 // error
2631 break;
2632 }
2633 } while (retval.is(TokenRetval::RetVal_DescTitle));
2634
2635 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
2636 {
2637 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <dl> block");
2638 }
2639
2640enddesclist:
2641
2642 return retval.is(TokenRetval::RetVal_EndDesc) ? Token::make_RetVal_OK() : retval;
2643}
DocNodeList & children()
Definition docnode.h:143
DocNodeVariant * thisVariant()
Definition docnode.h:93
DocTokenizer tokenizer
DocParserContext context
void pushBackHtmlTag(const QCString &tag)
bool is(TokenRetval rv) const
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
bool is_any_of(ARGS... args) const
HtmlTagType
Definition cmdmapper.h:169
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
const Mapper< HtmlTagType > * htmlTagMapper
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
Definition docnode.h:1399
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1410
TokenInfo * token
Definition docparser_p.h:93
HtmlAttribList attribs

References DocNodeList::append(), TokenInfo::attribs, AUTO_TRACE, DocCompoundNode::children(), DocParser::context, DocNodeList::get_last(), HTML_DT, Mappers::htmlTagMapper, Token::is(), Token::is_any_of(), DocTokenizer::lex(), DocHtmlDescData::parse(), DocNode::parser(), DocTokenizer::pushBackHtmlTag(), DocNode::thisVariant(), Token::to_string(), DocParserContext::token, DocParser::tokenizer, and warn_doc_error.

Member Data Documentation

◆ m_attribs

HtmlAttribList DocHtmlDescList::m_attribs
private

Definition at line 909 of file docnode.h.

Referenced by attribs(), and DocHtmlDescList().


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