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 1207 of file docnode.h.

Constructor & Destructor Documentation

◆ DocHtmlCaption()

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

Definition at line 1655 of file docnode.cpp.

1657{
1659 for (const auto &opt : attribs)
1660 {
1661 if (opt.name=="id" && !opt.value.isEmpty()) // interpret id attribute as an anchor
1662 {
1663 const SectionInfo *sec = SectionManager::instance().find(opt.value);
1664 if (sec)
1665 {
1666 //printf("Found anchor %s\n",qPrint(id));
1667 m_file = sec->fileName();
1668 m_anchor = sec->label();
1670 }
1671 else
1672 {
1673 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid caption id '%s'",qPrint(opt.value));
1674 }
1675 }
1676 else // copy attribute
1677 {
1678 m_attribs.push_back(opt);
1679 }
1680 }
1681}
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
HtmlAttribList m_attribs
Definition docnode.h:1218
bool m_hasCaptionId
Definition docnode.h:1219
QCString m_file
Definition docnode.h:1220
const HtmlAttribList & attribs() const
Definition docnode.h:1211
QCString m_anchor
Definition docnode.h:1221
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:661
#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 1211 of file docnode.h.

1211{ 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 1213 of file docnode.h.

1213{ return m_hasCaptionId; }

References m_hasCaptionId.

◆ parse()

Token DocHtmlCaption::parse ( )

Definition at line 1683 of file docnode.cpp.

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

Referenced by anchor(), and DocHtmlCaption().

◆ m_attribs

HtmlAttribList DocHtmlCaption::m_attribs
private

Definition at line 1218 of file docnode.h.

Referenced by attribs(), and DocHtmlCaption().

◆ m_file

QCString DocHtmlCaption::m_file
private

Definition at line 1220 of file docnode.h.

Referenced by DocHtmlCaption(), and file().

◆ m_hasCaptionId

bool DocHtmlCaption::m_hasCaptionId = false
private

Definition at line 1219 of file docnode.h.

Referenced by DocHtmlCaption(), and hasCaptionId().


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