My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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.

References DocNode::m_parent, and DocNode::parent().

:
m_attribs(attribs), m_visibleCells(-1), m_rowIdx(-1) { m_parent = parent; }

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.

References CompAccept< T >::accept().

Referenced by LatexDocVisitor::visitPre().

const HtmlAttribList& DocHtmlRow::attribs ( ) const
inline

Definition at line 1317 of file docparser.h.

References m_attribs.

Referenced by HtmlDocVisitor::visitPre().

{ return m_attribs; }
bool DocHtmlRow::isHeading ( ) const
inline

Definition at line 1320 of file docparser.h.

References DocNode::kind(), DocNode::Kind_HtmlCell, and CompAccept< DocHtmlRow >::m_children.

Referenced by parse(), LatexDocVisitor::visitPost(), LatexDocVisitor::visitPre(), and RTFDocVisitor::visitPre().

{ // a row is a table heading if all cells are marked as such
bool heading=TRUE;
QListIterator<DocNode> it(m_children);
DocNode *n;
for (;(n=it.current());++it)
{
if (n->kind()==Kind_HtmlCell)
{
heading = heading && ((DocHtmlCell*)n)->isHeading();
}
}
return m_children.count()>0 && heading;
}
Kind DocHtmlRow::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 1314 of file docparser.h.

References DocNode::Kind_HtmlRow.

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

Definition at line 1315 of file docparser.h.

References CompAccept< DocHtmlRow >::m_children.

Referenced by RTFDocVisitor::visitPre().

{ return m_children.count(); }
int DocHtmlRow::parse ( )

Definition at line 3501 of file docparser.cpp.

References TokenInfo::attribs, DBG, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYpushBackHtmlTag(), TokenInfo::endTag, g_fileName, g_nodeStack, g_token, HTML_TD, HTML_TH, Mappers::htmlTagMapper, isHeading(), CompAccept< DocHtmlRow >::m_children, Mapper::map(), DocHtmlCell::markFirst(), DocHtmlCell::markLast(), TokenInfo::name, DocHtmlCell::parse(), RetVal_OK, RetVal_TableCell, RetVal_TableHCell, TK_HTMLTAG, TK_NEWPARA, TK_WHITESPACE, tokToString(), and warn_doc_error().

Referenced by DocHtmlTable::parse().

{
int retval=RetVal_OK;
g_nodeStack.push(this);
DBG(("DocHtmlRow::parse() start\n"));
bool isHeading=FALSE;
bool isFirst=TRUE;
DocHtmlCell *cell=0;
// get next token
int tok=doctokenizerYYlex();
// skip whitespace
while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex();
// should find a html tag now
if (tok==TK_HTMLTAG)
{
if (tagId==HTML_TD && !g_token->endTag) // found <td> tag
{
}
else if (tagId==HTML_TH && !g_token->endTag) // found <th> tag
{
isHeading=TRUE;
}
else // found some other tag
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <td> or <th> tag but "
"found <%s> instead!",qPrint(g_token->name));
goto endrow;
}
}
else if (tok==0) // premature end of comment
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment while looking"
" for a html description title");
goto endrow;
}
else // token other than html token
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <td> or <th> tag but found %s token instead!",
tokToString(tok));
goto endrow;
}
// parse one or more cells
do
{
cell=new DocHtmlCell(this,g_token->attribs,isHeading);
cell->markFirst(isFirst);
isFirst=FALSE;
m_children.append(cell);
retval=cell->parse();
isHeading = retval==RetVal_TableHCell;
}
while (retval==RetVal_TableCell || retval==RetVal_TableHCell);
if (cell) cell->markLast(TRUE);
endrow:
DBG(("DocHtmlRow::parse() end\n"));
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
return retval;
}
int DocHtmlRow::parseXml ( bool  header)

Definition at line 3567 of file docparser.cpp.

References TokenInfo::attribs, DBG, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYpushBackHtmlTag(), TokenInfo::endTag, g_fileName, g_nodeStack, g_token, Mappers::htmlTagMapper, CompAccept< DocHtmlRow >::m_children, Mapper::map(), DocHtmlCell::markFirst(), DocHtmlCell::markLast(), TokenInfo::name, DocHtmlCell::parseXml(), RetVal_OK, RetVal_TableCell, RetVal_TableHCell, TK_HTMLTAG, TK_NEWPARA, TK_WHITESPACE, tokToString(), warn_doc_error(), XML_DESCRIPTION, and XML_TERM.

Referenced by DocHtmlTable::parseXml().

{
int retval=RetVal_OK;
g_nodeStack.push(this);
DBG(("DocHtmlRow::parseXml() start\n"));
bool isFirst=TRUE;
DocHtmlCell *cell=0;
// get next token
int tok=doctokenizerYYlex();
// skip whitespace
while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex();
// should find a html tag now
if (tok==TK_HTMLTAG)
{
if (tagId==XML_TERM && !g_token->endTag) // found <term> tag
{
}
else if (tagId==XML_DESCRIPTION && !g_token->endTag) // found <description> tag
{
}
else // found some other tag
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <term> or <description> tag but "
"found <%s> instead!",qPrint(g_token->name));
goto endrow;
}
}
else if (tok==0) // premature end of comment
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment while looking"
" for a html description title");
goto endrow;
}
else // token other than html token
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <td> or <th> tag but found %s token instead!",
tokToString(tok));
goto endrow;
}
do
{
cell->markFirst(isFirst);
isFirst=FALSE;
m_children.append(cell);
retval=cell->parseXml();
}
while (retval==RetVal_TableCell || retval==RetVal_TableHCell);
if (cell) cell->markLast(TRUE);
endrow:
DBG(("DocHtmlRow::parseXml() end\n"));
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
return retval;
}
int DocHtmlRow::rowIndex ( ) const
inline

Definition at line 1335 of file docparser.h.

References m_rowIdx.

Referenced by LatexDocVisitor::visitPost().

{ return m_rowIdx; }
void DocHtmlRow::setRowIndex ( int  idx)
inlineprivate

Definition at line 1338 of file docparser.h.

References m_rowIdx.

Referenced by DocHtmlTable::computeTableGrid().

{ m_rowIdx = idx; }
void DocHtmlRow::setVisibleCells ( int  n)
inline

Definition at line 1333 of file docparser.h.

References m_visibleCells.

Referenced by DocHtmlTable::computeTableGrid().

int DocHtmlRow::visibleCells ( ) const
inline

Definition at line 1334 of file docparser.h.

References m_visibleCells.

Referenced by LatexDocVisitor::visitPost(), and LatexDocVisitor::visitPre().

{ return m_visibleCells; }

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.

Referenced by attribs().

int DocHtmlRow::m_rowIdx
private

Definition at line 1341 of file docparser.h.

Referenced by rowIndex(), and setRowIndex().

int DocHtmlRow::m_visibleCells
private

Definition at line 1340 of file docparser.h.

Referenced by setVisibleCells(), and visibleCells().


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