Doxygen
DocHtmlList类 参考

Node representing a Html list 更多...

#include <docparser.h>

+ 类 DocHtmlList 继承关系图:
+ DocHtmlList 的协作图:

Public 类型

enum  Type { Unordered, Ordered }
 
- Public 类型 继承自 DocNode
enum  Kind {
  Kind_Root = 0, Kind_Word = 1, Kind_WhiteSpace = 2, Kind_Para = 3,
  Kind_AutoList = 4, Kind_AutoListItem = 5, Kind_Symbol = 6, Kind_URL = 7,
  Kind_StyleChange = 8, Kind_SimpleSect = 9, Kind_Title = 10, Kind_SimpleList = 11,
  Kind_SimpleListItem = 12, Kind_Section = 13, Kind_Verbatim = 14, Kind_XRefItem = 15,
  Kind_HtmlList = 16, Kind_HtmlListItem = 17, Kind_HtmlDescList = 18, Kind_HtmlDescData = 19,
  Kind_HtmlDescTitle = 20, Kind_HtmlTable = 21, Kind_HtmlRow = 22, Kind_HtmlCell = 23,
  Kind_HtmlCaption = 24, Kind_LineBreak = 25, Kind_HorRuler = 26, Kind_Anchor = 27,
  Kind_IndexEntry = 28, Kind_Internal = 29, Kind_HRef = 30, Kind_Include = 31,
  Kind_IncOperator = 32, Kind_HtmlHeader = 33, Kind_Image = 34, Kind_DotFile = 35,
  Kind_Link = 36, Kind_Ref = 37, Kind_Formula = 38, Kind_SecRefItem = 39,
  Kind_SecRefList = 40, Kind_SimpleSectSep = 41, Kind_LinkedWord = 42, Kind_ParamSect = 43,
  Kind_ParamList = 44, Kind_InternalRef = 45, Kind_Copy = 46, Kind_Text = 47,
  Kind_MscFile = 48, Kind_HtmlBlockQuote = 49, Kind_VhdlFlow = 50, Kind_ParBlock = 51,
  Kind_DiaFile = 52, Kind_Emoji = 53, Kind_Sep = 54
}
 

Public 成员函数

 DocHtmlList (DocParser &parser, DocNode *parent, const HtmlAttribList &attribs, Type t)
 
Kind kind () const override
 
Type type () const
 
const HtmlAttribListattribs () const
 
int parse ()
 
int parseXml ()
 
- Public 成员函数 继承自 CompAccept< DocHtmlList >
 CompAccept (DocParser &parser)
 
void accept (DocVisitor *v) override
 
const DocNodeListchildren () const
 
DocNodeListchildren ()
 
- Public 成员函数 继承自 DocNode
 DocNode (DocParser &parser)
 
virtual ~DocNode ()
 
DocNodeparent () const
 
void setParent (DocNode *parent)
 
bool isPreformatted () const
 

Private 属性

Type m_type = Unordered
 
HtmlAttribList m_attribs
 

额外继承的成员函数

- Protected 类型 继承自 DocNode
enum  RefType { Unknown, Anchor, Section, Table }
 
- Protected 成员函数 继承自 DocNode
void setInsidePreformatted (bool p)
 
- Protected 属性 继承自 CompAccept< DocHtmlList >
DocNodeList m_children
 
- Protected 属性 继承自 DocNode
DocNodem_parent = 0
 
DocParserm_parser
 

详细描述

Node representing a Html list

在文件 docparser.h1093 行定义.

成员枚举类型说明

◆ Type

枚举值
Unordered 
Ordered 

在文件 docparser.h1096 行定义.

1096 { Unordered, Ordered };

构造及析构函数说明

◆ DocHtmlList()

DocHtmlList::DocHtmlList ( DocParser parser,
DocNode parent,
const HtmlAttribList attribs,
Type  t 
)
inline

在文件 docparser.h1097 行定义.

1097  :

引用了 DocNode::m_parent , 以及 DocNode::parent().

成员函数说明

◆ attribs()

◆ kind()

Kind DocHtmlList::kind ( ) const
inlineoverridevirtual

Returns the kind of node. Provides runtime type information

实现了 DocNode.

在文件 docparser.h1099 行定义.

1099 { return Kind_HtmlList; }

引用了 DocNode::Kind_HtmlList.

◆ parse()

int DocHtmlList::parse ( )

在文件 docparser.cpp4048 行定义.

4049 {
4050  DBG(("DocHtmlList::parse() start\n"));
4051  int retval=RetVal_OK;
4052  int num=1;
4053  auto ns = AutoNodeStack(m_parser,this);
4054 
4055  // get next token
4056  int tok=m_parser.tokenizer.lex();
4057  // skip whitespace and paragraph breaks
4058  while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=m_parser.tokenizer.lex();
4059  // should find a html tag now
4060  if (tok==TK_HTMLTAG)
4061  {
4063  if (tagId==HTML_LI && !m_parser.context.token->endTag) // found <li> tag
4064  {
4065  // ok, we can go on.
4066  }
4067  else if (((m_type==Unordered && tagId==HTML_UL) ||
4068  (m_type==Ordered && tagId==HTML_OL)
4070  ) // found empty list
4071  {
4072  // add dummy item to obtain valid HTML
4073  m_children.push_back(std::make_unique<DocHtmlListItem>(m_parser,this,HtmlAttribList(),1));
4075  retval = RetVal_EndList;
4076  goto endlist;
4077  }
4078  else // found some other tag
4079  {
4080  // add dummy item to obtain valid HTML
4081  m_children.push_back(std::make_unique<DocHtmlListItem>(m_parser,this,HtmlAttribList(),1));
4083  "found <%s%s> instead!",m_parser.context.token->endTag?"/":"",qPrint(m_parser.context.token->name));
4085  goto endlist;
4086  }
4087  }
4088  else if (tok==0) // premature end of comment
4089  {
4090  // add dummy item to obtain valid HTML
4091  m_children.push_back(std::make_unique<DocHtmlListItem>(m_parser,this,HtmlAttribList(),1));
4092  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"unexpected end of comment while looking"
4093  " for a html list item");
4094  goto endlist;
4095  }
4096  else // token other than html token
4097  {
4098  // add dummy item to obtain valid HTML
4099  m_children.push_back(std::make_unique<DocHtmlListItem>(m_parser,this,HtmlAttribList(),1));
4100  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"expected <li> tag but found %s token instead!",
4102  goto endlist;
4103  }
4104 
4105  do
4106  {
4108  m_children.push_back(std::unique_ptr<DocHtmlListItem>(li));
4109  retval=li->parse();
4110  } while (retval==RetVal_ListItem);
4111 
4112  if (retval==0)
4113  {
4114  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"unexpected end of comment while inside <%cl> block",
4115  m_type==Unordered ? 'u' : 'o');
4116  }
4117 
4118 endlist:
4119  DBG(("DocHtmlList::parse() end retval=%s\n",DocTokenizer::retvalToString(retval)));
4120  return retval==RetVal_EndList ? RetVal_OK : retval;
4121 }

引用了 TokenInfo::attribs, DocParser::context, DBG, TokenInfo::endTag, DocParserContext::fileName, DocTokenizer::getLineNr(), HTML_LI, HTML_OL, HTML_UL, Mappers::htmlTagMapper, DocTokenizer::lex(), CompAccept< DocHtmlList >::m_children, DocNode::m_parser, m_type, Mapper::map(), TokenInfo::name, Ordered, DocHtmlListItem::parse(), DocTokenizer::pushBackHtmlTag(), qPrint(), RetVal_EndList, RetVal_ListItem, RetVal_OK, DocTokenizer::retvalToString(), TK_HTMLTAG, TK_NEWPARA, TK_WHITESPACE, DocParserContext::token, DocParser::tokenizer, DocTokenizer::tokToString(), Unordered , 以及 warn_doc_error().

被这些函数引用 DocPara::handleHtmlStartTag().

◆ parseXml()

int DocHtmlList::parseXml ( )

在文件 docparser.cpp4123 行定义.

4124 {
4125  DBG(("DocHtmlList::parseXml() start\n"));
4126  int retval=RetVal_OK;
4127  int num=1;
4128  auto ns = AutoNodeStack(m_parser,this);
4129 
4130  // get next token
4131  int tok=m_parser.tokenizer.lex();
4132  // skip whitespace and paragraph breaks
4133  while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=m_parser.tokenizer.lex();
4134  // should find a html tag now
4135  if (tok==TK_HTMLTAG)
4136  {
4138  //printf("m_parser.context.token->name=%s m_parser.context.token->endTag=%d\n",qPrint(m_parser.context.token->name),m_parser.context.token->endTag);
4139  if (tagId==XML_ITEM && !m_parser.context.token->endTag) // found <item> tag
4140  {
4141  // ok, we can go on.
4142  }
4143  else // found some other tag
4144  {
4145  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"expected <item> tag but "
4146  "found <%s> instead!",qPrint(m_parser.context.token->name));
4148  goto endlist;
4149  }
4150  }
4151  else if (tok==0) // premature end of comment
4152  {
4153  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"unexpected end of comment while looking"
4154  " for a html list item");
4155  goto endlist;
4156  }
4157  else // token other than html token
4158  {
4159  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"expected <item> tag but found %s token instead!",
4161  goto endlist;
4162  }
4163 
4164  do
4165  {
4167  m_children.push_back(std::unique_ptr<DocHtmlListItem>(li));
4168  retval=li->parseXml();
4169  if (retval==0) break;
4170  //printf("retval=%x m_parser.context.token->name=%s\n",retval,qPrint(m_parser.context.token->name));
4171  } while (retval==RetVal_ListItem);
4172 
4173  if (retval==0)
4174  {
4175  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"unexpected end of comment while inside <list type=\"%s\"> block",
4176  m_type==Unordered ? "bullet" : "number");
4177  }
4178 
4179 endlist:
4180  DBG(("DocHtmlList::parseXml() end retval=%s\n",DocTokenizer::retvalToString(retval)));
4181  return retval==RetVal_EndList ||
4182  (retval==RetVal_CloseXml || m_parser.context.token->name=="list") ?
4183  RetVal_OK : retval;
4184 }

引用了 TokenInfo::attribs, DocParser::context, DBG, TokenInfo::endTag, DocParserContext::fileName, DocTokenizer::getLineNr(), Mappers::htmlTagMapper, DocTokenizer::lex(), CompAccept< DocHtmlList >::m_children, DocNode::m_parser, m_type, Mapper::map(), TokenInfo::name, DocHtmlListItem::parseXml(), DocTokenizer::pushBackHtmlTag(), qPrint(), RetVal_CloseXml, RetVal_EndList, RetVal_ListItem, RetVal_OK, DocTokenizer::retvalToString(), TK_HTMLTAG, TK_NEWPARA, TK_WHITESPACE, DocParserContext::token, DocParser::tokenizer, DocTokenizer::tokToString(), Unordered, warn_doc_error() , 以及 XML_ITEM.

被这些函数引用 DocPara::handleHtmlStartTag().

◆ type()

类成员变量说明

◆ m_attribs

HtmlAttribList DocHtmlList::m_attribs
private

在文件 docparser.h1107 行定义.

被这些函数引用 attribs().

◆ m_type

Type DocHtmlList::m_type = Unordered
private

在文件 docparser.h1106 行定义.

被这些函数引用 parse(), parseXml() , 以及 type().


该类的文档由以下文件生成:
TokenInfo::endTag
bool endTag
Definition: doctokenizer.h:100
DocParserContext::token
TokenInfo * token
Definition: docparser.cpp:129
DocParser::context
DocParserContext context
Definition: docparser.cpp:175
DocTokenizer::tokToString
static const char * tokToString(int token)
CompAccept< DocHtmlList >
HTML_LI
@ HTML_LI
Definition: cmdmapper.h:165
HtmlAttribList
Class representing a list of HTML attributes.
Definition: htmlattrib.h:30
DocHtmlListItem::parseXml
int parseXml()
Definition: docparser.cpp:4014
TokenInfo::name
QCString name
Definition: doctokenizer.h:74
RetVal_OK
@ RetVal_OK
Command starting with \
Definition: doctokenizer.h:59
RetVal_CloseXml
@ RetVal_CloseXml
Definition: doctokenizer.h:78
DocHtmlListItem
Node representing a HTML list item
Definition: docparser.h:1286
TokenInfo::attribs
HtmlAttribList attribs
Definition: doctokenizer.h:99
DocParser::tokenizer
DocTokenizer tokenizer
Definition: docparser.cpp:176
warn_doc_error
void warn_doc_error(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:186
DocHtmlList::attribs
const HtmlAttribList & attribs() const
Definition: docparser.h:1101
TK_WHITESPACE
@ TK_WHITESPACE
Definition: doctokenizer.h:48
DocHtmlList::Ordered
@ Ordered
Definition: docparser.h:1096
DocTokenizer::pushBackHtmlTag
void pushBackHtmlTag(const QCString &tag)
Mappers::htmlTagMapper
static Mapper * htmlTagMapper
Definition: cmdmapper.h:235
DocParserContext::fileName
QCString fileName
Definition: docparser.cpp:110
DocHtmlList::Unordered
@ Unordered
Definition: docparser.h:1096
RetVal_EndList
@ RetVal_EndList
Definition: doctokenizer.h:67
DocHtmlList::m_attribs
HtmlAttribList m_attribs
Definition: docparser.h:1107
DocTokenizer::retvalToString
static const char * retvalToString(int retval)
DocHtmlListItem::parse
int parse()
Definition: docparser.cpp:3991
DocNode::m_parser
DocParser & m_parser
Definition: docparser.h:184
DocNode::Kind_HtmlList
@ Kind_HtmlList
Definition: docparser.h:116
RetVal_ListItem
@ RetVal_ListItem
Definition: doctokenizer.h:61
DocTokenizer::getLineNr
int getLineNr(void)
HTML_OL
@ HTML_OL
Definition: cmdmapper.h:163
XML_ITEM
@ XML_ITEM
Definition: cmdmapper.h:198
HTML_UL
@ HTML_UL
Definition: cmdmapper.h:164
TK_HTMLTAG
@ TK_HTMLTAG
Command starting with @
Definition: doctokenizer.h:52
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
DocHtmlList::m_type
Type m_type
Definition: docparser.h:1106
AutoNodeStack
Definition: docparser.cpp:186
Mapper::map
int map(const QCString &n)
Definition: cmdmapper.cpp:237
DocTokenizer::lex
int lex()
TK_NEWPARA
@ TK_NEWPARA
Definition: doctokenizer.h:54
DocNode::parent
DocNode * parent() const
Definition: docparser.h:166
DBG
#define DBG(x)
Definition: docparser.cpp:58
CompAccept< DocHtmlList >::m_children
DocNodeList m_children
Definition: docparser.h:211
DocNode::m_parent
DocNode * m_parent
Definition: docparser.h:182