Doxygen
Loading...
Searching...
No Matches
DocHtmlCaption Class Reference

Node representing a HTML table caption. More...

#include <src/docnode.h>

+ Inheritance diagram for DocHtmlCaption:
+ Collaboration diagram for DocHtmlCaption:

Public Member Functions

 DocHtmlCaption (DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
 
const HtmlAttribListattribs () const
 
Token parse ()
 
bool hasCaptionId () const
 
QCString file () const
 
QCString anchor () const
 
- Public Member Functions inherited from DocCompoundNode
 DocCompoundNode (DocParser *parser, DocNodeVariant *parent)
 
DocNodeListchildren ()
 
const DocNodeListchildren () const
 
- Public Member Functions inherited from DocNode
 DocNode (DocParser *parser, DocNodeVariant *parent)
 
 ~DocNode ()=default
 
DocNodeVariantparent ()
 
const DocNodeVariantparent () const
 
DocNodeVariantthisVariant ()
 
const DocNodeVariantthisVariant () const
 
void setThisVariant (DocNodeVariant *thisVariant)
 
DocParserparser ()
 
const DocParserparser () const
 
void setParent (DocNodeVariant *parent)
 
bool isPreformatted () const
 

Private Attributes

HtmlAttribList m_attribs
 
bool m_hasCaptionId = false
 
QCString m_file
 
QCString m_anchor
 

Additional Inherited Members

- Protected Types inherited from DocNode
enum  RefType { Unknown , Anchor , Section , Table }
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 

Detailed Description

Node representing a HTML table caption.

Definition at line 1221 of file docnode.h.

Constructor & Destructor Documentation

◆ DocHtmlCaption()

DocHtmlCaption::DocHtmlCaption ( DocParser * parser,
DocNodeVariant * parent,
const HtmlAttribList & attribs )

Definition at line 1666 of file docnode.cpp.

1668{
1670 for (const auto &opt : attribs)
1671 {
1672 if (opt.name=="id" && !opt.value.isEmpty()) // interpret id attribute as an anchor
1673 {
1674 const SectionInfo *sec = SectionManager::instance().find(opt.value);
1675 if (sec)
1676 {
1677 //printf("Found anchor %s\n",qPrint(id));
1678 m_file = sec->fileName();
1679 m_anchor = sec->label();
1681 }
1682 else
1683 {
1684 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid caption id '{}'",opt.value);
1685 }
1686 }
1687 else // copy attribute
1688 {
1689 m_attribs.push_back(opt);
1690 }
1691 }
1692}
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
HtmlAttribList m_attribs
Definition docnode.h:1232
bool m_hasCaptionId
Definition docnode.h:1233
QCString m_file
Definition docnode.h:1234
const HtmlAttribList & attribs() const
Definition docnode.h:1225
QCString m_anchor
Definition docnode.h:1235
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89
const T * find(const std::string &key) const
Definition linkedmap.h:47
QCString label() const
Definition section.h:68
QCString fileName() const
Definition section.h:73
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:175
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References attribs(), DocCompoundNode::DocCompoundNode(), FALSE, SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), SectionManager::instance(), SectionInfo::label(), m_anchor, m_attribs, m_file, m_hasCaptionId, DocNode::parent(), DocNode::parser(), TRUE, and warn_doc_error.

Member Function Documentation

◆ anchor()

QCString DocHtmlCaption::anchor ( ) const
inline

◆ attribs()

const HtmlAttribList & DocHtmlCaption::attribs ( ) const
inline

Definition at line 1225 of file docnode.h.

1225{ return m_attribs; }

References m_attribs.

Referenced by DocHtmlCaption(), and HtmlDocVisitor::operator()().

◆ file()

QCString DocHtmlCaption::file ( ) const
inline

◆ hasCaptionId()

bool DocHtmlCaption::hasCaptionId ( ) const
inline

Definition at line 1227 of file docnode.h.

1227{ return m_hasCaptionId; }

References m_hasCaptionId.

◆ parse()

Token DocHtmlCaption::parse ( )

Definition at line 1694 of file docnode.cpp.

1695{
1696 AUTO_TRACE();
1697 Token retval = Token::make_TK_NONE();
1698 auto ns = AutoNodeStack(parser(),thisVariant());
1699 Token tok = parser()->tokenizer.lex();
1700 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
1701 {
1702 if (!parser()->defaultHandleToken(thisVariant(),tok,children()))
1703 {
1704 switch (tok.value())
1705 {
1706 case TokenRetval::TK_HTMLTAG:
1707 {
1708 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
1709 if (tagId==HtmlTagType::HTML_CAPTION && parser()->context.token->endTag) // found </caption> tag
1710 {
1711 retval = Token::make_RetVal_OK();
1712 goto endcaption;
1713 }
1714 else
1715 {
1716 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <{}{}> found within <caption> context",
1717 parser()->context.token->endTag?"/":"",parser()->context.token->name);
1718 }
1719 }
1720 break;
1721 default:
1722 parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"<caption> tag");
1723 break;
1724 }
1725 }
1726 tok = parser()->tokenizer.lex();
1727 }
1728 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
1729 {
1730 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside"
1731 " <caption> tag");
1732 }
1733endcaption:
1735 return retval;
1736}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
DocTokenizer tokenizer
void handlePendingStyleCommands(DocNodeVariant *parent, DocNodeList &children)
void errorHandleDefaultToken(DocNodeVariant *parent, Token tok, DocNodeList &children, const QCString &txt)
TokenRetval value() const
bool is_any_of(ARGS... args) const
HtmlTagType
Definition cmdmapper.h:169
#define AUTO_TRACE(...)
Definition docnode.cpp:46
const Mapper< HtmlTagType > * htmlTagMapper

References AUTO_TRACE, DocCompoundNode::children(), DocParser::errorHandleDefaultToken(), DocParser::handlePendingStyleCommands(), HTML_CAPTION, Mappers::htmlTagMapper, Token::is_any_of(), DocTokenizer::lex(), DocNode::parser(), DocNode::thisVariant(), DocParser::tokenizer, Token::value(), and warn_doc_error.

Member Data Documentation

◆ m_anchor

QCString DocHtmlCaption::m_anchor
private

Definition at line 1235 of file docnode.h.

Referenced by anchor(), and DocHtmlCaption().

◆ m_attribs

HtmlAttribList DocHtmlCaption::m_attribs
private

Definition at line 1232 of file docnode.h.

Referenced by attribs(), and DocHtmlCaption().

◆ m_file

QCString DocHtmlCaption::m_file
private

Definition at line 1234 of file docnode.h.

Referenced by DocHtmlCaption(), and file().

◆ m_hasCaptionId

bool DocHtmlCaption::m_hasCaptionId = false
private

Definition at line 1233 of file docnode.h.

Referenced by DocHtmlCaption(), and hasCaptionId().


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