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

2897 :
2899{
2900}
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 2997 of file docnode.cpp.

2998{
2999 DocPara *p=nullptr;
3000 if (children().empty() || (p=std::get_if<DocPara>(&children().back()))==nullptr)
3001 {
3002 children().append<DocPara>(parser(),thisVariant());
3003 p = children().get_last<DocPara>();
3004 }
3005 else
3006 {
3007 // Comma-separate <seealso> links.
3008 p->injectToken(Token::make_TK_WORD(),",");
3009 p->injectToken(Token::make_TK_WHITESPACE()," ");
3010 }
3011
3013 p->injectToken(Token::make_TK_LNKWORD(),word);
3015}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
bool injectToken(Token tok, const QCString &tokText)
Definition docnode.cpp:3899
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 2902 of file docnode.cpp.

2903{
2904 return m_title && std::get<DocTitle>(*m_title).hasTitle();
2905}
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 2907 of file docnode.cpp.

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

2945{
2946 AUTO_TRACE();
2947 auto ns = AutoNodeStack(parser(),thisVariant());
2948
2950 DocTitle *title = &std::get<DocTitle>(*m_title);
2951 title->parseFromString(thisVariant(),parser()->context.token->name);
2952
2953 QCString text = parser()->context.token->text;
2954 parser()->pushContext(); // this will create a new parser->context.token
2956 parser()->popContext(); // this will restore the old parser->context.token
2957
2958 return Token::make_RetVal_OK();
2959}
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 2961 of file docnode.cpp.

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

3018{
3019 switch (m_type)
3020 {
3021 case Unknown: break;
3022 case See: return "see";
3023 case Return: return "return";
3024 case Author: // fall through
3025 case Authors: return "author";
3026 case Version: return "version";
3027 case Since: return "since";
3028 case Date: return "date";
3029 case Note: return "note";
3030 case Warning: return "warning";
3031 case Pre: return "pre";
3032 case Post: return "post";
3033 case Copyright: return "copyright";
3034 case Invar: return "invariant";
3035 case Remark: return "remark";
3036 case Attention: return "attention";
3037 case Important: return "important";
3038 case User: return "user";
3039 case Rcs: return "rcs";
3040 }
3041 return "unknown";
3042}

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: