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

Constructor & Destructor Documentation

◆ DocSimpleSect()

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

Definition at line 2888 of file docnode.cpp.

2888 :
2890{
2891}
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 2988 of file docnode.cpp.

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

2894{
2895 return m_title && std::get<DocTitle>(*m_title).hasTitle();
2896}
std::unique_ptr< DocNodeVariant > m_title
Definition docnode.h:1031

References m_title.

Referenced by DocbookDocVisitor::operator()().

◆ parse()

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

Definition at line 2898 of file docnode.cpp.

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

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 2935 of file docnode.cpp.

2936{
2937 AUTO_TRACE();
2938 auto ns = AutoNodeStack(parser(),thisVariant());
2939
2941 DocTitle *title = &std::get<DocTitle>(*m_title);
2942 title->parseFromString(thisVariant(),parser()->context.token->name);
2943
2944 QCString text = parser()->context.token->text;
2945 parser()->pushContext(); // this will create a new parser->context.token
2947 parser()->popContext(); // this will restore the old parser->context.token
2948
2949 return Token::make_RetVal_OK();
2950}
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:1027
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 2952 of file docnode.cpp.

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

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

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

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

◆ m_type

Type DocSimpleSect::m_type = Unknown
private

Definition at line 1030 of file docnode.h.

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


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