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

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)
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

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 an internal section of documentation.

Definition at line 977 of file docnode.h.

Constructor & Destructor Documentation

◆ DocInternal()

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

Definition at line 980 of file docnode.h.

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

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

Member Function Documentation

◆ parse()

Token DocInternal::parse ( int level)

Definition at line 1640 of file docnode.cpp.

1641{
1642 AUTO_TRACE();
1643 Token retval(TokenRetval::RetVal_OK);
1644 auto ns = AutoNodeStack(parser(),thisVariant());
1645
1646 // first parse any number of paragraphs
1647 bool isFirst=true;
1648 DocPara *lastPar=nullptr;
1649 do
1650 {
1651 children().append<DocPara>(parser(),thisVariant());
1652 DocPara *par = children().get_last<DocPara>();
1653 if (isFirst) { par->markFirst(); isFirst=false; }
1654 retval=par->parse();
1655 if (!par->empty())
1656 {
1657 if (lastPar) lastPar->markLast(false);
1658 lastPar=par;
1659 }
1660 else
1661 {
1662 children().pop_back();
1663 }
1664 if (retval.is(TokenRetval::TK_LISTITEM))
1665 {
1666 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found");
1667 }
1668 } while (!retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF,
1669 TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection,
1670 TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph, TokenRetval::RetVal_SubSubParagraph,
1671 TokenRetval::RetVal_EndInternal));
1672 if (lastPar) lastPar->markLast();
1673
1674 // then parse any number of level-n sections
1675 while ((level==1 && retval.is(TokenRetval::RetVal_Section)) ||
1676 (level==2 && retval.is(TokenRetval::RetVal_Subsection)) ||
1677 (level==3 && retval.is(TokenRetval::RetVal_Subsubsection)) ||
1678 (level==4 && retval.is(TokenRetval::RetVal_Paragraph)) ||
1679 (level==5 && retval.is(TokenRetval::RetVal_SubParagraph)) ||
1680 (level==6 && retval.is(TokenRetval::RetVal_SubSubParagraph))
1681 )
1682 {
1683 children().append<DocSection>(parser(),thisVariant(),
1684 level,
1686 retval = children().get_last<DocSection>()->parse();
1687 }
1688
1689 if (retval.is(TokenRetval::RetVal_Internal))
1690 {
1691 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"\\internal command found inside internal section");
1692 }
1693
1694 AUTO_TRACE_EXIT("retval={}",retval.to_string());
1695 return retval;
1696}
DocNodeList & children()
Definition docnode.h:143
Token parse(int)
Definition docnode.cpp:1640
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
void markLast(bool v=true)
Definition docnode.h:1095
DocParserContext context
void pop_back()
removes the last element
Definition growvector.h:115
DString sectionId
#define AUTO_TRACE(...)
Definition docnode.cpp:53
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:55
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
TokenInfo * token
Definition docparser_p.h:94

References DocNodeList::append(), AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children(), DocParser::context, 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, and warn_doc_error.

Referenced by parse().


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