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

Node representing an item of a auto list. More...

#include <src/docnode.h>

+ Inheritance diagram for DocAutoListItem:
+ Collaboration diagram for DocAutoListItem:

Public Member Functions

 DocAutoListItem (DocParser *parser, DocNodeVariant *parent, int indent, int num)
 
int itemNumber () const
 
Token parse ()
 
- 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

int m_indent = 0
 
int m_itemNum = 0
 

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 an item of a auto list.

Definition at line 575 of file docnode.h.

Constructor & Destructor Documentation

◆ DocAutoListItem()

DocAutoListItem::DocAutoListItem ( DocParser * parser,
DocNodeVariant * parent,
int indent,
int num )

Definition at line 2762 of file docnode.cpp.

2764{
2765}
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_indent, m_itemNum, DocNode::parent(), and DocNode::parser().

Member Function Documentation

◆ itemNumber()

◆ parse()

Token DocAutoListItem::parse ( )

Definition at line 2767 of file docnode.cpp.

2768{
2769 AUTO_TRACE();
2770 Token retval = Token::make_RetVal_OK();
2771 auto ns = AutoNodeStack(parser(),thisVariant());
2772
2773 // first parse any number of paragraphs
2774 bool isFirst=TRUE;
2775 DocPara *lastPar=nullptr;
2776 do
2777 {
2778 children().append<DocPara>(parser(),thisVariant());
2779 DocPara *par = children().get_last<DocPara>();
2780 if (isFirst) { par->markFirst(); isFirst=FALSE; }
2781 retval=par->parse();
2782 if (!par->isEmpty())
2783 {
2784 if (lastPar) lastPar->markLast(FALSE);
2785 lastPar=par;
2786 }
2787 else
2788 {
2789 children().pop_back();
2790 }
2791 // next paragraph should be more indented than the - marker to belong
2792 // to this item
2793 } while (retval.is(TokenRetval::TK_NEWPARA) && parser()->context.token->indent>m_indent);
2794 if (lastPar) lastPar->markLast();
2795
2796 AUTO_TRACE_EXIT("retval={}",retval.to_string());
2797 return retval;
2798}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
void markLast(bool v=TRUE)
Definition docnode.h:1066
void pop_back()
removes the last element
Definition growvector.h:115
bool is(TokenRetval rv) const
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:48
#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

References DocNodeList::append(), AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children(), FALSE, DocNodeList::get_last(), Token::is(), m_indent, DocPara::markLast(), DocNode::parser(), GrowVector< T >::pop_back(), DocNode::thisVariant(), Token::to_string(), and TRUE.

Member Data Documentation

◆ m_indent

int DocAutoListItem::m_indent = 0
private

Definition at line 583 of file docnode.h.

Referenced by DocAutoListItem(), and parse().

◆ m_itemNum

int DocAutoListItem::m_itemNum = 0
private

Definition at line 584 of file docnode.h.

Referenced by DocAutoListItem(), and itemNumber().


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