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

Node representing an internal section of documentation. More...

#include <src/docnode.h>

+ Inheritance diagram for DocInternal:
+ Collaboration diagram for DocInternal:

Public Member Functions

 DocInternal (DocParser *parser, DocNodeVariant *parent)
 
Token parse (int)
 
- 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

Node representing an internal section of documentation.

Definition at line 948 of file docnode.h.

Constructor & Destructor Documentation

◆ DocInternal()

DocInternal::DocInternal ( DocParser * parser,
DocNodeVariant * parent )
inline

Definition at line 951 of file docnode.h.

DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89

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

Member Function Documentation

◆ parse()

Token DocInternal::parse ( int level)

Definition at line 1500 of file docnode.cpp.

1501{
1502 AUTO_TRACE();
1503 Token retval(TokenRetval::RetVal_OK);
1504 auto ns = AutoNodeStack(parser(),thisVariant());
1505
1506 // first parse any number of paragraphs
1507 bool isFirst=TRUE;
1508 DocPara *lastPar=nullptr;
1509 do
1510 {
1511 children().append<DocPara>(parser(),thisVariant());
1512 DocPara *par = children().get_last<DocPara>();
1513 if (isFirst) { par->markFirst(); isFirst=FALSE; }
1514 retval=par->parse();
1515 if (!par->isEmpty())
1516 {
1517 if (lastPar) lastPar->markLast(FALSE);
1518 lastPar=par;
1519 }
1520 else
1521 {
1522 children().pop_back();
1523 }
1524 if (retval.is(TokenRetval::TK_LISTITEM))
1525 {
1526 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found");
1527 }
1528 } while (!retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF,
1529 TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection,
1530 TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph, TokenRetval::RetVal_SubSubParagraph,
1531 TokenRetval::RetVal_EndInternal));
1532 if (lastPar) lastPar->markLast();
1533
1534 // then parse any number of level-n sections
1535 while ((level==1 && retval.is(TokenRetval::RetVal_Section)) ||
1536 (level==2 && retval.is(TokenRetval::RetVal_Subsection)) ||
1537 (level==3 && retval.is(TokenRetval::RetVal_Subsubsection)) ||
1538 (level==4 && retval.is(TokenRetval::RetVal_Paragraph)) ||
1539 (level==5 && retval.is(TokenRetval::RetVal_SubParagraph)) ||
1540 (level==6 && retval.is(TokenRetval::RetVal_SubSubParagraph))
1541 )
1542 {
1543 children().append<DocSection>(parser(),thisVariant(),
1544 level,
1546 retval = children().get_last<DocSection>()->parse();
1547 }
1548
1549 if (retval.is(TokenRetval::RetVal_Internal))
1550 {
1551 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"\\internal command found inside internal section");
1552 }
1553
1554 AUTO_TRACE_EXIT("retval={}",retval.to_string());
1555 return retval;
1556}
DocNodeList & children()
Definition docnode.h:142
Token parse(int)
Definition docnode.cpp:1500
DocNodeVariant * thisVariant()
Definition docnode.h:92
void markLast(bool v=TRUE)
Definition docnode.h:1066
DocParserContext context
void pop_back()
removes the last element
Definition growvector.h:115
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:48
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
Definition docnode.h:1379
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1390
TokenInfo * token
Definition docparser_p.h:92
QCString sectionId

References DocNodeList::append(), AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children(), DocParser::context, FALSE, DocNodeList::get_last(), Token::is(), Token::is_any_of(), DocPara::markLast(), parse(), DocNode::parser(), GrowVector< T >::pop_back(), TokenInfo::sectionId, DocNode::thisVariant(), Token::to_string(), DocParserContext::token, TRUE, and warn_doc_error.

Referenced by parse().


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