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

Node representing a simple section. More...

#include <src/docnode.h>

Inheritance diagram for DocSimpleSect:
Collaboration diagram for DocSimpleSect:

Public Types

enum  Type {
  Unknown , See , Return , Author ,
  Authors , Version , Since , Date ,
  Note , Warning , Copyright , Pre ,
  Post , Invar , Remark , Attention ,
  Important , User , Rcs
}

Public Member Functions

 DocSimpleSect (DocParser *parser, DocNodeVariant *parent, Type t)
Type type () const
QCString typeString () const
Token parse (bool userTitle, bool needsSeparator)
Token parseRcs ()
Token parseXml ()
void appendLinkWord (const QCString &word)
bool hasTitle () const
const DocNodeVarianttitle () const
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

Private Attributes

Type m_type = Unknown
std::unique_ptr< DocNodeVariantm_title

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 a simple section.

Definition at line 1025 of file docnode.h.

Member Enumeration Documentation

◆ Type

Enumerator
Unknown 
See 
Return 
Author 
Authors 
Version 
Since 
Date 
Note 
Warning 
Copyright 
Pre 
Post 
Invar 
Remark 
Attention 
Important 
User 
Rcs 

Definition at line 1028 of file docnode.h.

Constructor & Destructor Documentation

◆ DocSimpleSect()

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

Definition at line 3139 of file docnode.cpp.

3139 :
3141{
3142}
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:141
DocParser * parser()
Definition docnode.h:98
DocNodeVariant * parent()
Definition docnode.h:90

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

Member Function Documentation

◆ appendLinkWord()

void DocSimpleSect::appendLinkWord ( const QCString & word)

Definition at line 3239 of file docnode.cpp.

3240{
3241 DocPara *p=nullptr;
3242 if (children().empty() || (p=std::get_if<DocPara>(&children().back()))==nullptr)
3243 {
3244 children().append<DocPara>(parser(),thisVariant());
3245 p = children().get_last<DocPara>();
3246 }
3247 else
3248 {
3249 // Comma-separate <seealso> links.
3250 p->injectToken(Token::make_TK_WORD(),",");
3251 p->injectToken(Token::make_TK_WHITESPACE()," ");
3252 }
3253
3255 p->injectToken(Token::make_TK_LNKWORD(),word);
3257}
DocNodeList & children()
Definition docnode.h:143
DocNodeVariant * thisVariant()
Definition docnode.h:93
bool injectToken(Token tok, const QCString &tokText)
Definition docnode.cpp:4047
DocParserContext context
#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: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

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

Definition at line 3144 of file docnode.cpp.

3145{
3146 return m_title && std::get<DocTitle>(*m_title).hasTitle();
3147}
std::unique_ptr< DocNodeVariant > m_title
Definition docnode.h:1046

References m_title.

Referenced by DocbookDocVisitor::operator()().

◆ parse()

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

Definition at line 3149 of file docnode.cpp.

3150{
3151 AUTO_TRACE();
3152 auto ns = AutoNodeStack(parser(),thisVariant());
3153
3154 // handle case for user defined title
3155 if (userTitle)
3156 {
3158 std::get_if<DocTitle>(m_title.get())->parse();
3159 }
3160
3161 // add new paragraph as child
3162 if (!children().empty() && std::holds_alternative<DocPara>(children().back()))
3163 {
3164 std::get<DocPara>(children().back()).markLast(FALSE);
3165 }
3166 bool markFirst = children().empty();
3167 if (needsSeparator)
3168 {
3169 children().append<DocSimpleSectSep>(parser(),thisVariant());
3170 }
3171 children().append<DocPara>(parser(),thisVariant());
3172 DocPara *par = children().get_last<DocPara>();
3173 if (markFirst)
3174 {
3175 par->markFirst();
3176 }
3177 par->markLast();
3178
3179 // parse the contents of the paragraph
3180 Token retval = par->parse();
3181
3182 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3183 return retval; // 0==EOF, TokenRetval::TK_NEWPARA, TokenRetval::TK_LISTITEM, TokenRetval::TK_ENDLIST, TokenRetval::RetVal_SimpleSec
3184}
bool empty() const
checks whether the container is empty
Definition growvector.h:140
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
#define AUTO_TRACE(...)
Definition docnode.cpp:48
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:50
std::unique_ptr< DocNodeVariant > createDocNode(Args &&...args)
Definition docnode.h:1500

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

Definition at line 3186 of file docnode.cpp.

3187{
3188 AUTO_TRACE();
3189 auto ns = AutoNodeStack(parser(),thisVariant());
3190
3192 DocTitle *title = &std::get<DocTitle>(*m_title);
3193 title->parseFromString(thisVariant(),parser()->context.token->name);
3194
3195 QCString text = parser()->context.token->text;
3196 { DocParser::AutoSaveContext saveContext(*parser());
3198 }
3199
3200 return Token::make_RetVal_OK();
3201}
Token internalValidatingParseDoc(DocNodeVariant *parent, DocNodeList &children, const QCString &doc)
const DocNodeVariant * title() const
Definition docnode.h:1042
TokenInfo * token
Definition docparser_p.h:95
QCString text

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

◆ parseXml()

Token DocSimpleSect::parseXml ( )

Definition at line 3203 of file docnode.cpp.

3204{
3205 AUTO_TRACE();
3206 auto ns = AutoNodeStack(parser(),thisVariant());
3207
3208 Token retval = Token::make_RetVal_OK();
3209 for (;;)
3210 {
3211 // add new paragraph as child
3212 if (!children().empty() && std::holds_alternative<DocPara>(children().back()))
3213 {
3214 std::get<DocPara>(children().back()).markLast(false);
3215 }
3216 bool markFirst = children().empty();
3217 children().append<DocPara>(parser(),thisVariant());
3218 DocPara *par = children().get_last<DocPara>();
3219 if (markFirst)
3220 {
3221 par->markFirst();
3222 }
3223 par->markLast();
3224
3225 // parse the contents of the paragraph
3226 retval = par->parse();
3227 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break;
3228 if (retval.is(TokenRetval::RetVal_CloseXml))
3229 {
3230 retval = Token::make_RetVal_OK();
3231 break;
3232 }
3233 }
3234
3235 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3236 return retval;
3237}
bool is(TokenRetval rv) const
bool is_any_of(ARGS... args) const

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

Definition at line 3259 of file docnode.cpp.

3260{
3261 switch (m_type)
3262 {
3263 case Unknown: break;
3264 case See: return "see";
3265 case Return: return "return";
3266 case Author: // fall through
3267 case Authors: return "author";
3268 case Version: return "version";
3269 case Since: return "since";
3270 case Date: return "date";
3271 case Note: return "note";
3272 case Warning: return "warning";
3273 case Pre: return "pre";
3274 case Post: return "post";
3275 case Copyright: return "copyright";
3276 case Invar: return "invariant";
3277 case Remark: return "remark";
3278 case Attention: return "attention";
3279 case Important: return "important";
3280 case User: return "user";
3281 case Rcs: return "rcs";
3282 }
3283 return "unknown";
3284}

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

Member Data Documentation

◆ m_title

std::unique_ptr<DocNodeVariant> DocSimpleSect::m_title
private

Definition at line 1046 of file docnode.h.

Referenced by hasTitle(), parse(), parseRcs(), and title().

◆ m_type

Type DocSimpleSect::m_type = Unknown
private

Definition at line 1045 of file docnode.h.

Referenced by DocSimpleSect(), type(), and typeString().


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