Skip to main content

The DocHtmlCell Class Reference

Node representing a HTML table cell. More...

Declaration

class DocHtmlCell { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocCompoundNode

Base class for nodes with children. More...

Enumerations Index

enumAlignment { ... }
enumValignment { ... }

Friends Index

classDocHtmlTable

Public Constructors Index

DocHtmlCell (DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, bool isHeading)

Public Member Functions Index

boolisHeading () const
boolisFirst () const
boolisLast () const
voidmarkFirst (bool v=TRUE)
voidmarkLast (bool v=TRUE)
const HtmlAttribList &attribs () const
Tokenparse ()
TokenparseXml ()
uint32_trowIndex () const
uint32_tcolumnIndex () const
uint32_trowSpan () const
uint32_tcolSpan () const
Alignmentalignment () const
Valignmentvalignment () const

Private Member Functions Index

voidsetRowIndex (uint32_t idx)
voidsetColumnIndex (uint32_t idx)

Private Member Attributes Index

boolm_isHeading = false
boolm_isFirst = false
boolm_isLast = false
HtmlAttribListm_attribs
uint32_tm_rowIdx = static_cast<uint32_t>(-1)
uint32_tm_colIdx = static_cast<uint32_t>(-1)

Description

Node representing a HTML table cell.

Definition at line 1192 of file docnode.h.

Enumerations

Alignment

enum DocHtmlCell::Alignment
Enumeration values
Left
Right
Center

Definition at line 1196 of file docnode.h.

Valignment

enum DocHtmlCell::Valignment
Enumeration values
Top
Middle
Bottom

Definition at line 1197 of file docnode.h.

Friends

DocHtmlTable

friend class DocHtmlTable

Definition at line 1194 of file docnode.h.

1194 friend class DocHtmlTable;

Reference DocHtmlTable.

Referenced by DocHtmlTable.

Public Constructors

DocHtmlCell()

DocHtmlCell::DocHtmlCell (DocParser * parser, DocNodeVariant * parent, const HtmlAttribList & attribs, bool isHeading)
inline

Public Member Functions

alignment()

DocHtmlCell::Alignment DocHtmlCell::alignment ()

Declaration at line 1212 of file docnode.h, definition at line 1862 of file docnode.cpp.

1863{
1864 for (const auto &attr : attribs())
1865 {
1866 QCString attrName = attr.name.lower();
1867 QCString attrValue = attr.value.lower();
1868 if (attrName=="align")
1869 {
1870 if (attrValue=="center")
1871 return Center;
1872 else if (attrValue=="right")
1873 return Right;
1874 else return Left;
1875 }
1876 else if (attrName=="class" && attrValue.startsWith("markdowntable"))
1877 {
1878 if (attrValue=="markdowntableheadcenter")
1879 return Center;
1880 else if (attrValue=="markdowntableheadright")
1881 return Right;
1882 else if (attrValue=="markdowntableheadleft")
1883 return Left;
1884 else if (attrValue=="markdowntableheadnone")
1885 return Center;
1886 else if (attrValue=="markdowntablebodycenter")
1887 return Center;
1888 else if (attrValue=="markdowntablebodyright")
1889 return Right;
1890 else if (attrValue=="markdowntablebodyleft")
1891 return Left;
1892 else if (attrValue=="markdowntablebodynone")
1893 return Left;
1894 else return Left;
1895 }
1896 }
1897 return Left;
1898}

References attribs, Center, Left, QCString::lower, Right and QCString::startsWith.

Referenced by LatexDocVisitor::operator().

attribs()

const HtmlAttribList & DocHtmlCell::attribs ()
inline

colSpan()

uint32_t DocHtmlCell::colSpan ()

Declaration at line 1211 of file docnode.h, definition at line 1850 of file docnode.cpp.

1850uint32_t DocHtmlCell::colSpan() const
1851{
1852 for (const auto &attr : attribs())
1853 {
1854 if (attr.name.lower()=="colspan")
1855 {
1856 return std::max(1u,attr.value.toUInt());
1857 }
1858 }
1859 return 1;
1860}

Reference attribs.

Referenced by DocHtmlTable::computeTableGrid and LatexDocVisitor::operator().

columnIndex()

uint32_t DocHtmlCell::columnIndex ()
inline

Definition at line 1209 of file docnode.h.

1209 uint32_t columnIndex() const { return m_colIdx; }

Reference m_colIdx.

Referenced by LatexDocVisitor::operator().

isFirst()

bool DocHtmlCell::isFirst ()
inline

Definition at line 1201 of file docnode.h.

1201 bool isFirst() const { return m_isFirst; }

Reference m_isFirst.

Referenced by parse and parseXml.

isHeading()

bool DocHtmlCell::isHeading ()
inline

isLast()

bool DocHtmlCell::isLast ()
inline

Definition at line 1202 of file docnode.h.

1202 bool isLast() const { return m_isLast; }

Reference m_isLast.

Referenced by LatexDocVisitor::operator().

markFirst()

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

Definition at line 1203 of file docnode.h.

1203 void markFirst(bool v=TRUE) { m_isFirst=v; }

References m_isFirst and TRUE.

Referenced by DocHtmlRow::parse and DocHtmlRow::parseXml.

markLast()

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

Definition at line 1204 of file docnode.h.

1204 void markLast(bool v=TRUE) { m_isLast=v; }

References m_isLast and TRUE.

Referenced by DocHtmlRow::parse and DocHtmlRow::parseXml.

parse()

Token DocHtmlCell::parse ()

Declaration at line 1206 of file docnode.h, definition at line 1770 of file docnode.cpp.

1771{
1772 AUTO_TRACE();
1773 Token retval = Token::make_RetVal_OK();
1774 auto ns = AutoNodeStack(parser(),thisVariant());
1775
1776 // parse one or more paragraphs
1777 bool isFirst=TRUE;
1778 DocPara *par=nullptr;
1779 do
1780 {
1782 par = children().get_last<DocPara>();
1783 if (isFirst) { par->markFirst(); isFirst=FALSE; }
1784 retval=par->parse();
1785 if (retval.is(TokenRetval::TK_HTMLTAG))
1786 {
1787 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
1788 if (tagId==HtmlTagType::HTML_TD && parser()->context.token->endTag) // found </td> tag
1789 {
1790 retval = Token::make_TK_NEWPARA(); // ignore the tag
1791 }
1792 else if (tagId==HtmlTagType::HTML_TH && parser()->context.token->endTag) // found </th> tag
1793 {
1794 retval = Token::make_TK_NEWPARA(); // ignore the tag
1795 }
1796 }
1797 }
1798 while (retval.is_any_of(TokenRetval::TK_NEWPARA,TokenRetval::RetVal_EndParBlock));
1799 if (par) par->markLast();
1800
1801 return retval;
1802}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, FALSE, DocNodeList::get_last, HTML_TD, HTML_TH, Mappers::htmlTagMapper, Token::is, Token::is_any_of, isFirst, DocPara::markFirst, DocPara::markLast, DocPara::parse, DocNode::parser, DocNode::thisVariant and TRUE.

Referenced by DocHtmlRow::parse.

parseXml()

Token DocHtmlCell::parseXml ()

Declaration at line 1207 of file docnode.h, definition at line 1804 of file docnode.cpp.

1805{
1806 AUTO_TRACE();
1807 Token retval = Token::make_RetVal_OK();
1808 auto ns = AutoNodeStack(parser(),thisVariant());
1809
1810 // parse one or more paragraphs
1811 bool isFirst=TRUE;
1812 DocPara *par=nullptr;
1813 do
1814 {
1816 par = children().get_last<DocPara>();
1817 if (isFirst) { par->markFirst(); isFirst=FALSE; }
1818 retval=par->parse();
1819 if (retval.is(TokenRetval::TK_HTMLTAG))
1820 {
1821 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
1822 if (tagId==HtmlTagType::XML_ITEM && parser()->context.token->endTag) // found </item> tag
1823 {
1824 retval = Token::make_TK_NEWPARA(); // ignore the tag
1825 }
1826 else if (tagId==HtmlTagType::XML_DESCRIPTION && parser()->context.token->endTag) // found </description> tag
1827 {
1828 retval = Token::make_TK_NEWPARA(); // ignore the tag
1829 }
1830 }
1831 }
1832 while (retval.is(TokenRetval::TK_NEWPARA));
1833 if (par) par->markLast();
1834
1835 return retval;
1836}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, FALSE, DocNodeList::get_last, Mappers::htmlTagMapper, Token::is, isFirst, DocPara::markFirst, DocPara::markLast, DocPara::parse, DocNode::parser, DocNode::thisVariant, TRUE, XML_DESCRIPTION and XML_ITEM.

Referenced by DocHtmlRow::parseXml.

rowIndex()

uint32_t DocHtmlCell::rowIndex ()
inline

Definition at line 1208 of file docnode.h.

1208 uint32_t rowIndex() const { return m_rowIdx; }

Reference m_rowIdx.

rowSpan()

uint32_t DocHtmlCell::rowSpan ()

Declaration at line 1210 of file docnode.h, definition at line 1838 of file docnode.cpp.

1838uint32_t DocHtmlCell::rowSpan() const
1839{
1840 for (const auto &attr : attribs())
1841 {
1842 if (attr.name.lower()=="rowspan")
1843 {
1844 return attr.value.toUInt();
1845 }
1846 }
1847 return 0;
1848}

Reference attribs.

Referenced by DocHtmlTable::computeTableGrid and LatexDocVisitor::operator().

valignment()

DocHtmlCell::Valignment DocHtmlCell::valignment ()

Declaration at line 1213 of file docnode.h, definition at line 1900 of file docnode.cpp.

1901{
1902 for (const auto &attr : attribs())
1903 {
1904 QCString attrName = attr.name.lower();
1905 QCString attrValue = attr.value.lower();
1906 if (attrName=="valign")
1907 {
1908 if (attrValue=="top")
1909 return Top;
1910 else if (attrValue=="bottom")
1911 return Bottom;
1912 else if (attrValue=="middle")
1913 return Middle;
1914 else return Middle;
1915 }
1916 }
1917 return Middle;
1918}

References attribs, Bottom, QCString::lower, Middle and Top.

Referenced by LatexDocVisitor::operator().

Private Member Functions

setColumnIndex()

void DocHtmlCell::setColumnIndex (uint32_t idx)
inline

Definition at line 1217 of file docnode.h.

1217 void setColumnIndex(uint32_t idx) { m_colIdx = idx; }

Reference m_colIdx.

Referenced by DocHtmlTable::computeTableGrid.

setRowIndex()

void DocHtmlCell::setRowIndex (uint32_t idx)
inline

Definition at line 1216 of file docnode.h.

1216 void setRowIndex(uint32_t idx) { m_rowIdx = idx; }

Reference m_rowIdx.

Referenced by DocHtmlTable::computeTableGrid.

Private Member Attributes

m_attribs

HtmlAttribList DocHtmlCell::m_attribs

Definition at line 1221 of file docnode.h.

Referenced by attribs and DocHtmlCell.

m_colIdx

uint32_t DocHtmlCell::m_colIdx = static_cast<uint32_t>(-1)

Definition at line 1223 of file docnode.h.

1223 uint32_t m_colIdx = static_cast<uint32_t>(-1);

Referenced by columnIndex and setColumnIndex.

m_isFirst

bool DocHtmlCell::m_isFirst = false

Definition at line 1219 of file docnode.h.

1219 bool m_isFirst = false;

Referenced by isFirst and markFirst.

m_isHeading

bool DocHtmlCell::m_isHeading = false

Definition at line 1218 of file docnode.h.

1218 bool m_isHeading = false;

Referenced by DocHtmlCell and isHeading.

m_isLast

bool DocHtmlCell::m_isLast = false

Definition at line 1220 of file docnode.h.

1220 bool m_isLast = false;

Referenced by isLast and markLast.

m_rowIdx

uint32_t DocHtmlCell::m_rowIdx = static_cast<uint32_t>(-1)

Definition at line 1222 of file docnode.h.

1222 uint32_t m_rowIdx = static_cast<uint32_t>(-1);

Referenced by rowIndex and setRowIndex.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.