Skip to main content

The DocSimpleSect Class Reference

Node representing a simple section. More...

Declaration

class DocSimpleSect { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocCompoundNode

Base class for nodes with children. More...

Enumerations Index

enumType { ... }

Public Constructors Index

DocSimpleSect (DocParser *parser, DocNodeVariant *parent, Type t)

Public Member Functions Index

Typetype () const
QCStringtypeString () const
Tokenparse (bool userTitle, bool needsSeparator)
TokenparseRcs ()
TokenparseXml ()
voidappendLinkWord (const QCString &word)
boolhasTitle () const
const DocNodeVariant *title () const

Private Member Attributes Index

Typem_type = Unknown
std::unique_ptr< DocNodeVariant >m_title

Description

Node representing a simple section.

Definition at line 1016 of file docnode.h.

Enumerations

Type

enum DocSimpleSect::Type
Enumeration values
Unknown
See
Return
Author
Authors
Version
Since
Date
Note
Warning
Copyright
Pre
Post
Invar
Remark
Attention
Important
User
Rcs

Definition at line 1019 of file docnode.h.

Public Constructors

DocSimpleSect()

DocSimpleSect::DocSimpleSect (DocParser * parser, DocNodeVariant * parent, Type t)

Declaration at line 1025 of file docnode.h, definition at line 2999 of file docnode.cpp.

References DocCompoundNode::DocCompoundNode, m_type, DocNode::parent and DocNode::parser.

Public Member Functions

appendLinkWord()

void DocSimpleSect::appendLinkWord (const QCString & word)

Declaration at line 1031 of file docnode.h, definition at line 3099 of file docnode.cpp.

3100{
3101 DocPara *p=nullptr;
3102 if (children().empty() || (p=std::get_if<DocPara>(&children().back()))==nullptr)
3103 {
3105 p = children().get_last<DocPara>();
3106 }
3107 else
3108 {
3109 // Comma-separate <seealso> links.
3110 p->injectToken(Token::make_TK_WORD(),",");
3111 p->injectToken(Token::make_TK_WHITESPACE()," ");
3112 }
3113
3115 p->injectToken(Token::make_TK_LNKWORD(),word);
3117}

References DocNodeList::append, DocCompoundNode::children, DocParser::context, FALSE, DocNodeList::get_last, DocPara::injectToken, DocParserContext::inSeeBlock, DocNode::parser, DocNode::thisVariant and TRUE.

hasTitle()

bool DocSimpleSect::hasTitle ()

Declaration at line 1032 of file docnode.h, definition at line 3004 of file docnode.cpp.

3005{
3006 return m_title && std::get<DocTitle>(*m_title).hasTitle();
3007}

Reference m_title.

Referenced by DocbookDocVisitor::operator().

parse()

Token DocSimpleSect::parse (bool userTitle, bool needsSeparator)

Declaration at line 1028 of file docnode.h, definition at line 3009 of file docnode.cpp.

3009Token DocSimpleSect::parse(bool userTitle,bool needsSeparator)
3010{
3011 AUTO_TRACE();
3012 auto ns = AutoNodeStack(parser(),thisVariant());
3013
3014 // handle case for user defined title
3015 if (userTitle)
3016 {
3018 std::get_if<DocTitle>(m_title.get())->parse();
3019 }
3020
3021 // add new paragraph as child
3022 if (!children().empty() && std::holds_alternative<DocPara>(children().back()))
3023 {
3024 std::get<DocPara>(children().back()).markLast(FALSE);
3025 }
3026 bool markFirst = children().empty();
3027 if (needsSeparator)
3028 {
3030 }
3032 DocPara *par = children().get_last<DocPara>();
3033 if (markFirst)
3034 {
3035 par->markFirst();
3036 }
3037 par->markLast();
3038
3039 // parse the contents of the paragraph
3040 Token retval = par->parse();
3041
3042 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3043 return retval; // 0==EOF, TokenRetval::TK_NEWPARA, TokenRetval::TK_LISTITEM, TokenRetval::TK_ENDLIST, TokenRetval::RetVal_SimpleSec
3044}

References DocNodeList::append, AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children, createDocNode, GrowVector< T >::empty, FALSE, DocNodeList::get_last, m_title, DocPara::markLast, DocNode::parser, DocNode::thisVariant and Token::to_string.

Referenced by DocPara::handleSimpleSection.

parseRcs()

Token DocSimpleSect::parseRcs ()

Declaration at line 1029 of file docnode.h, definition at line 3046 of file docnode.cpp.

3047{
3048 AUTO_TRACE();
3049 auto ns = AutoNodeStack(parser(),thisVariant());
3050
3052 DocTitle *title = &std::get<DocTitle>(*m_title);
3053 title->parseFromString(thisVariant(),parser()->context.token->name);
3054
3055 QCString text = parser()->context.token->text;
3056 parser()->pushContext(); // this will create a new parser->context.token
3058 parser()->popContext(); // this will restore the old parser->context.token
3059
3060 return Token::make_RetVal_OK();
3061}

References AUTO_TRACE, DocCompoundNode::children, DocParser::context, createDocNode, DocParser::internalValidatingParseDoc, m_title, DocNode::parser, DocParser::popContext, DocParser::pushContext, TokenInfo::text, DocNode::thisVariant, title and DocParserContext::token.

parseXml()

Token DocSimpleSect::parseXml ()

Declaration at line 1030 of file docnode.h, definition at line 3063 of file docnode.cpp.

3064{
3065 AUTO_TRACE();
3066 auto ns = AutoNodeStack(parser(),thisVariant());
3067
3068 Token retval = Token::make_RetVal_OK();
3069 for (;;)
3070 {
3071 // add new paragraph as child
3072 if (!children().empty() && std::holds_alternative<DocPara>(children().back()))
3073 {
3074 std::get<DocPara>(children().back()).markLast(false);
3075 }
3076 bool markFirst = children().empty();
3078 DocPara *par = children().get_last<DocPara>();
3079 if (markFirst)
3080 {
3081 par->markFirst();
3082 }
3083 par->markLast();
3084
3085 // parse the contents of the paragraph
3086 retval = par->parse();
3087 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break;
3088 if (retval.is(TokenRetval::RetVal_CloseXml))
3089 {
3090 retval = Token::make_RetVal_OK();
3091 break;
3092 }
3093 }
3094
3095 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3096 return retval;
3097}

References DocNodeList::append, AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children, GrowVector< T >::empty, DocNodeList::get_last, Token::is, Token::is_any_of, DocPara::markLast, DocNode::parser, DocNode::thisVariant and Token::to_string.

Referenced by DocPara::handleSimpleSection.

title()

type()

typeString()

QCString DocSimpleSect::typeString ()

Declaration at line 1027 of file docnode.h, definition at line 3119 of file docnode.cpp.

3120{
3121 switch (m_type)
3122 {
3123 case Unknown: break;
3124 case See: return "see";
3125 case Return: return "return";
3126 case Author: // fall through
3127 case Authors: return "author";
3128 case Version: return "version";
3129 case Since: return "since";
3130 case Date: return "date";
3131 case Note: return "note";
3132 case Warning: return "warning";
3133 case Pre: return "pre";
3134 case Post: return "post";
3135 case Copyright: return "copyright";
3136 case Invar: return "invariant";
3137 case Remark: return "remark";
3138 case Attention: return "attention";
3139 case Important: return "important";
3140 case User: return "user";
3141 case Rcs: return "rcs";
3142 }
3143 return "unknown";
3144}

References Attention, Author, Authors, Copyright, Date, Important, Invar, m_type, Note, Post, Pre, Rcs, Remark, Return, See, Since, Unknown, User, Version and Warning.

Referenced by HtmlDocVisitor::operator().

Private Member Attributes

m_title

std::unique_ptr<DocNodeVariant> DocSimpleSect::m_title

Definition at line 1037 of file docnode.h.

1037 std::unique_ptr<DocNodeVariant> m_title;

Referenced by hasTitle, parse, parseRcs and title.

m_type

Type DocSimpleSect::m_type = Unknown

Definition at line 1036 of file docnode.h.

Referenced by DocSimpleSect, type and typeString.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.