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 1657 of file docnode.cpp.

1659{
1661 for (const auto &opt : attribs)
1662 {
1663 if (opt.name=="id" && !opt.value.isEmpty()) // interpret id attribute as an anchor
1664 {
1665 const SectionInfo *sec = SectionManager::instance().find(opt.value);
1666 if (sec)
1667 {
1668 //printf("Found anchor %s\n",qPrint(id));
1669 m_file = sec->fileName();
1670 m_anchor = sec->label();
1672 }
1673 else
1674 {
1675 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid caption id '%s'",qPrint(opt.value));
1676 }
1677 }
1678 else // copy attribute
1679 {
1680 m_attribs.push_back(opt);
1681 }
1682 }
1683}
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
Find an object given the key.
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:74
const char * qPrint(const char *s)
Definition qcstring.h:672
#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(), qPrint(), 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 1685 of file docnode.cpp.

1686{
1687 AUTO_TRACE();
1688 Token retval = Token::make_TK_NONE();
1689 auto ns = AutoNodeStack(parser(),thisVariant());
1690 Token tok = parser()->tokenizer.lex();
1691 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
1692 {
1693 if (!parser()->defaultHandleToken(thisVariant(),tok,children()))
1694 {
1695 switch (tok.value())
1696 {
1697 case TokenRetval::TK_HTMLTAG:
1698 {
1699 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
1700 if (tagId==HtmlTagType::HTML_CAPTION && parser()->context.token->endTag) // found </caption> tag
1701 {
1702 retval = Token::make_RetVal_OK();
1703 goto endcaption;
1704 }
1705 else
1706 {
1707 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <%s%s> found within <caption> context",
1708 parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name));
1709 }
1710 }
1711 break;
1712 default:
1713 parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"<caption> tag");
1714 break;
1715 }
1716 }
1717 tok = parser()->tokenizer.lex();
1718 }
1719 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
1720 {
1721 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside"
1722 " <caption> tag");
1723 }
1724endcaption:
1726 return retval;
1727}
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(), qPrint(), 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: