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

Node representing a HTML list item. More...

#include <src/docnode.h>

+ Inheritance diagram for DocHtmlListItem:
+ Collaboration diagram for DocHtmlListItem:

Public Member Functions

 DocHtmlListItem (DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, int num)
 
int itemNumber () const
 
const HtmlAttribListattribs () const
 
Token parse ()
 
Token parseXml ()
 
- 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

HtmlAttribList m_attribs
 
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 a HTML list item.

Definition at line 1144 of file docnode.h.

Constructor & Destructor Documentation

◆ DocHtmlListItem()

DocHtmlListItem::DocHtmlListItem ( DocParser * parser,
DocNodeVariant * parent,
const HtmlAttribList & attribs,
int num )
inline

Definition at line 1147 of file docnode.h.

DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
const HtmlAttribList & attribs() const
Definition docnode.h:1150
HtmlAttribList m_attribs
Definition docnode.h:1155
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89

References attribs(), DocCompoundNode::DocCompoundNode(), m_attribs, m_itemNum, DocNode::parent(), and DocNode::parser().

Member Function Documentation

◆ attribs()

◆ itemNumber()

int DocHtmlListItem::itemNumber ( ) const
inline

Definition at line 1149 of file docnode.h.

1149{ return m_itemNum; }

References m_itemNum.

◆ parse()

Token DocHtmlListItem::parse ( )

Definition at line 2477 of file docnode.cpp.

2478{
2479 AUTO_TRACE();
2480 Token retval = Token::make_TK_NONE();
2481 auto ns = AutoNodeStack(parser(),thisVariant());
2482
2483 // parse one or more paragraphs
2484 bool isFirst=TRUE;
2485 DocPara *par=nullptr;
2486 do
2487 {
2488 children().append<DocPara>(parser(),thisVariant());
2489 par = children().get_last<DocPara>();
2490 if (isFirst) { par->markFirst(); isFirst=FALSE; }
2491 retval=par->parse();
2492 }
2493 while (retval.is(TokenRetval::TK_NEWPARA));
2494 if (par) par->markLast();
2495
2496 AUTO_TRACE_EXIT("retval={}",retval.to_string());
2497 return retval;
2498}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
void markLast(bool v=TRUE)
Definition docnode.h:1066
void markFirst(bool v=TRUE)
Definition docnode.h:1065
Token parse()
Definition docnode.cpp:5451
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(), DocPara::markFirst(), DocPara::markLast(), DocPara::parse(), DocNode::parser(), DocNode::thisVariant(), Token::to_string(), and TRUE.

◆ parseXml()

Token DocHtmlListItem::parseXml ( )

Definition at line 2500 of file docnode.cpp.

2501{
2502 AUTO_TRACE();
2503 Token retval = Token::make_TK_NONE();
2504 auto ns = AutoNodeStack(parser(),thisVariant());
2505
2506 // parse one or more paragraphs
2507 bool isFirst=TRUE;
2508 DocPara *par=nullptr;
2509 do
2510 {
2511 children().append<DocPara>(parser(),thisVariant());
2512 par = children().get_last<DocPara>();
2513 if (isFirst) { par->markFirst(); isFirst=FALSE; }
2514 retval=par->parse();
2515 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break;
2516
2517 //printf("new item: retval=%x parser()->context.token->name=%s parser()->context.token->endTag=%d\n",
2518 // retval,qPrint(parser()->context.token->name),parser()->context.token->endTag);
2519 if (retval.is(TokenRetval::RetVal_ListItem))
2520 {
2521 break;
2522 }
2523 }
2524 while (!retval.is(TokenRetval::RetVal_CloseXml));
2525
2526 if (par) par->markLast();
2527
2528 AUTO_TRACE_EXIT("retval={}",retval.to_string());
2529 return retval;
2530}
bool is_any_of(ARGS... args) const

References DocNodeList::append(), AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children(), FALSE, DocNodeList::get_last(), Token::is(), Token::is_any_of(), DocPara::markFirst(), DocPara::markLast(), DocPara::parse(), DocNode::parser(), DocNode::thisVariant(), Token::to_string(), and TRUE.

Member Data Documentation

◆ m_attribs

HtmlAttribList DocHtmlListItem::m_attribs
private

Definition at line 1155 of file docnode.h.

Referenced by attribs(), and DocHtmlListItem().

◆ m_itemNum

int DocHtmlListItem::m_itemNum = 0
private

Definition at line 1156 of file docnode.h.

Referenced by DocHtmlListItem(), and itemNumber().


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