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

Node representing a reference to a section. More...

#include <src/docnode.h>

+ Inheritance diagram for DocSecRefItem:
+ Collaboration diagram for DocSecRefItem:

Public Member Functions

 DocSecRefItem (DocParser *parser, DocNodeVariant *parent, const QCString &target)
 
QCString target () const
 
QCString file () const
 
QCString anchor () const
 
QCString relPath () const
 
QCString ref () const
 
bool refToTable () const
 
bool isSubPage () const
 
void parse ()
 
- 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

QCString m_target
 
RefType m_refType = Unknown
 
bool m_isSubPage = false
 
QCString m_file
 
QCString m_relPath
 
QCString m_ref
 
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 reference to a section.

Definition at line 914 of file docnode.h.

Constructor & Destructor Documentation

◆ DocSecRefItem()

DocSecRefItem::DocSecRefItem ( DocParser * parser,
DocNodeVariant * parent,
const QCString & target )

Definition at line 533 of file docnode.cpp.

533 :
535{
536}
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89
QCString m_target
Definition docnode.h:928
QCString target() const
Definition docnode.h:918
QCString m_relPath
Definition docnode.h:932

References DocCompoundNode::DocCompoundNode(), m_relPath, m_target, DocNode::parent(), DocNode::parser(), relPath(), and target().

Member Function Documentation

◆ anchor()

QCString DocSecRefItem::anchor ( ) const
inline

◆ file()

QCString DocSecRefItem::file ( ) const
inline

◆ isSubPage()

bool DocSecRefItem::isSubPage ( ) const
inline

Definition at line 924 of file docnode.h.

924{ return m_isSubPage; }
bool m_isSubPage
Definition docnode.h:930

References m_isSubPage.

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

◆ parse()

void DocSecRefItem::parse ( )

Definition at line 538 of file docnode.cpp.

539{
540 AUTO_TRACE();
541 auto ns = AutoNodeStack(parser(),thisVariant());
542
544 Token tok = parser()->tokenizer.lex();
545 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
546 {
547 if (!parser()->defaultHandleToken(thisVariant(),tok,children()))
548 {
549 parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"\\refitem");
550 }
551 tok = parser()->tokenizer.lex();
552 }
555
556 if (!m_target.isEmpty())
557 {
558 const SectionInfo *sec = SectionManager::instance().find(m_target);
559 if (sec==nullptr && parser()->context.lang==SrcLangExt::Markdown) // lookup as markdown file
560 {
562 }
563 if (sec) // ref to section or anchor
564 {
565 // set defaults
566 m_ref = sec->ref();
569 m_anchor = sec->label();
570 m_isSubPage = false;
571 // adjust if needed
572 switch (sec->type().level())
573 {
575 {
576 PageDef *pd = Doxygen::pageLinkedMap->find(m_target);
577 m_isSubPage = pd && pd->hasParentPage();
578 if (!m_isSubPage)
579 {
580 m_anchor="";
581 }
582 }
583 break;
586 break;
589 break;
590 default:
591 break;
592 }
593 //printf("m_ref=%s,m_file=%s,type=%d\n",
594 // qPrint(m_ref),qPrint(m_file),m_refType);
595 }
596 else
597 {
598 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"reference to unknown section %s",
600 }
601 }
602 else
603 {
604 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"reference to empty target");
605 }
606}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
@ Table
Definition docnode.h:109
@ Section
Definition docnode.h:109
@ Anchor
Definition docnode.h:109
DocTokenizer tokenizer
void handlePendingStyleCommands(DocNodeVariant *parent, DocNodeList &children)
void errorHandleDefaultToken(DocNodeVariant *parent, Token tok, DocNodeList &children, const QCString &txt)
QCString m_ref
Definition docnode.h:933
RefType m_refType
Definition docnode.h:929
void setStateTitle()
void setStatePara()
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:100
const T * find(const std::string &key) const
Find an object given the key.
Definition linkedmap.h:47
virtual bool hasParentPage() const =0
QCString label() const
Definition section.h:68
QCString ref() const
Definition section.h:71
QCString fileName() const
Definition section.h:73
SectionType type() const
Definition section.h:70
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:175
static constexpr int Anchor
Definition section.h:40
static constexpr int Table
Definition section.h:41
constexpr int level() const
Definition section.h:45
static constexpr int Page
Definition section.h:31
bool is_any_of(ARGS... args) const
#define AUTO_TRACE(...)
Definition docnode.cpp:46
static QCString stripKnownExtensions(const QCString &text)
Definition docnode.cpp:103
QCString markdownFileNameToId(const QCString &fileName)
processes string s and converts markdown into doxygen/html commands.
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
const char * qPrint(const char *s)
Definition qcstring.h:661
@ Markdown
Definition types.h:57

References DocNode::Anchor, SectionType::Anchor, AUTO_TRACE, DocCompoundNode::children(), DocParser::errorHandleDefaultToken(), SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), DocParser::handlePendingStyleCommands(), PageDef::hasParentPage(), SectionManager::instance(), Token::is_any_of(), SectionInfo::label(), SectionType::level(), DocTokenizer::lex(), m_anchor, m_file, m_isSubPage, m_ref, m_refType, m_target, Markdown, markdownFileNameToId(), SectionType::Page, Doxygen::pageLinkedMap, DocNode::parser(), qPrint(), SectionInfo::ref(), DocNode::Section, DocTokenizer::setStatePara(), DocTokenizer::setStateTitle(), stripKnownExtensions(), DocNode::Table, SectionType::Table, DocNode::thisVariant(), DocParser::tokenizer, SectionInfo::type(), and warn_doc_error.

◆ ref()

QCString DocSecRefItem::ref ( ) const
inline

Definition at line 922 of file docnode.h.

922{ return m_ref; }

References m_ref.

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

◆ refToTable()

bool DocSecRefItem::refToTable ( ) const
inline

Definition at line 923 of file docnode.h.

923{ return m_refType==Table; }

References m_refType, and DocNode::Table.

Referenced by LatexDocVisitor::operator()().

◆ relPath()

QCString DocSecRefItem::relPath ( ) const
inline

Definition at line 921 of file docnode.h.

921{ return m_relPath; }

References m_relPath.

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

◆ target()

QCString DocSecRefItem::target ( ) const
inline

Definition at line 918 of file docnode.h.

918{ return m_target; }

References m_target.

Referenced by DocSecRefItem(), and PrintDocVisitor::operator()().

Member Data Documentation

◆ m_anchor

QCString DocSecRefItem::m_anchor
private

Definition at line 934 of file docnode.h.

Referenced by anchor(), and parse().

◆ m_file

QCString DocSecRefItem::m_file
private

Definition at line 931 of file docnode.h.

Referenced by file(), and parse().

◆ m_isSubPage

bool DocSecRefItem::m_isSubPage = false
private

Definition at line 930 of file docnode.h.

Referenced by isSubPage(), and parse().

◆ m_ref

QCString DocSecRefItem::m_ref
private

Definition at line 933 of file docnode.h.

Referenced by parse(), and ref().

◆ m_refType

RefType DocSecRefItem::m_refType = Unknown
private

Definition at line 929 of file docnode.h.

Referenced by parse(), and refToTable().

◆ m_relPath

QCString DocSecRefItem::m_relPath
private

Definition at line 932 of file docnode.h.

Referenced by DocSecRefItem(), and relPath().

◆ m_target

QCString DocSecRefItem::m_target
private

Definition at line 928 of file docnode.h.

Referenced by DocSecRefItem(), parse(), and target().


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