Doxygen
DocHtmlTable类 参考

Node representing a HTML table 更多...

#include <docparser.h>

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

Public 成员函数

 DocHtmlTable (DocParser &parser, DocNode *parent, const HtmlAttribList &attribs)
 
 ~DocHtmlTable ()
 
Kind kind () const override
 
size_t numRows () const
 
bool hasCaption ()
 
const HtmlAttribListattribs () const
 
int parse ()
 
int parseXml ()
 
size_t numColumns () const
 
void accept (DocVisitor *v) override
 
DocHtmlCaptioncaption () const
 
DocHtmlRowfirstRow () const
 
- Public 成员函数 继承自 CompAccept< DocHtmlTable >
 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 成员函数

void computeTableGrid ()
 determines the location of all cells in a grid, resolving row and column spans. 更多...
 

Private 属性

DocHtmlCaptionm_caption = 0
 
HtmlAttribList m_attribs
 
size_t m_numCols = 0
 

额外继承的成员函数

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

详细描述

Node representing a HTML table

在文件 docparser.h1405 行定义.

构造及析构函数说明

◆ DocHtmlTable()

DocHtmlTable::DocHtmlTable ( DocParser parser,
DocNode parent,
const HtmlAttribList attribs 
)
inline

在文件 docparser.h1408 行定义.

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

◆ ~DocHtmlTable()

DocHtmlTable::~DocHtmlTable ( )
inline

在文件 docparser.h1410 行定义.

1410 { delete m_caption; }

引用了 m_caption.

成员函数说明

◆ accept()

void DocHtmlTable::accept ( DocVisitor v)
overridevirtual

Acceptor function for node visitors. Part of the visitor pattern.

参数
vAbstract visitor.

实现了 DocNode.

在文件 docparser.cpp3729 行定义.

3730 {
3731  v->visitPre(this);
3732  // for HTML output we put the caption first
3733  //if (m_caption && v->id()==DocVisitor_Html) m_caption->accept(v);
3734  // doxygen 1.8.11: always put the caption first
3735  if (m_caption) m_caption->accept(v);
3736  for (const auto &n : m_children) n->accept(v);
3737  // for other output formats we put the caption last
3738  //if (m_caption && v->id()!=DocVisitor_Html) m_caption->accept(v);
3739  v->visitPost(this);
3740 }

引用了 CompAccept< T >::accept(), m_caption, CompAccept< DocHtmlTable >::m_children, DocVisitor::visitPost() , 以及 DocVisitor::visitPre().

◆ attribs()

const HtmlAttribList& DocHtmlTable::attribs ( ) const
inline

在文件 docparser.h1414 行定义.

1414 { return m_attribs; }

引用了 m_attribs.

被这些函数引用 HtmlDocVisitor::visitPre() , 以及 XmlDocVisitor::visitPre().

◆ caption()

DocHtmlCaption* DocHtmlTable::caption ( ) const
inline

在文件 docparser.h1419 行定义.

1419 { return m_caption; }

引用了 m_caption.

被这些函数引用 HtmlDocVisitor::visitPre() , 以及 LatexDocVisitor::visitPre().

◆ computeTableGrid()

void DocHtmlTable::computeTableGrid ( )
private

determines the location of all cells in a grid, resolving row and column spans.

For each the total number of visible cells is computed, and the total number of visible columns over all rows is stored.

在文件 docparser.cpp3677 行定义.

3678 {
3679  //printf("computeTableGrid()\n");
3680  RowSpanList rowSpans;
3681  uint maxCols=0;
3682  uint rowIdx=1;
3683  for (const auto &rowNode : children())
3684  {
3685  uint colIdx=1;
3686  uint cells=0;
3687  if (rowNode->kind()==DocNode::Kind_HtmlRow)
3688  {
3689  size_t i;
3690  DocHtmlRow *row = (DocHtmlRow*)rowNode.get();
3691  for (const auto &cellNode : row->children())
3692  {
3693  if (cellNode->kind()==DocNode::Kind_HtmlCell)
3694  {
3695  DocHtmlCell *cell = (DocHtmlCell*)cellNode.get();
3696  uint rs = cell->rowSpan();
3697  uint cs = cell->colSpan();
3698 
3699  for (i=0;i<rowSpans.size();i++)
3700  {
3701  if (rowSpans[i].rowsLeft>0 &&
3702  rowSpans[i].column==colIdx)
3703  {
3704  colIdx=rowSpans[i].column+1;
3705  cells++;
3706  }
3707  }
3708  if (rs>0) rowSpans.emplace_back(rs,colIdx);
3709  //printf("found cell at (%d,%d)\n",rowIdx,colIdx);
3710  cell->setRowIndex(rowIdx);
3711  cell->setColumnIndex(colIdx);
3712  colIdx+=cs;
3713  cells++;
3714  }
3715  }
3716  for (i=0;i<rowSpans.size();i++)
3717  {
3718  if (rowSpans[i].rowsLeft>0) rowSpans[i].rowsLeft--;
3719  }
3720  row->setVisibleCells(cells);
3721  row->setRowIndex(rowIdx);
3722  rowIdx++;
3723  }
3724  if (colIdx-1>maxCols) maxCols=colIdx-1;
3725  }
3726  m_numCols = maxCols;
3727 }

引用了 CompAccept< DocHtmlTable >::children(), CompAccept< T >::children(), DocHtmlCell::colSpan(), DocNode::Kind_HtmlCell, DocNode::Kind_HtmlRow, m_numCols, DocHtmlCell::rowSpan(), DocHtmlCell::setColumnIndex(), DocHtmlCell::setRowIndex(), DocHtmlRow::setRowIndex() , 以及 DocHtmlRow::setVisibleCells().

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

◆ firstRow()

DocHtmlRow* DocHtmlTable::firstRow ( ) const
inline

在文件 docparser.h1420 行定义.

1420  {
1421  return (!m_children.empty() && m_children.front()->kind()==Kind_HtmlRow) ?
1422  (DocHtmlRow*)m_children.front().get() : 0;
1423  }

引用了 DocNode::Kind_HtmlRow , 以及 CompAccept< DocHtmlTable >::m_children.

被这些函数引用 LatexDocVisitor::visitPre().

◆ hasCaption()

bool DocHtmlTable::hasCaption ( )
inline

在文件 docparser.h1413 行定义.

1413 { return m_caption!=0; }

引用了 m_caption.

被这些函数引用 HtmlDocVisitor::visitPre() , 以及 LatexDocVisitor::visitPre().

◆ kind()

Kind DocHtmlTable::kind ( ) const
inlineoverridevirtual

Returns the kind of node. Provides runtime type information

实现了 DocNode.

在文件 docparser.h1411 行定义.

1411 { return Kind_HtmlTable; }

引用了 DocNode::Kind_HtmlTable.

◆ numColumns()

size_t DocHtmlTable::numColumns ( ) const
inline

在文件 docparser.h1417 行定义.

1417 { return m_numCols; }

引用了 m_numCols.

被这些函数引用 PrintDocVisitor::visitPost(), DocbookDocVisitor::visitPre(), LatexDocVisitor::visitPre() , 以及 XmlDocVisitor::visitPre().

◆ numRows()

size_t DocHtmlTable::numRows ( ) const
inline

在文件 docparser.h1412 行定义.

1412 { return m_children.size(); }

引用了 CompAccept< DocHtmlTable >::m_children.

被这些函数引用 PrintDocVisitor::visitPost() , 以及 XmlDocVisitor::visitPre().

◆ parse()

int DocHtmlTable::parse ( )

在文件 docparser.cpp3551 行定义.

3552 {
3553  int retval=RetVal_OK;
3554  auto ns = AutoNodeStack(m_parser,this);
3555  DBG(("DocHtmlTable::parse() start\n"));
3556 
3557 getrow:
3558  // get next token
3559  int tok=m_parser.tokenizer.lex();
3560  // skip whitespace
3561  while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=m_parser.tokenizer.lex();
3562  // should find a html tag now
3563  if (tok==TK_HTMLTAG)
3564  {
3566  if (tagId==HTML_TR && !m_parser.context.token->endTag) // found <tr> tag
3567  {
3568  // no caption, just rows
3569  retval=RetVal_TableRow;
3570  }
3571  else if (tagId==HTML_CAPTION && !m_parser.context.token->endTag) // found <caption> tag
3572  {
3573  if (m_caption)
3574  {
3575  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"table already has a caption, found another one");
3576  }
3577  else
3578  {
3580  retval=m_caption->parse();
3581 
3582  if (retval==RetVal_OK) // caption was parsed ok
3583  {
3584  goto getrow;
3585  }
3586  }
3587  }
3588  else // found wrong token
3589  {
3590  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"expected <tr> or <caption> tag but "
3591  "found <%s%s> instead!", m_parser.context.token->endTag ? "/" : "", qPrint(m_parser.context.token->name));
3592  }
3593  }
3594  else if (tok==0) // premature end of comment
3595  {
3596  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"unexpected end of comment while looking"
3597  " for a <tr> or <caption> tag");
3598  }
3599  else // token other than html token
3600  {
3601  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"expected <tr> tag but found %s token instead!",
3603  }
3604 
3605  // parse one or more rows
3606  while (retval==RetVal_TableRow)
3607  {
3609  m_children.push_back(std::unique_ptr<DocHtmlRow>(tr));
3610  retval=tr->parse();
3611  }
3612 
3613  computeTableGrid();
3614 
3615  DBG(("DocHtmlTable::parse() end\n"));
3616  return retval==RetVal_EndTable ? RetVal_OK : retval;
3617 }

引用了 TokenInfo::attribs, computeTableGrid(), DocParser::context, DBG, TokenInfo::endTag, DocParserContext::fileName, DocTokenizer::getLineNr(), HTML_CAPTION, HTML_TR, Mappers::htmlTagMapper, DocTokenizer::lex(), m_caption, CompAccept< DocHtmlTable >::m_children, DocNode::m_parser, Mapper::map(), TokenInfo::name, DocHtmlCaption::parse(), DocHtmlRow::parse(), qPrint(), RetVal_EndTable, RetVal_OK, RetVal_TableRow, TK_HTMLTAG, TK_NEWPARA, TK_WHITESPACE, DocParserContext::token, DocParser::tokenizer, DocTokenizer::tokToString() , 以及 warn_doc_error().

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

◆ parseXml()

int DocHtmlTable::parseXml ( )

在文件 docparser.cpp3619 行定义.

3620 {
3621  int retval=RetVal_OK;
3622  auto ns = AutoNodeStack(m_parser,this);
3623  DBG(("DocHtmlTable::parseXml() start\n"));
3624 
3625  // get next token
3626  int tok=m_parser.tokenizer.lex();
3627  // skip whitespace
3628  while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=m_parser.tokenizer.lex();
3629  // should find a html tag now
3630  int tagId=0;
3631  bool isHeader=FALSE;
3632  if (tok==TK_HTMLTAG)
3633  {
3635  if (tagId==XML_ITEM && !m_parser.context.token->endTag) // found <item> tag
3636  {
3637  retval=RetVal_TableRow;
3638  }
3639  if (tagId==XML_LISTHEADER && !m_parser.context.token->endTag) // found <listheader> tag
3640  {
3641  retval=RetVal_TableRow;
3642  isHeader=TRUE;
3643  }
3644  }
3645 
3646  // parse one or more rows
3647  while (retval==RetVal_TableRow)
3648  {
3650  m_children.push_back(std::unique_ptr<DocHtmlRow>(tr));
3651  retval=tr->parseXml(isHeader);
3652  isHeader=FALSE;
3653  }
3654 
3655  computeTableGrid();
3656 
3657  DBG(("DocHtmlTable::parseXml() end\n"));
3659  return tagId==XML_LIST && m_parser.context.token->endTag ? RetVal_OK : retval;
3660 }

引用了 TokenInfo::attribs, computeTableGrid(), DocParser::context, DBG, TokenInfo::endTag, FALSE, Mappers::htmlTagMapper, DocTokenizer::lex(), CompAccept< DocHtmlTable >::m_children, DocNode::m_parser, Mapper::map(), TokenInfo::name, DocHtmlRow::parseXml(), RetVal_OK, RetVal_TableRow, TK_HTMLTAG, TK_NEWPARA, TK_WHITESPACE, DocParserContext::token, DocParser::tokenizer, TRUE, XML_ITEM, XML_LIST , 以及 XML_LISTHEADER.

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

类成员变量说明

◆ m_attribs

HtmlAttribList DocHtmlTable::m_attribs
private

在文件 docparser.h1428 行定义.

被这些函数引用 attribs().

◆ m_caption

DocHtmlCaption* DocHtmlTable::m_caption = 0
private

在文件 docparser.h1427 行定义.

被这些函数引用 accept(), caption(), DocHtmlTable(), hasCaption(), parse() , 以及 ~DocHtmlTable().

◆ m_numCols

size_t DocHtmlTable::m_numCols = 0
private

在文件 docparser.h1429 行定义.

被这些函数引用 computeTableGrid(), DocHtmlTable() , 以及 numColumns().


该类的文档由以下文件生成:
TokenInfo::endTag
bool endTag
Definition: doctokenizer.h:100
DocHtmlRow::parse
int parse()
Definition: docparser.cpp:3425
DocHtmlCell::rowSpan
uint rowSpan() const
Definition: docparser.cpp:3341
DocParserContext::token
TokenInfo * token
Definition: docparser.cpp:129
DocHtmlCell::colSpan
uint colSpan() const
Definition: docparser.cpp:3353
DocParser::context
DocParserContext context
Definition: docparser.cpp:175
DocTokenizer::tokToString
static const char * tokToString(int token)
CompAccept< DocHtmlTable >
RowSpanList
std::vector< ActiveRowSpan > RowSpanList
List of ActiveRowSpan classes.
Definition: docparser.cpp:3671
TokenInfo::name
QCString name
Definition: doctokenizer.h:74
RetVal_OK
@ RetVal_OK
Command starting with \
Definition: doctokenizer.h:59
RetVal_EndTable
@ RetVal_EndTable
Definition: doctokenizer.h:75
RetVal_TableRow
@ RetVal_TableRow
Definition: doctokenizer.h:72
TokenInfo::attribs
HtmlAttribList attribs
Definition: doctokenizer.h:99
DocParser::tokenizer
DocTokenizer tokenizer
Definition: docparser.cpp:176
DocHtmlCaption::parse
int parse()
Definition: docparser.cpp:3225
DocHtmlTable::m_numCols
size_t m_numCols
Definition: docparser.h:1429
DocNode::Kind_HtmlCell
@ Kind_HtmlCell
Definition: docparser.h:123
warn_doc_error
void warn_doc_error(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:186
DocNode::Kind_HtmlRow
@ Kind_HtmlRow
Definition: docparser.h:122
CompAccept::accept
void accept(DocVisitor *v) override
Definition: docparser.h:200
TK_WHITESPACE
@ TK_WHITESPACE
Definition: doctokenizer.h:48
HTML_CAPTION
@ HTML_CAPTION
Definition: cmdmapper.h:153
DocHtmlTable::m_attribs
HtmlAttribList m_attribs
Definition: docparser.h:1428
DocHtmlCell::setRowIndex
void setRowIndex(uint idx)
Definition: docparser.h:1341
uint
unsigned uint
Definition: qcstring.h:40
Mappers::htmlTagMapper
static Mapper * htmlTagMapper
Definition: cmdmapper.h:235
DocParserContext::fileName
QCString fileName
Definition: docparser.cpp:110
DocHtmlTable::attribs
const HtmlAttribList & attribs() const
Definition: docparser.h:1414
DocHtmlCaption
Node representing a HTML table caption
Definition: docparser.h:1352
DocHtmlRow::setVisibleCells
void setVisibleCells(uint n)
Definition: docparser.h:1393
DocHtmlRow::setRowIndex
void setRowIndex(uint idx)
Definition: docparser.h:1398
DocNode::m_parser
DocParser & m_parser
Definition: docparser.h:184
DocTokenizer::getLineNr
int getLineNr(void)
DocHtmlTable::computeTableGrid
void computeTableGrid()
determines the location of all cells in a grid, resolving row and column spans.
Definition: docparser.cpp:3677
XML_LIST
@ XML_LIST
Definition: cmdmapper.h:199
TRUE
#define TRUE
Definition: qcstring.h:36
DocNode::Kind_HtmlTable
@ Kind_HtmlTable
Definition: docparser.h:121
XML_ITEM
@ XML_ITEM
Definition: cmdmapper.h:198
XML_LISTHEADER
@ XML_LISTHEADER
Definition: cmdmapper.h:200
DocHtmlTable::m_caption
DocHtmlCaption * m_caption
Definition: docparser.h:1427
DocVisitor::visitPost
virtual void visitPost(DocAutoList *)=0
TK_HTMLTAG
@ TK_HTMLTAG
Command starting with @
Definition: doctokenizer.h:52
DocHtmlCell::setColumnIndex
void setColumnIndex(uint idx)
Definition: docparser.h:1342
HTML_TR
@ HTML_TR
Definition: cmdmapper.h:160
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
DocHtmlRow::parseXml
int parseXml(bool header)
Definition: docparser.cpp:3489
AutoNodeStack
Definition: docparser.cpp:186
Mapper::map
int map(const QCString &n)
Definition: cmdmapper.cpp:237
CompAccept< DocHtmlTable >::children
const DocNodeList & children() const
Definition: docparser.h:207
DocTokenizer::lex
int lex()
TK_NEWPARA
@ TK_NEWPARA
Definition: doctokenizer.h:54
DocNode::parent
DocNode * parent() const
Definition: docparser.h:166
DocHtmlCell
Node representing a HTML table cell
Definition: docparser.h:1316
DBG
#define DBG(x)
Definition: docparser.cpp:58
CompAccept< DocHtmlTable >::m_children
DocNodeList m_children
Definition: docparser.h:211
DocHtmlRow
Node representing a HTML table row
Definition: docparser.h:1371
DocVisitor::visitPre
virtual void visitPre(DocAutoList *)=0
DocNode::m_parent
DocNode * m_parent
Definition: docparser.h:182
FALSE
#define FALSE
Definition: qcstring.h:33