Skip to main content

The DocRoot Class Reference

Root node of documentation tree. More...

Declaration

class DocRoot { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocCompoundNode

Base class for nodes with children. More...

Public Constructors Index

DocRoot (DocParser *parser, bool indent, bool sl)

Public Member Functions Index

voidparse ()
boolindent () const
boolsingleLine () const
boolisEmpty () const

Private Member Attributes Index

boolm_indent = false
boolm_singleLine = false

Description

Root node of documentation tree.

Definition at line 1312 of file docnode.h.

Public Constructors

DocRoot()

DocRoot::DocRoot (DocParser * parser, bool indent, bool sl)
inline

Definition at line 1315 of file docnode.h.

References DocCompoundNode::DocCompoundNode, indent, m_indent, m_singleLine and DocNode::parser.

Public Member Functions

indent()

bool DocRoot::indent ()
inline

Definition at line 1318 of file docnode.h.

1318 bool indent() const { return m_indent; }

Reference m_indent.

Referenced by DocRoot and RTFDocVisitor::operator().

isEmpty()

bool DocRoot::isEmpty ()
inline

Definition at line 1320 of file docnode.h.

1320 bool isEmpty() const { return children().empty(); }

References DocCompoundNode::children and GrowVector< T >::empty.

parse()

void DocRoot::parse ()

Declaration at line 1317 of file docnode.h, definition at line 6239 of file docnode.cpp.

6240{
6241 AUTO_TRACE();
6242 auto ns = AutoNodeStack(parser(),thisVariant());
6244 Token retval = Token::make_TK_NONE();
6245
6246 // first parse any number of paragraphs
6247 bool isFirst=TRUE;
6248 DocPara *lastPar = nullptr;
6249 do
6250 {
6251 {
6253 DocPara *par = children().get_last<DocPara>();
6254 if (isFirst) { par->markFirst(); isFirst=FALSE; }
6255 retval=par->parse();
6256 if (par->isEmpty() && par->attribs().empty())
6257 {
6258 children().pop_back();
6259 }
6260 else
6261 {
6262 lastPar = par;
6263 }
6264 }
6265 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6266 if (retval == t)
6267 {
6268 if (!AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str()))
6269 {
6270 warn_doc_error(parser()->context.fileName,
6271 parser()->tokenizer.getLineNr(),
6272 "found {} command (id: '{}') outside of {} context!",
6273 sectionType,parser()->context.token->sectionId,parentSectionType);
6274 }
6275 while (retval==t)
6276 {
6277 if (!parser()->context.token->sectionId.isEmpty())
6278 {
6279 const SectionInfo *sec=SectionManager::instance().find(parser()->context.token->sectionId);
6280 if (sec)
6281 {
6283 level,
6285 retval = children().get_last<DocSection>()->parse();
6286 }
6287 else
6288 {
6289 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid {} id '{}'; ignoring {}",
6290 sectionType,parser()->context.token->sectionId,sectionType);
6291 retval = Token::make_TK_NONE();
6292 }
6293 }
6294 else
6295 {
6296 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing id for {}; ignoring {}",sectionType,sectionType);
6297 retval = Token::make_TK_NONE();
6298 }
6299 }
6300 }
6301 };
6302 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6303 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6304 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6305 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6306 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6307
6308 if (retval.is(TokenRetval::TK_LISTITEM))
6309 {
6310 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found");
6311 }
6312 if (retval.is(TokenRetval::RetVal_Internal))
6313 {
6315 retval = children().get_last<DocInternal>()->parse(1);
6316 }
6317 } while (!retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6318 if (lastPar) lastPar->markLast();
6319
6320 //printf("DocRoot::parse() retval=%d %d\n",retval,TokenRetval::RetVal_Section);
6321 // then parse any number of level1 sections
6322 while (retval.is(TokenRetval::RetVal_Section))
6323 {
6324 if (!parser()->context.token->sectionId.isEmpty())
6325 {
6326 const SectionInfo *sec=SectionManager::instance().find(parser()->context.token->sectionId);
6327 if (sec)
6328 {
6330 1,
6332 retval = children().get_last<DocSection>()->parse();
6333 }
6334 else
6335 {
6336 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid section id '{}'; ignoring section",parser()->context.token->sectionId);
6337 retval = Token::make_TK_NONE();
6338 }
6339 }
6340 else
6341 {
6342 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing id for section; ignoring section");
6343 retval = Token::make_TK_NONE();
6344 }
6345 }
6346
6348}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocParser::context, FALSE, LinkedMap< T, Hash, KeyEqual, Map >::find, DocNodeList::get_last, DocParser::handleUnclosedStyleCommands, AnchorGenerator::instance, SectionManager::instance, Token::is, Token::is_any_of, DocPara::markLast, parse, DocNode::parser, GrowVector< T >::pop_back, TokenInfo::sectionId, DocTokenizer::setStatePara, DocNode::thisVariant, DocParserContext::token, DocParser::tokenizer, TRUE and warn_doc_error.

Referenced by parse.

singleLine()

bool DocRoot::singleLine ()
inline

Definition at line 1319 of file docnode.h.

1319 bool singleLine() const { return m_singleLine; }

Reference m_singleLine.

Referenced by RTFDocVisitor::operator().

Private Member Attributes

m_indent

bool DocRoot::m_indent = false

Definition at line 1323 of file docnode.h.

1323 bool m_indent = false;

Referenced by DocRoot and indent.

m_singleLine

bool DocRoot::m_singleLine = false

Definition at line 1324 of file docnode.h.

1324 bool m_singleLine = false;

Referenced by DocRoot and singleLine.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.