Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
DocHtmlRow Class Reference

#include <docparser.h>

Inheritance diagram for DocHtmlRow:
CompAccept< DocHtmlRow > DocNode

Public Member Functions

 DocHtmlRow (DocNode *parent, const HtmlAttribList &attribs)
 
Kind kind () const
 
uint numCells () const
 
void accept (DocVisitor *v)
 
const HtmlAttribListattribs () const
 
int parse ()
 
int parseXml (bool header)
 
bool isHeading () const
 
void setVisibleCells (int n)
 
int visibleCells () const
 
int rowIndex () const
 
- Public Member Functions inherited from CompAccept< DocHtmlRow >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocHtmlRow *obj, DocVisitor *v)
 
const QList< DocNode > & children () const
 
QList< DocNode > & children ()
 
- Public Member Functions inherited from DocNode
 DocNode ()
 
virtual ~DocNode ()
 
DocNodeparent () const
 
void setParent (DocNode *parent)
 
bool isPreformatted () const
 

Private Member Functions

void setRowIndex (int idx)
 

Private Attributes

HtmlAttribList m_attribs
 
int m_visibleCells
 
int m_rowIdx
 

Friends

class DocHtmlTable
 

Additional Inherited Members

- Public Types inherited from 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
}
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 
- Protected Attributes inherited from CompAccept< DocHtmlRow >
QList< DocNodem_children
 
- Protected Attributes inherited from DocNode
DocNodem_parent
 

Detailed Description

Node representing a HTML table row

Definition at line 1308 of file docparser.h.

Constructor & Destructor Documentation

DocHtmlRow::DocHtmlRow ( DocNode parent,
const HtmlAttribList attribs 
)
inline

Definition at line 1312 of file docparser.h.

1312  :
1313  m_attribs(attribs), m_visibleCells(-1), m_rowIdx(-1) { m_parent = parent; }
DocNode * parent() const
Definition: docparser.h:147
int m_rowIdx
Definition: docparser.h:1341
DocNode * m_parent
Definition: docparser.h:163
int m_visibleCells
Definition: docparser.h:1340
HtmlAttribList m_attribs
Definition: docparser.h:1339

Member Function Documentation

void DocHtmlRow::accept ( DocVisitor v)
inlinevirtual

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

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 1316 of file docparser.h.

1316 { CompAccept<DocHtmlRow>::accept(this,v); }
void accept(T *obj, DocVisitor *v)
Definition: docparser.h:177
const HtmlAttribList& DocHtmlRow::attribs ( ) const
inline

Definition at line 1317 of file docparser.h.

1317 { return m_attribs; }
HtmlAttribList m_attribs
Definition: docparser.h:1339
bool DocHtmlRow::isHeading ( ) const
inline

Definition at line 1320 of file docparser.h.

1320  { // a row is a table heading if all cells are marked as such
1321  bool heading=TRUE;
1323  DocNode *n;
1324  for (;(n=it.current());++it)
1325  {
1326  if (n->kind()==Kind_HtmlCell)
1327  {
1328  heading = heading && ((DocHtmlCell*)n)->isHeading();
1329  }
1330  }
1331  return m_children.count()>0 && heading;
1332  }
QList< DocNode > m_children
Definition: docparser.h:189
virtual Kind kind() const =0
uint count() const
Definition: qlist.h:66
std::void_t< T > n
const bool TRUE
Definition: qglobal.h:371
Kind DocHtmlRow::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 1314 of file docparser.h.

1314 { return Kind_HtmlRow; }
uint DocHtmlRow::numCells ( ) const
inline

Definition at line 1315 of file docparser.h.

1315 { return m_children.count(); }
QList< DocNode > m_children
Definition: docparser.h:189
uint count() const
Definition: qlist.h:66
int DocHtmlRow::parse ( )

Definition at line 3486 of file docparser.cpp.

3487 {
3488  int retval=RetVal_OK;
3489  g_nodeStack.push(this);
3490  DBG(("DocHtmlRow::parse() start\n"));
3491 
3492  bool isHeading=FALSE;
3493  bool isFirst=TRUE;
3494  DocHtmlCell *cell=0;
3495 
3496  // get next token
3497  int tok=doctokenizerYYlex();
3498  // skip whitespace
3499  while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex();
3500  // should find a html tag now
3501  if (tok==TK_HTMLTAG)
3502  {
3503  int tagId=Mappers::htmlTagMapper->map(g_token->name);
3504  if (tagId==HTML_TD && !g_token->endTag) // found <td> tag
3505  {
3506  }
3507  else if (tagId==HTML_TH && !g_token->endTag) // found <th> tag
3508  {
3509  isHeading=TRUE;
3510  }
3511  else // found some other tag
3512  {
3513  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <td> or <th> tag but "
3514  "found <%s> instead!",qPrint(g_token->name));
3516  goto endrow;
3517  }
3518  }
3519  else if (tok==0) // premature end of comment
3520  {
3521  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment while looking"
3522  " for a html description title");
3523  goto endrow;
3524  }
3525  else // token other than html token
3526  {
3527  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <td> or <th> tag but found %s token instead!",
3528  tokToString(tok));
3529  goto endrow;
3530  }
3531 
3532  // parse one or more cells
3533  do
3534  {
3535  cell=new DocHtmlCell(this,g_token->attribs,isHeading);
3536  cell->markFirst(isFirst);
3537  isFirst=FALSE;
3538  m_children.append(cell);
3539  retval=cell->parse();
3540  isHeading = retval==RetVal_TableHCell;
3541  }
3542  while (retval==RetVal_TableCell || retval==RetVal_TableHCell);
3543  if (cell) cell->markLast(TRUE);
3544 
3545 endrow:
3546  DBG(("DocHtmlRow::parse() end\n"));
3547  DocNode *n=g_nodeStack.pop();
3548  ASSERT(n==this);
3549  return retval;
3550 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void markLast(bool v=TRUE)
Definition: docparser.h:1266
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
bool isHeading() const
Definition: docparser.h:1320
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
int doctokenizerYYlex(void)
void push(const type *d)
Definition: qstack.h:58
void markFirst(bool v=TRUE)
Definition: docparser.h:1265
void doctokenizerYYpushBackHtmlTag(const char *tag)
std::void_t< T > n
int map(const char *n)
Definition: cmdmapper.cpp:225
type * pop()
Definition: qstack.h:59
HtmlAttribList attribs
Definition: doctokenizer.h:102
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
#define ASSERT(x)
Definition: qglobal.h:590
int DocHtmlRow::parseXml ( bool  header)

Definition at line 3552 of file docparser.cpp.

3553 {
3554  int retval=RetVal_OK;
3555  g_nodeStack.push(this);
3556  DBG(("DocHtmlRow::parseXml() start\n"));
3557 
3558  bool isFirst=TRUE;
3559  DocHtmlCell *cell=0;
3560 
3561  // get next token
3562  int tok=doctokenizerYYlex();
3563  // skip whitespace
3564  while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex();
3565  // should find a html tag now
3566  if (tok==TK_HTMLTAG)
3567  {
3568  int tagId=Mappers::htmlTagMapper->map(g_token->name);
3569  if (tagId==XML_TERM && !g_token->endTag) // found <term> tag
3570  {
3571  }
3572  else if (tagId==XML_DESCRIPTION && !g_token->endTag) // found <description> tag
3573  {
3574  }
3575  else // found some other tag
3576  {
3577  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <term> or <description> tag but "
3578  "found <%s> instead!",qPrint(g_token->name));
3580  goto endrow;
3581  }
3582  }
3583  else if (tok==0) // premature end of comment
3584  {
3585  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment while looking"
3586  " for a html description title");
3587  goto endrow;
3588  }
3589  else // token other than html token
3590  {
3591  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <td> or <th> tag but found %s token instead!",
3592  tokToString(tok));
3593  goto endrow;
3594  }
3595 
3596  do
3597  {
3598  cell=new DocHtmlCell(this,g_token->attribs,isHeading);
3599  cell->markFirst(isFirst);
3600  isFirst=FALSE;
3601  m_children.append(cell);
3602  retval=cell->parseXml();
3603  }
3604  while (retval==RetVal_TableCell || retval==RetVal_TableHCell);
3605  if (cell) cell->markLast(TRUE);
3606 
3607 endrow:
3608  DBG(("DocHtmlRow::parseXml() end\n"));
3609  DocNode *n=g_nodeStack.pop();
3610  ASSERT(n==this);
3611  return retval;
3612 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void markLast(bool v=TRUE)
Definition: docparser.h:1266
int parseXml()
Definition: docparser.cpp:3396
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
bool isHeading() const
Definition: docparser.h:1320
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
int doctokenizerYYlex(void)
void push(const type *d)
Definition: qstack.h:58
void markFirst(bool v=TRUE)
Definition: docparser.h:1265
void doctokenizerYYpushBackHtmlTag(const char *tag)
std::void_t< T > n
int map(const char *n)
Definition: cmdmapper.cpp:225
type * pop()
Definition: qstack.h:59
HtmlAttribList attribs
Definition: doctokenizer.h:102
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
#define ASSERT(x)
Definition: qglobal.h:590
int DocHtmlRow::rowIndex ( ) const
inline

Definition at line 1335 of file docparser.h.

1335 { return m_rowIdx; }
int m_rowIdx
Definition: docparser.h:1341
void DocHtmlRow::setRowIndex ( int  idx)
inlineprivate

Definition at line 1338 of file docparser.h.

1338 { m_rowIdx = idx; }
int m_rowIdx
Definition: docparser.h:1341
void DocHtmlRow::setVisibleCells ( int  n)
inline

Definition at line 1333 of file docparser.h.

1333 { m_visibleCells = n; }
std::void_t< T > n
int m_visibleCells
Definition: docparser.h:1340
int DocHtmlRow::visibleCells ( ) const
inline

Definition at line 1334 of file docparser.h.

1334 { return m_visibleCells; }
int m_visibleCells
Definition: docparser.h:1340

Friends And Related Function Documentation

friend class DocHtmlTable
friend

Definition at line 1310 of file docparser.h.

Member Data Documentation

HtmlAttribList DocHtmlRow::m_attribs
private

Definition at line 1339 of file docparser.h.

int DocHtmlRow::m_rowIdx
private

Definition at line 1341 of file docparser.h.

int DocHtmlRow::m_visibleCells
private

Definition at line 1340 of file docparser.h.


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