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

#include <docparser.h>

Inheritance diagram for DocHtmlCell:
CompAccept< DocHtmlCell > DocNode

Public Types

enum  Alignment { Left, Right, Center }
 
- 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
}
 

Public Member Functions

 DocHtmlCell (DocNode *parent, const HtmlAttribList &attribs, bool isHeading)
 
bool isHeading () const
 
bool isFirst () const
 
bool isLast () const
 
Kind kind () const
 
void accept (DocVisitor *v)
 
void markFirst (bool v=TRUE)
 
void markLast (bool v=TRUE)
 
const HtmlAttribListattribs () const
 
int parse ()
 
int parseXml ()
 
int rowIndex () const
 
int columnIndex () const
 
int rowSpan () const
 
int colSpan () const
 
Alignment alignment () const
 
- Public Member Functions inherited from CompAccept< DocHtmlCell >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocHtmlCell *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)
 
void setColumnIndex (int idx)
 

Private Attributes

bool m_isHeading
 
bool m_isFirst
 
bool m_isLast
 
HtmlAttribList m_attribs
 
int m_rowIdx
 
int m_colIdx
 

Friends

class DocHtmlTable
 

Additional Inherited Members

- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 
- Protected Attributes inherited from CompAccept< DocHtmlCell >
QList< DocNodem_children
 
- Protected Attributes inherited from DocNode
DocNodem_parent
 

Detailed Description

Node representing a HTML table cell

Definition at line 1251 of file docparser.h.

Member Enumeration Documentation

Enumerator
Left 
Right 
Center 

Definition at line 1255 of file docparser.h.

Constructor & Destructor Documentation

DocHtmlCell::DocHtmlCell ( DocNode parent,
const HtmlAttribList attribs,
bool  isHeading 
)
inline

Definition at line 1256 of file docparser.h.

1256  :
1258  m_isFirst(FALSE), m_isLast(FALSE), m_attribs(attribs),
1259  m_rowIdx(-1), m_colIdx(-1) { m_parent = parent; }
DocNode * parent() const
Definition: docparser.h:147
HtmlAttribList m_attribs
Definition: docparser.h:1282
const bool FALSE
Definition: qglobal.h:370
bool m_isHeading
Definition: docparser.h:1279
bool m_isLast
Definition: docparser.h:1281
DocNode * m_parent
Definition: docparser.h:163
bool isHeading() const
Definition: docparser.h:1260
bool m_isFirst
Definition: docparser.h:1280

Member Function Documentation

void DocHtmlCell::accept ( DocVisitor v)
inlinevirtual

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

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 1264 of file docparser.h.

void accept(T *obj, DocVisitor *v)
Definition: docparser.h:177
DocHtmlCell::Alignment DocHtmlCell::alignment ( ) const

Definition at line 3465 of file docparser.cpp.

3466 {
3467  HtmlAttribList attrs = attribs();
3468  uint i;
3469  for (i=0; i<attrs.count(); ++i)
3470  {
3471  if (attrs.at(i)->name.lower()=="align")
3472  {
3473  if (attrs.at(i)->value.lower()=="center")
3474  return Center;
3475  else if (attrs.at(i)->value.lower()=="right")
3476  return Right;
3477  else return Left;
3478  }
3479  }
3480  return Left;
3481 }
const HtmlAttribList & attribs() const
Definition: docparser.h:1267
type * at(uint i) const
Definition: qlist.h:94
uint count() const
Definition: qlist.h:66
QCString value
Definition: htmlattrib.h:25
QCString name
Definition: htmlattrib.h:24
QCString lower() const
Definition: qcstring.cpp:263
A list of Html attributes.
Definition: htmlattrib.h:32
unsigned uint
Definition: qglobal.h:351
const HtmlAttribList& DocHtmlCell::attribs ( ) const
inline

Definition at line 1267 of file docparser.h.

1267 { return m_attribs; }
HtmlAttribList m_attribs
Definition: docparser.h:1282
int DocHtmlCell::colSpan ( ) const

Definition at line 3449 of file docparser.cpp.

3450 {
3451  int retval = 1;
3452  HtmlAttribList attrs = attribs();
3453  uint i;
3454  for (i=0; i<attrs.count(); ++i)
3455  {
3456  if (attrs.at(i)->name.lower()=="colspan")
3457  {
3458  retval = QMAX(1,attrs.at(i)->value.toInt());
3459  break;
3460  }
3461  }
3462  return retval;
3463 }
const HtmlAttribList & attribs() const
Definition: docparser.h:1267
type * at(uint i) const
Definition: qlist.h:94
uint count() const
Definition: qlist.h:66
#define QMAX(a, b)
Definition: qglobal.h:390
QCString value
Definition: htmlattrib.h:25
int toInt(bool *ok=0) const
Definition: qcstring.cpp:439
QCString name
Definition: htmlattrib.h:24
QCString lower() const
Definition: qcstring.cpp:263
A list of Html attributes.
Definition: htmlattrib.h:32
unsigned uint
Definition: qglobal.h:351
int DocHtmlCell::columnIndex ( ) const
inline

Definition at line 1271 of file docparser.h.

1271 { return m_colIdx; }
bool DocHtmlCell::isFirst ( ) const
inline

Definition at line 1261 of file docparser.h.

1261 { return m_isFirst; }
bool m_isFirst
Definition: docparser.h:1280
bool DocHtmlCell::isHeading ( ) const
inline

Definition at line 1260 of file docparser.h.

1260 { return m_isHeading; }
bool m_isHeading
Definition: docparser.h:1279
bool DocHtmlCell::isLast ( ) const
inline

Definition at line 1262 of file docparser.h.

1262 { return m_isLast; }
bool m_isLast
Definition: docparser.h:1281
Kind DocHtmlCell::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 1263 of file docparser.h.

void DocHtmlCell::markFirst ( bool  v = TRUE)
inline

Definition at line 1265 of file docparser.h.

1265 { m_isFirst=v; }
bool m_isFirst
Definition: docparser.h:1280
void DocHtmlCell::markLast ( bool  v = TRUE)
inline

Definition at line 1266 of file docparser.h.

1266 { m_isLast=v; }
bool m_isLast
Definition: docparser.h:1281
int DocHtmlCell::parse ( )

Definition at line 3359 of file docparser.cpp.

3360 {
3361  int retval=RetVal_OK;
3362  g_nodeStack.push(this);
3363  DBG(("DocHtmlCell::parse() start\n"));
3364 
3365  // parse one or more paragraphs
3366  bool isFirst=TRUE;
3367  DocPara *par=0;
3368  do
3369  {
3370  par = new DocPara(this);
3371  if (isFirst) { par->markFirst(); isFirst=FALSE; }
3372  m_children.append(par);
3373  retval=par->parse();
3374  if (retval==TK_HTMLTAG)
3375  {
3376  int tagId=Mappers::htmlTagMapper->map(g_token->name);
3377  if (tagId==HTML_TD && g_token->endTag) // found </dt> tag
3378  {
3379  retval=TK_NEWPARA; // ignore the tag
3380  }
3381  else if (tagId==HTML_TH && g_token->endTag) // found </th> tag
3382  {
3383  retval=TK_NEWPARA; // ignore the tag
3384  }
3385  }
3386  }
3387  while (retval==TK_NEWPARA);
3388  if (par) par->markLast();
3389 
3390  DBG(("DocHtmlCell::parse() end\n"));
3391  DocNode *n=g_nodeStack.pop();
3392  ASSERT(n==this);
3393  return retval;
3394 }
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
const bool FALSE
Definition: qglobal.h:370
void markFirst(bool v=TRUE)
Definition: docparser.h:1122
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
void push(const type *d)
Definition: qstack.h:58
std::void_t< T > n
void markLast(bool v=TRUE)
Definition: docparser.h:1123
int parse()
Definition: docparser.cpp:6348
bool isFirst() const
Definition: docparser.h:1261
int map(const char *n)
Definition: cmdmapper.cpp:225
type * pop()
Definition: qstack.h:59
QCString name
Definition: doctokenizer.h:77
const bool TRUE
Definition: qglobal.h:371
#define ASSERT(x)
Definition: qglobal.h:590
int DocHtmlCell::parseXml ( )

Definition at line 3396 of file docparser.cpp.

3397 {
3398  int retval=RetVal_OK;
3399  g_nodeStack.push(this);
3400  DBG(("DocHtmlCell::parseXml() start\n"));
3401 
3402  // parse one or more paragraphs
3403  bool isFirst=TRUE;
3404  DocPara *par=0;
3405  do
3406  {
3407  par = new DocPara(this);
3408  if (isFirst) { par->markFirst(); isFirst=FALSE; }
3409  m_children.append(par);
3410  retval=par->parse();
3411  if (retval==TK_HTMLTAG)
3412  {
3413  int tagId=Mappers::htmlTagMapper->map(g_token->name);
3414  if (tagId==XML_ITEM && g_token->endTag) // found </item> tag
3415  {
3416  retval=TK_NEWPARA; // ignore the tag
3417  }
3418  else if (tagId==XML_DESCRIPTION && g_token->endTag) // found </description> tag
3419  {
3420  retval=TK_NEWPARA; // ignore the tag
3421  }
3422  }
3423  }
3424  while (retval==TK_NEWPARA);
3425  if (par) par->markLast();
3426 
3427  DBG(("DocHtmlCell::parseXml() end\n"));
3428  DocNode *n=g_nodeStack.pop();
3429  ASSERT(n==this);
3430  return retval;
3431 }
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
const bool FALSE
Definition: qglobal.h:370
void markFirst(bool v=TRUE)
Definition: docparser.h:1122
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
void push(const type *d)
Definition: qstack.h:58
std::void_t< T > n
void markLast(bool v=TRUE)
Definition: docparser.h:1123
int parse()
Definition: docparser.cpp:6348
bool isFirst() const
Definition: docparser.h:1261
int map(const char *n)
Definition: cmdmapper.cpp:225
type * pop()
Definition: qstack.h:59
QCString name
Definition: doctokenizer.h:77
const bool TRUE
Definition: qglobal.h:371
#define ASSERT(x)
Definition: qglobal.h:590
int DocHtmlCell::rowIndex ( ) const
inline

Definition at line 1270 of file docparser.h.

1270 { return m_rowIdx; }
int DocHtmlCell::rowSpan ( ) const

Definition at line 3433 of file docparser.cpp.

3434 {
3435  int retval = 0;
3436  HtmlAttribList attrs = attribs();
3437  uint i;
3438  for (i=0; i<attrs.count(); ++i)
3439  {
3440  if (attrs.at(i)->name.lower()=="rowspan")
3441  {
3442  retval = attrs.at(i)->value.toInt();
3443  break;
3444  }
3445  }
3446  return retval;
3447 }
const HtmlAttribList & attribs() const
Definition: docparser.h:1267
type * at(uint i) const
Definition: qlist.h:94
uint count() const
Definition: qlist.h:66
QCString value
Definition: htmlattrib.h:25
int toInt(bool *ok=0) const
Definition: qcstring.cpp:439
QCString name
Definition: htmlattrib.h:24
QCString lower() const
Definition: qcstring.cpp:263
A list of Html attributes.
Definition: htmlattrib.h:32
unsigned uint
Definition: qglobal.h:351
void DocHtmlCell::setColumnIndex ( int  idx)
inlineprivate

Definition at line 1278 of file docparser.h.

1278 { m_colIdx = idx; }
void DocHtmlCell::setRowIndex ( int  idx)
inlineprivate

Definition at line 1277 of file docparser.h.

1277 { m_rowIdx = idx; }

Friends And Related Function Documentation

friend class DocHtmlTable
friend

Definition at line 1253 of file docparser.h.

Member Data Documentation

HtmlAttribList DocHtmlCell::m_attribs
private

Definition at line 1282 of file docparser.h.

int DocHtmlCell::m_colIdx
private

Definition at line 1284 of file docparser.h.

bool DocHtmlCell::m_isFirst
private

Definition at line 1280 of file docparser.h.

bool DocHtmlCell::m_isHeading
private

Definition at line 1279 of file docparser.h.

bool DocHtmlCell::m_isLast
private

Definition at line 1281 of file docparser.h.

int DocHtmlCell::m_rowIdx
private

Definition at line 1283 of file docparser.h.


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