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

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 HtmlAttribList & attribs () const
Token parse ()
Public Member Functions inherited from DocCompoundNode
 DocCompoundNode (DocParser *parser, DocNodeVariant *parent)
DocNodeList & children ()
const DocNodeList & children () const
Public Member Functions inherited from DocNode
 DocNode (DocParser *parser, DocNodeVariant *parent)
 ~DocNode ()=default
DocNodeVariant * parent ()
const DocNodeVariant * parent () const
DocNodeVariant * thisVariant ()
const DocNodeVariant * thisVariant () const
void setThisVariant (DocNodeVariant *thisVariant)
DocParser * parser ()
const DocParser * parser () 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 ,
  Requirement
}
Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)

Detailed Description

Node representing a Html description list.

Definition at line 909 of file docnode.h.

Constructor & Destructor Documentation

◆ DocHtmlDescList()

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

Definition at line 912 of file docnode.h.

912 :
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:141
const HtmlAttribList & attribs() const
Definition docnode.h:914
HtmlAttribList m_attribs
Definition docnode.h:918
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89

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

Member Function Documentation

◆ attribs()

const HtmlAttribList & DocHtmlDescList::attribs ( ) const
inline

Definition at line 914 of file docnode.h.

914{ return m_attribs; }

References m_attribs.

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

◆ parse()

Token DocHtmlDescList::parse ( )

Definition at line 2749 of file docnode.cpp.

2750{
2751 AUTO_TRACE();
2752 Token retval = Token::make_RetVal_OK();
2753 auto ns = AutoNodeStack(parser(),thisVariant());
2754
2755 // get next token
2756 Token tok=parser()->tokenizer.lex();
2757 // skip whitespace
2758 while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex();
2759 // should find a html tag now
2760 if (tok.is(TokenRetval::TK_HTMLTAG))
2761 {
2762 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
2763 if (tagId==HtmlTagType::HTML_DT && !parser()->context.token->endTag) // found <dt> tag
2764 {
2765 // continue
2766 }
2767 else // found some other tag
2768 {
2769 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but "
2770 "found <{}> instead!",parser()->context.token->name);
2771 parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name);
2772 goto enddesclist;
2773 }
2774 }
2775 else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment
2776 {
2777 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking"
2778 " for a html description title");
2779 goto enddesclist;
2780 }
2781 else // token other than html token
2782 {
2783 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but found {} token instead!",
2784 tok.to_string());
2785 goto enddesclist;
2786 }
2787
2788 do
2789 {
2790 children().append<DocHtmlDescTitle>(parser(),thisVariant(),parser()->context.token->attribs);
2791 DocHtmlDescTitle *dt = children().get_last<DocHtmlDescTitle>();
2792 children().append<DocHtmlDescData>(parser(),thisVariant());
2793 DocHtmlDescData *dd = children().get_last<DocHtmlDescData>();
2794 retval=dt->parse();
2795 if (retval.is(TokenRetval::RetVal_DescData))
2796 {
2797 retval=dd->parse();
2798 while (retval.is(TokenRetval::RetVal_DescData))
2799 {
2800 children().append<DocHtmlDescData>(parser(),thisVariant());
2801 dd = children().get_last<DocHtmlDescData>();
2802 retval=dd->parse();
2803 }
2804 }
2805 else if (!retval.is(TokenRetval::RetVal_DescTitle))
2806 {
2807 // error
2808 break;
2809 }
2810 } while (retval.is(TokenRetval::RetVal_DescTitle));
2811
2812 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
2813 {
2814 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <dl> block");
2815 }
2816
2817enddesclist:
2818
2819 return retval.is(TokenRetval::RetVal_EndDesc) ? Token::make_RetVal_OK() : retval;
2820}
DocNodeList & children()
Definition docnode.h:143
DocNodeVariant * thisVariant()
Definition docnode.h:92
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
Definition docnode.h:1404
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1415
DocTokenizer tokenizer
DocParserContext context
void pushBackHtmlTag(const DString &tag)
bool is(TokenRetval rv) const
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
bool is_any_of(ARGS... args) const
HtmlAttribList attribs
HtmlTagType
Definition cmdmapper.h:174
#define AUTO_TRACE(...)
Definition docnode.cpp:53
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
const Mapper< HtmlTagType > * htmlTagMapper
TokenInfo * token
Definition docparser_p.h:94

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 918 of file docnode.h.

Referenced by attribs(), and DocHtmlDescList().


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