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

Constructor & Destructor Documentation

◆ DocIndexEntry()

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

Definition at line 549 of file docnode.h.

const MemberDef * m_member
Definition docnode.h:559
const Definition * m_scope
Definition docnode.h:558
const Definition * scope() const
Definition docnode.h:552
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 553 of file docnode.h.

553{ 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 case CommandType::CMD_EXCLAMATION: m_entry+='!'; break;
1634 case CommandType::CMD_QUESTION: m_entry+='?'; break;
1635 default:
1636 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command %s found as argument of \\addindex",
1637 qPrint(parser()->context.token->name));
1638 break;
1639 }
1640 break;
1641 default:
1642 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s",
1643 tok.to_string());
1644 break;
1645 }
1646 tok = parser()->tokenizer.lex();
1647 }
1649 m_entry = m_entry.stripWhiteSpace();
1650endindexentry:
1651 AUTO_TRACE_EXIT("retval={}",retval.to_string());
1652 return retval;
1653}
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:672
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_EXCLAMATION, CMD_GREATER, CMD_HASH, CMD_LESS, CMD_MDASH, CMD_MINUS, CMD_NDASH, CMD_PERCENT, CMD_PLUS, CMD_PUNT, CMD_QUESTION, 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 552 of file docnode.h.

552{ 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 557 of file docnode.h.

Referenced by entry(), and parse().

◆ m_member

const MemberDef* DocIndexEntry::m_member = nullptr
private

Definition at line 559 of file docnode.h.

Referenced by DocIndexEntry(), and member().

◆ m_scope

const Definition* DocIndexEntry::m_scope = nullptr
private

Definition at line 558 of file docnode.h.

Referenced by DocIndexEntry(), and scope().


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