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 }
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 

Detailed Description

Node representing a simple section.

Definition at line 996 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 999 of file docnode.h.

Constructor & Destructor Documentation

◆ DocSimpleSect()

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

Definition at line 2886 of file docnode.cpp.

2886 :
2888{
2889}
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89

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

Member Function Documentation

◆ appendLinkWord()

void DocSimpleSect::appendLinkWord ( const QCString & word)

Definition at line 2986 of file docnode.cpp.

2987{
2988 DocPara *p=nullptr;
2989 if (children().empty() || (p=std::get_if<DocPara>(&children().back()))==nullptr)
2990 {
2991 children().append<DocPara>(parser(),thisVariant());
2992 p = children().get_last<DocPara>();
2993 }
2994 else
2995 {
2996 // Comma-separate <seealso> links.
2997 p->injectToken(Token::make_TK_WORD(),",");
2998 p->injectToken(Token::make_TK_WHITESPACE()," ");
2999 }
3000
3002 p->injectToken(Token::make_TK_LNKWORD(),word);
3004}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
bool injectToken(Token tok, const QCString &tokText)
Definition docnode.cpp:3889
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:1379
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1390
std::string_view word
Definition util.cpp:980

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

◆ hasTitle()

bool DocSimpleSect::hasTitle ( ) const

Definition at line 2891 of file docnode.cpp.

2892{
2893 return m_title && std::get<DocTitle>(*m_title).hasTitle();
2894}
std::unique_ptr< DocNodeVariant > m_title
Definition docnode.h:1017

References m_title.

Referenced by DocbookDocVisitor::operator()().

◆ parse()

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

Definition at line 2896 of file docnode.cpp.

2897{
2898 AUTO_TRACE();
2899 auto ns = AutoNodeStack(parser(),thisVariant());
2900
2901 // handle case for user defined title
2902 if (userTitle)
2903 {
2905 std::get_if<DocTitle>(m_title.get())->parse();
2906 }
2907
2908 // add new paragraph as child
2909 if (!children().empty() && std::holds_alternative<DocPara>(children().back()))
2910 {
2911 std::get<DocPara>(children().back()).markLast(FALSE);
2912 }
2913 bool markFirst = children().empty();
2914 if (needsSeparator)
2915 {
2916 children().append<DocSimpleSectSep>(parser(),thisVariant());
2917 }
2918 children().append<DocPara>(parser(),thisVariant());
2919 DocPara *par = children().get_last<DocPara>();
2920 if (markFirst)
2921 {
2922 par->markFirst();
2923 }
2924 par->markLast();
2925
2926 // parse the contents of the paragraph
2927 Token retval = par->parse();
2928
2929 AUTO_TRACE_EXIT("retval={}",retval.to_string());
2930 return retval; // 0==EOF, TokenRetval::TK_NEWPARA, TokenRetval::TK_LISTITEM, TokenRetval::TK_ENDLIST, TokenRetval::RetVal_SimpleSec
2931}
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:46
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:48
std::unique_ptr< DocNodeVariant > createDocNode(Args &&...args)
Definition docnode.h:1471

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

Referenced by DocPara::handleSimpleSection().

◆ parseRcs()

Token DocSimpleSect::parseRcs ( )

Definition at line 2933 of file docnode.cpp.

2934{
2935 AUTO_TRACE();
2936 auto ns = AutoNodeStack(parser(),thisVariant());
2937
2939 DocTitle *title = &std::get<DocTitle>(*m_title);
2940 title->parseFromString(thisVariant(),parser()->context.token->name);
2941
2942 QCString text = parser()->context.token->text;
2943 parser()->pushContext(); // this will create a new parser->context.token
2945 parser()->popContext(); // this will restore the old parser->context.token
2946
2947 return Token::make_RetVal_OK();
2948}
Token internalValidatingParseDoc(DocNodeVariant *parent, DocNodeList &children, const QCString &doc)
void popContext()
Definition docparser.cpp:73
void pushContext()
Definition docparser.cpp:59
const DocNodeVariant * title() const
Definition docnode.h:1013
TokenInfo * token
Definition docparser_p.h:92
QCString text

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

Definition at line 2950 of file docnode.cpp.

2951{
2952 AUTO_TRACE();
2953 auto ns = AutoNodeStack(parser(),thisVariant());
2954
2955 Token retval = Token::make_RetVal_OK();
2956 for (;;)
2957 {
2958 // add new paragraph as child
2959 if (!children().empty() && std::holds_alternative<DocPara>(children().back()))
2960 {
2961 std::get<DocPara>(children().back()).markLast(false);
2962 }
2963 bool markFirst = children().empty();
2964 children().append<DocPara>(parser(),thisVariant());
2965 DocPara *par = children().get_last<DocPara>();
2966 if (markFirst)
2967 {
2968 par->markFirst();
2969 }
2970 par->markLast();
2971
2972 // parse the contents of the paragraph
2973 retval = par->parse();
2974 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break;
2975 if (retval.is(TokenRetval::RetVal_CloseXml))
2976 {
2977 retval = Token::make_RetVal_OK();
2978 break;
2979 }
2980 }
2981
2982 AUTO_TRACE_EXIT("retval={}",retval.to_string());
2983 return retval;
2984}
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(), DocNode::parser(), DocNode::thisVariant(), and Token::to_string().

Referenced by DocPara::handleSimpleSection().

◆ title()

◆ type()

◆ typeString()

QCString DocSimpleSect::typeString ( ) const

Definition at line 3006 of file docnode.cpp.

3007{
3008 switch (m_type)
3009 {
3010 case Unknown: break;
3011 case See: return "see";
3012 case Return: return "return";
3013 case Author: // fall through
3014 case Authors: return "author";
3015 case Version: return "version";
3016 case Since: return "since";
3017 case Date: return "date";
3018 case Note: return "note";
3019 case Warning: return "warning";
3020 case Pre: return "pre";
3021 case Post: return "post";
3022 case Copyright: return "copyright";
3023 case Invar: return "invariant";
3024 case Remark: return "remark";
3025 case Attention: return "attention";
3026 case Important: return "important";
3027 case User: return "user";
3028 case Rcs: return "rcs";
3029 }
3030 return "unknown";
3031}

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 1017 of file docnode.h.

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

◆ m_type

Type DocSimpleSect::m_type = Unknown
private

Definition at line 1016 of file docnode.h.

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


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