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

Constructor & Destructor Documentation

◆ DocHtmlDescList()

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

Definition at line 897 of file docnode.h.

897 :
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
const HtmlAttribList & attribs() const
Definition docnode.h:899
HtmlAttribList m_attribs
Definition docnode.h:903
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 899 of file docnode.h.

899{ return m_attribs; }

References m_attribs.

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

◆ parse()

Token DocHtmlDescList::parse ( )

Definition at line 2404 of file docnode.cpp.

2405{
2406 AUTO_TRACE();
2407 Token retval = Token::make_RetVal_OK();
2408 auto ns = AutoNodeStack(parser(),thisVariant());
2409
2410 // get next token
2411 Token tok=parser()->tokenizer.lex();
2412 // skip whitespace
2413 while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex();
2414 // should find a html tag now
2415 if (tok.is(TokenRetval::TK_HTMLTAG))
2416 {
2417 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
2418 if (tagId==HtmlTagType::HTML_DT && !parser()->context.token->endTag) // found <dt> tag
2419 {
2420 // continue
2421 }
2422 else // found some other tag
2423 {
2424 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but "
2425 "found <%s> instead!",qPrint(parser()->context.token->name));
2426 parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name);
2427 goto enddesclist;
2428 }
2429 }
2430 else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment
2431 {
2432 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking"
2433 " for a html description title");
2434 goto enddesclist;
2435 }
2436 else // token other than html token
2437 {
2438 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but found %s token instead!",
2439 tok.to_string());
2440 goto enddesclist;
2441 }
2442
2443 do
2444 {
2445 children().append<DocHtmlDescTitle>(parser(),thisVariant(),parser()->context.token->attribs);
2446 DocHtmlDescTitle *dt = children().get_last<DocHtmlDescTitle>();
2447 children().append<DocHtmlDescData>(parser(),thisVariant());
2448 DocHtmlDescData *dd = children().get_last<DocHtmlDescData>();
2449 retval=dt->parse();
2450 if (retval.is(TokenRetval::RetVal_DescData))
2451 {
2452 retval=dd->parse();
2453 while (retval.is(TokenRetval::RetVal_DescData))
2454 {
2455 children().append<DocHtmlDescData>(parser(),thisVariant());
2456 dd = children().get_last<DocHtmlDescData>();
2457 retval=dd->parse();
2458 }
2459 }
2460 else if (!retval.is(TokenRetval::RetVal_DescTitle))
2461 {
2462 // error
2463 break;
2464 }
2465 } while (retval.is(TokenRetval::RetVal_DescTitle));
2466
2467 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
2468 {
2469 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <dl> block");
2470 }
2471
2472enddesclist:
2473
2474 return retval.is(TokenRetval::RetVal_EndDesc) ? Token::make_RetVal_OK() : retval;
2475}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
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:74
const Mapper< HtmlTagType > * htmlTagMapper
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
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1404
TokenInfo * token
Definition docparser_p.h:92
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(), qPrint(), 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 903 of file docnode.h.

Referenced by attribs(), and DocHtmlDescList().


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