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

Node representing an entry in the index. More...

#include <src/docnode.h>

+ Inheritance diagram for DocIndexEntry:
+ Collaboration diagram for DocIndexEntry:

Public Member Functions

 DocIndexEntry (DocParser *parser, DocNodeVariant *parent, const Definition *scope, const MemberDef *md)
 
Token parse ()
 
const Definitionscope () const
 
const MemberDefmember () const
 
QCString entry () 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

QCString m_entry
 
const Definitionm_scope = nullptr
 
const MemberDefm_member = nullptr
 

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 an entry in the index.

Definition at line 532 of file docnode.h.

Constructor & Destructor Documentation

◆ DocIndexEntry()

DocIndexEntry::DocIndexEntry ( DocParser * parser,
DocNodeVariant * parent,
const Definition * scope,
const MemberDef * md )
inline

Definition at line 535 of file docnode.h.

const MemberDef * m_member
Definition docnode.h:545
const Definition * m_scope
Definition docnode.h:544
const Definition * scope() const
Definition docnode.h:538
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:84
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89

References DocNode::DocNode(), m_member, m_scope, DocNode::parent(), DocNode::parser(), and scope().

Member Function Documentation

◆ entry()

◆ member()

const MemberDef * DocIndexEntry::member ( ) const
inline

Definition at line 539 of file docnode.h.

539{ return m_member; }

References m_member.

Referenced by HtmlDocVisitor::operator()().

◆ parse()

Token DocIndexEntry::parse ( )

Definition at line 1560 of file docnode.cpp.

1561{
1562 AUTO_TRACE();
1563 Token retval(TokenRetval::RetVal_OK);
1564 auto ns = AutoNodeStack(parser(),thisVariant());
1565 Token tok=parser()->tokenizer.lex();
1566 if (!tok.is(TokenRetval::TK_WHITESPACE))
1567 {
1568 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\addindex command");
1569 goto endindexentry;
1570 }
1572 m_entry="";
1573 tok = parser()->tokenizer.lex();
1574 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
1575 {
1576 switch (tok.value())
1577 {
1578 case TokenRetval::TK_WHITESPACE:
1579 m_entry+=" ";
1580 break;
1581 case TokenRetval::TK_WORD:
1582 case TokenRetval::TK_LNKWORD:
1584 break;
1585 case TokenRetval::TK_SYMBOL:
1586 {
1587 HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name);
1588 switch (s)
1589 {
1590 case HtmlEntityMapper::Sym_BSlash: m_entry+='\\'; break;
1591 case HtmlEntityMapper::Sym_At: m_entry+='@'; break;
1592 case HtmlEntityMapper::Sym_Less: m_entry+='<'; break;
1593 case HtmlEntityMapper::Sym_Greater: m_entry+='>'; break;
1594 case HtmlEntityMapper::Sym_Amp: m_entry+='&'; break;
1595 case HtmlEntityMapper::Sym_Dollar: m_entry+='$'; break;
1596 case HtmlEntityMapper::Sym_Hash: m_entry+='#'; break;
1597 case HtmlEntityMapper::Sym_Percent: m_entry+='%'; break;
1598 case HtmlEntityMapper::Sym_apos: m_entry+='\''; break;
1599 case HtmlEntityMapper::Sym_Quot: m_entry+='"'; break;
1600 case HtmlEntityMapper::Sym_lsquo: m_entry+='`'; break;
1601 case HtmlEntityMapper::Sym_rsquo: m_entry+='\''; break;
1602 case HtmlEntityMapper::Sym_ldquo: m_entry+="``"; break;
1603 case HtmlEntityMapper::Sym_rdquo: m_entry+="''"; break;
1604 case HtmlEntityMapper::Sym_ndash: m_entry+="--"; break;
1605 case HtmlEntityMapper::Sym_mdash: m_entry+="---"; break;
1606 default:
1607 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected symbol '%s' found as argument of \\addindex",qPrint(parser()->context.token->name));
1608 break;
1609 }
1610 }
1611 break;
1612 case TokenRetval::TK_COMMAND_AT:
1613 // fall through
1614 case TokenRetval::TK_COMMAND_BS:
1615 switch (Mappers::cmdMapper->map(parser()->context.token->name))
1616 {
1617 case CommandType::CMD_BSLASH: m_entry+='\\'; break;
1618 case CommandType::CMD_AT: m_entry+='@'; break;
1619 case CommandType::CMD_LESS: m_entry+='<'; break;
1620 case CommandType::CMD_GREATER: m_entry+='>'; break;
1621 case CommandType::CMD_AMP: m_entry+='&'; break;
1622 case CommandType::CMD_DOLLAR: m_entry+='$'; break;
1623 case CommandType::CMD_HASH: m_entry+='#'; break;
1624 case CommandType::CMD_DCOLON: m_entry+="::"; break;
1625 case CommandType::CMD_PERCENT: m_entry+='%'; break;
1626 case CommandType::CMD_NDASH: m_entry+="--"; break;
1627 case CommandType::CMD_MDASH: m_entry+="---"; break;
1628 case CommandType::CMD_QUOTE: m_entry+='"'; break;
1629 case CommandType::CMD_PUNT: m_entry+='.'; break;
1630 case CommandType::CMD_PLUS: m_entry+='+'; break;
1631 case CommandType::CMD_MINUS: m_entry+='-'; break;
1632 case CommandType::CMD_EQUAL: m_entry+='='; break;
1633 default:
1634 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command %s found as argument of \\addindex",
1635 qPrint(parser()->context.token->name));
1636 break;
1637 }
1638 break;
1639 default:
1640 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s",
1641 tok.to_string());
1642 break;
1643 }
1644 tok = parser()->tokenizer.lex();
1645 }
1647 m_entry = m_entry.stripWhiteSpace();
1648endindexentry:
1649 AUTO_TRACE_EXIT("retval={}",retval.to_string());
1650 return retval;
1651}
DocNodeVariant * thisVariant()
Definition docnode.h:92
DocTokenizer tokenizer
DocParserContext context
static HtmlEntityMapper::SymType decodeSymbol(const QCString &symName)
Definition docnode.cpp:152
void setStateTitle()
void setStatePara()
bool is(TokenRetval rv) const
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
TokenRetval value() const
bool is_any_of(ARGS... args) const
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:48
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
const Mapper< CommandType > * cmdMapper
const char * qPrint(const char *s)
Definition qcstring.h:661
TokenInfo * token
Definition docparser_p.h:92
QCString name

References AUTO_TRACE, AUTO_TRACE_EXIT, CMD_AMP, CMD_AT, CMD_BSLASH, CMD_DCOLON, CMD_DOLLAR, CMD_EQUAL, CMD_GREATER, CMD_HASH, CMD_LESS, CMD_MDASH, CMD_MINUS, CMD_NDASH, CMD_PERCENT, CMD_PLUS, CMD_PUNT, CMD_QUOTE, Mappers::cmdMapper, DocParser::context, DocSymbol::decodeSymbol(), Token::is(), Token::is_any_of(), DocTokenizer::lex(), m_entry, TokenInfo::name, DocNode::parser(), qPrint(), DocTokenizer::setStatePara(), DocTokenizer::setStateTitle(), HtmlEntityMapper::Sym_Amp, HtmlEntityMapper::Sym_apos, HtmlEntityMapper::Sym_At, HtmlEntityMapper::Sym_BSlash, HtmlEntityMapper::Sym_Dollar, HtmlEntityMapper::Sym_Greater, HtmlEntityMapper::Sym_Hash, HtmlEntityMapper::Sym_ldquo, HtmlEntityMapper::Sym_Less, HtmlEntityMapper::Sym_lsquo, HtmlEntityMapper::Sym_mdash, HtmlEntityMapper::Sym_ndash, HtmlEntityMapper::Sym_Percent, HtmlEntityMapper::Sym_Quot, HtmlEntityMapper::Sym_rdquo, HtmlEntityMapper::Sym_rsquo, DocNode::thisVariant(), Token::to_string(), DocParserContext::token, DocParser::tokenizer, Token::value(), and warn_doc_error.

◆ scope()

const Definition * DocIndexEntry::scope ( ) const
inline

Definition at line 538 of file docnode.h.

538{ return m_scope; }

References m_scope.

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

Member Data Documentation

◆ m_entry

QCString DocIndexEntry::m_entry
private

Definition at line 543 of file docnode.h.

Referenced by entry(), and parse().

◆ m_member

const MemberDef* DocIndexEntry::m_member = nullptr
private

Definition at line 545 of file docnode.h.

Referenced by DocIndexEntry(), and member().

◆ m_scope

const Definition* DocIndexEntry::m_scope = nullptr
private

Definition at line 544 of file docnode.h.

Referenced by DocIndexEntry(), and scope().


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