Skip to main content

The DocSection Class Reference

Node representing a normal section. More...

Declaration

class DocSection { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocCompoundNode

Base class for nodes with children. More...

Public Constructors Index

DocSection (DocParser *parser, DocNodeVariant *parent, int level, const QCString &id)

Public Member Functions Index

intlevel () const
const DocNodeVariant *title () const
QCStringanchor () const
QCStringid () const
QCStringfile () const
Tokenparse ()

Private Member Attributes Index

intm_level = 0
QCStringm_id
std::unique_ptr< DocNodeVariant >m_title
QCStringm_anchor
QCStringm_file

Description

Node representing a normal section.

Definition at line 913 of file docnode.h.

Public Constructors

DocSection()

DocSection::DocSection (DocParser * parser, DocNodeVariant * parent, int level, const QCString & id)
inline

Public Member Functions

anchor()

QCString DocSection::anchor ()
inline

file()

QCString DocSection::file ()
inline

Definition at line 922 of file docnode.h.

922 QCString file() const { return m_file; }

Reference m_file.

Referenced by DocbookDocVisitor::operator(), LatexDocVisitor::operator(), RTFDocVisitor::operator() and XmlDocVisitor::operator().

id()

QCString DocSection::id ()
inline

Definition at line 921 of file docnode.h.

921 QCString id() const { return m_id; }

Reference m_id.

Referenced by DocSection.

level()

parse()

Token DocSection::parse ()

Declaration at line 923 of file docnode.h, definition at line 5955 of file docnode.cpp.

5956{
5957 AUTO_TRACE("start {} level={}", parser()->context.token->sectionId, m_level);
5958 Token retval = Token::make_RetVal_OK();
5959 auto ns = AutoNodeStack(parser(),thisVariant());
5960
5961 if (!m_id.isEmpty())
5962 {
5964 if (sec)
5965 {
5966 m_file = sec->fileName();
5967 m_anchor = sec->label();
5968 QCString titleStr = sec->title();
5969 if (titleStr.isEmpty()) titleStr = sec->label();
5971 DocTitle *title = &std::get<DocTitle>(*m_title);
5972 title->parseFromString(thisVariant(),titleStr);
5973 }
5974 }
5975
5976 // first parse any number of paragraphs
5977 bool isFirst=TRUE;
5978 DocPara *lastPar=nullptr;
5979 do
5980 {
5982 DocPara *par = children().get_last<DocPara>();
5983 if (isFirst) { par->markFirst(); isFirst=FALSE; }
5984 retval=par->parse();
5985 if (!par->isEmpty())
5986 {
5987 if (lastPar) lastPar->markLast(FALSE);
5988 lastPar = par;
5989 }
5990 else
5991 {
5992 children().pop_back();
5993 }
5994 if (retval.is(TokenRetval::TK_LISTITEM))
5995 {
5996 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found");
5997 }
5998 if (retval.is(TokenRetval::RetVal_Internal))
5999 {
6001 retval = children().get_last<DocInternal>()->parse(m_level+1);
6002 if (retval.is(TokenRetval::RetVal_EndInternal))
6003 {
6004 retval = Token::make_RetVal_OK();
6005 }
6006 }
6007 } while (!retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF, TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection,
6008 TokenRetval::RetVal_Subsubsection, TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph,
6009 TokenRetval::RetVal_SubSubParagraph, TokenRetval::RetVal_EndInternal)
6010 );
6011
6012 if (lastPar) lastPar->markLast();
6013
6014 while (true)
6015 {
6016 if (retval.is(TokenRetval::RetVal_Subsection) && m_level<=1)
6017 {
6018 // then parse any number of nested sections
6019 while (retval.is(TokenRetval::RetVal_Subsection)) // more sections follow
6020 {
6022 2,
6024 retval = children().get_last<DocSection>()->parse();
6025 }
6026 break;
6027 }
6028 else if (retval.is(TokenRetval::RetVal_Subsubsection) && m_level<=2)
6029 {
6030 if ((m_level <= 1) &&
6031 !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str()))
6032 {
6033 warn_doc_error(parser()->context.fileName,
6034 parser()->tokenizer.getLineNr(),
6035 "Unexpected subsubsection command found inside {}!",
6037 }
6038 // then parse any number of nested sections
6039 while (retval.is(TokenRetval::RetVal_Subsubsection)) // more sections follow
6040 {
6042 3,
6044 retval = children().get_last<DocSection>()->parse();
6045 }
6046 if (!(m_level < 2 && retval.is(TokenRetval::RetVal_Subsection))) break;
6047 }
6048 else if (retval.is(TokenRetval::RetVal_Paragraph) && m_level<=3)
6049 {
6050 if ((m_level <= 2) &&
6051 !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str()))
6052 {
6053 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
6054 "Unexpected paragraph command found inside {}!",
6056 }
6057 // then parse any number of nested sections
6058 while (retval.is(TokenRetval::RetVal_Paragraph)) // more sections follow
6059 {
6061 4,
6063 retval = children().get_last<DocSection>()->parse();
6064 }
6065 if (!(m_level<3 && (retval.is_any_of(TokenRetval::RetVal_Subsection,TokenRetval::RetVal_Subsubsection)))) break;
6066 }
6067 else if (retval.is(TokenRetval::RetVal_SubParagraph) && m_level<=4)
6068 {
6069 if ((m_level <= 3) &&
6070 !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str()))
6071 {
6072 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
6073 "Unexpected subparagraph command found inside {}!",
6075 }
6076 // then parse any number of nested sections
6077 while (retval.is(TokenRetval::RetVal_SubParagraph)) // more sections follow
6078 {
6080 5,
6082 retval = children().get_last<DocSection>()->parse();
6083 }
6084 if (!(m_level<4 && (retval.is_any_of(TokenRetval::RetVal_Subsection,TokenRetval::RetVal_Subsubsection,TokenRetval::RetVal_Paragraph)))) break;
6085 }
6086 else if (retval.is(TokenRetval::RetVal_SubSubParagraph) && m_level<=5)
6087 {
6088 if ((m_level <= 4) &&
6089 !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str()))
6090 {
6091 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
6092 "Unexpected subsubparagraph command found inside {}!",
6094 }
6095 // then parse any number of nested sections
6096 while (retval.is(TokenRetval::RetVal_SubSubParagraph)) // more sections follow
6097 {
6099 6,
6101 retval = children().get_last<DocSection>()->parse();
6102 }
6103 if (!(m_level<5 && (retval.is_any_of( TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection,
6104 TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph)))) break;
6105 }
6106 else
6107 {
6108 break;
6109 }
6110 }
6111
6112 INTERNAL_ASSERT(retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF,
6113 TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection,
6114 TokenRetval::RetVal_Subsubsection, TokenRetval::RetVal_Paragraph,
6115 TokenRetval::RetVal_SubParagraph, TokenRetval::RetVal_SubSubParagraph,
6116 TokenRetval::RetVal_Internal, TokenRetval::RetVal_EndInternal)
6117 );
6118
6119 AUTO_TRACE_EXIT("retval={}", retval.to_string());
6120 return retval;
6121}

References DocNodeList::append, AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children, DocParser::context, createDocNode, DocSection, FALSE, SectionInfo::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find, g_sectionLevelToName, DocNodeList::get_last, AnchorGenerator::instance, SectionManager::instance, INTERNAL_ASSERT, Token::is, Token::is_any_of, QCString::isEmpty, SectionInfo::label, m_anchor, m_file, m_id, m_level, m_title, DocPara::markLast, parse, DocNode::parser, GrowVector< T >::pop_back, TokenInfo::sectionId, DocNode::thisVariant, title, SectionInfo::title, Token::to_string, DocParserContext::token, TRUE and warn_doc_error.

Referenced by parse.

title()

Private Member Attributes

m_anchor

QCString DocSection::m_anchor

Definition at line 929 of file docnode.h.

Referenced by anchor and parse.

m_file

QCString DocSection::m_file

Definition at line 930 of file docnode.h.

Referenced by file and parse.

m_id

QCString DocSection::m_id

Definition at line 927 of file docnode.h.

Referenced by DocSection, id and parse.

m_level

int DocSection::m_level = 0

Definition at line 926 of file docnode.h.

926 int m_level = 0;

Referenced by DocSection, level and parse.

m_title

std::unique_ptr<DocNodeVariant> DocSection::m_title

Definition at line 928 of file docnode.h.

928 std::unique_ptr<DocNodeVariant> m_title;

Referenced by parse and title.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.