Doxygen
DocRef类 参考

Node representing a reference to some item 更多...

#include <docparser.h>

+ 类 DocRef 继承关系图:
+ DocRef 的协作图:

Public 成员函数

 DocRef (DocParser &parser, DocNode *parent, const QCString &target, const QCString &context)
 
void parse ()
 
Kind kind () const override
 
QCString file () const
 
QCString relPath () const
 
QCString ref () const
 
QCString anchor () const
 
QCString targetTitle () const
 
bool hasLinkText () const
 
bool refToAnchor () const
 
bool refToSection () const
 
bool refToTable () const
 
bool isSubPage () const
 
- Public 成员函数 继承自 CompAccept< DocRef >
 CompAccept (DocParser &parser)
 
void accept (DocVisitor *v) override
 
const DocNodeListchildren () const
 
DocNodeListchildren ()
 
- Public 成员函数 继承自 DocNode
 DocNode (DocParser &parser)
 
virtual ~DocNode ()
 
DocNodeparent () const
 
void setParent (DocNode *parent)
 
bool isPreformatted () const
 

Private 属性

RefType m_refType = Unknown
 
bool m_isSubPage = false
 
QCString m_file
 
QCString m_relPath
 
QCString m_ref
 
QCString m_anchor
 
QCString m_text
 

额外继承的成员函数

- Public 类型 继承自 DocNode
enum  Kind {
  Kind_Root = 0, Kind_Word = 1, Kind_WhiteSpace = 2, Kind_Para = 3,
  Kind_AutoList = 4, Kind_AutoListItem = 5, Kind_Symbol = 6, Kind_URL = 7,
  Kind_StyleChange = 8, Kind_SimpleSect = 9, Kind_Title = 10, Kind_SimpleList = 11,
  Kind_SimpleListItem = 12, Kind_Section = 13, Kind_Verbatim = 14, Kind_XRefItem = 15,
  Kind_HtmlList = 16, Kind_HtmlListItem = 17, Kind_HtmlDescList = 18, Kind_HtmlDescData = 19,
  Kind_HtmlDescTitle = 20, Kind_HtmlTable = 21, Kind_HtmlRow = 22, Kind_HtmlCell = 23,
  Kind_HtmlCaption = 24, Kind_LineBreak = 25, Kind_HorRuler = 26, Kind_Anchor = 27,
  Kind_IndexEntry = 28, Kind_Internal = 29, Kind_HRef = 30, Kind_Include = 31,
  Kind_IncOperator = 32, Kind_HtmlHeader = 33, Kind_Image = 34, Kind_DotFile = 35,
  Kind_Link = 36, Kind_Ref = 37, Kind_Formula = 38, Kind_SecRefItem = 39,
  Kind_SecRefList = 40, Kind_SimpleSectSep = 41, Kind_LinkedWord = 42, Kind_ParamSect = 43,
  Kind_ParamList = 44, Kind_InternalRef = 45, Kind_Copy = 46, Kind_Text = 47,
  Kind_MscFile = 48, Kind_HtmlBlockQuote = 49, Kind_VhdlFlow = 50, Kind_ParBlock = 51,
  Kind_DiaFile = 52, Kind_Emoji = 53, Kind_Sep = 54
}
 
- Protected 类型 继承自 DocNode
enum  RefType { Unknown, Anchor, Section, Table }
 
- Protected 成员函数 继承自 DocNode
void setInsidePreformatted (bool p)
 
- Protected 属性 继承自 CompAccept< DocRef >
DocNodeList m_children
 
- Protected 属性 继承自 DocNode
DocNodem_parent = 0
 
DocParserm_parser
 

详细描述

Node representing a reference to some item

在文件 docparser.h891 行定义.

构造及析构函数说明

◆ DocRef()

DocRef::DocRef ( DocParser parser,
DocNode parent,
const QCString target,
const QCString context 
)

在文件 docparser.cpp2386 行定义.

2386  :
2388 {
2389  m_parent = parent;
2390  const Definition *compound = 0;
2391  QCString anchor;
2392  //printf("DocRef::DocRef(target=%s,context=%s)\n",qPrint(target),qPrint(context));
2393  ASSERT(!target.isEmpty());
2394  SrcLangExt lang = getLanguageFromFileName(target);
2395  m_relPath = parser.context.relPath;
2396  const SectionInfo *sec = SectionManager::instance().find(target);
2397  if (sec==0 && lang==SrcLangExt_Markdown) // lookup as markdown file
2398  {
2400  }
2401  if (sec) // ref to section or anchor
2402  {
2403  PageDef *pd = 0;
2404  if (sec->type()==SectionType::Page)
2405  {
2406  pd = Doxygen::pageLinkedMap->find(target);
2407  }
2408  m_text = sec->title();
2409  if (m_text.isEmpty()) m_text = sec->label();
2410 
2411  m_ref = sec->ref();
2413  if (sec->type()==SectionType::Anchor)
2414  {
2415  m_refType = Anchor;
2416  }
2417  else if (sec->type()==SectionType::Table)
2418  {
2419  m_refType = Table;
2420  }
2421  else
2422  {
2423  m_refType = Section;
2424  }
2425  m_isSubPage = pd && pd->hasParentPage();
2426  if (sec->type()!=SectionType::Page || m_isSubPage) m_anchor = sec->label();
2427  //printf("m_text=%s,m_ref=%s,m_file=%s,type=%d\n",
2428  // qPrint(m_text),qPrint(m_ref),qPrint(m_file),m_refType);
2429  return;
2430  }
2431  else if (resolveLink(context,target,TRUE,&compound,anchor))
2432  {
2433  bool isFile = compound ?
2434  (compound->definitionType()==Definition::TypeFile ||
2435  compound->definitionType()==Definition::TypePage ? TRUE : FALSE) :
2436  FALSE;
2437  m_text = linkToText(compound?compound->getLanguage():SrcLangExt_Unknown,target,isFile);
2438  m_anchor = anchor;
2439  if (compound && compound->isLinkable()) // ref to compound
2440  {
2441  if (anchor.isEmpty() && /* compound link */
2442  compound->definitionType()==Definition::TypeGroup && /* is group */
2443  !toGroupDef(compound)->groupTitle().isEmpty() /* with title */
2444  )
2445  {
2446  m_text=(toGroupDef(compound))->groupTitle(); // use group's title as link
2447  }
2448  else if (compound->definitionType()==Definition::TypeMember &&
2449  toMemberDef(compound)->isObjCMethod())
2450  {
2451  // Objective C Method
2452  const MemberDef *member = toMemberDef(compound);
2453  bool localLink = parser.context.memberDef ? member->getClassDef()==parser.context.memberDef->getClassDef() : FALSE;
2454  m_text = member->objCMethodName(localLink,parser.context.inSeeBlock);
2455  }
2456 
2457  m_file = compound->getOutputFileBase();
2458  m_ref = compound->getReference();
2459  //printf("isFile=%d compound=%s (%d)\n",isFile,qPrint(compound->name()),
2460  // compound->definitionType());
2461  return;
2462  }
2463  else if (compound && compound->definitionType()==Definition::TypeFile &&
2464  toFileDef(compound)->generateSourceFile()
2465  ) // undocumented file that has source code we can link to
2466  {
2467  m_file = compound->getSourceFileBase();
2468  m_ref = compound->getReference();
2469  return;
2470  }
2471  }
2472  m_text = target;
2473  warn_doc_error(parser.context.fileName,parser.tokenizer.getLineNr(),"unable to resolve reference to '%s' for \\ref command",
2474  qPrint(target));
2475 }

引用了 Anchor, DocNode::Anchor, anchor(), ASSERT, DocParser::context, Definition::definitionType(), FALSE, SectionInfo::fileName(), DocParserContext::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), MemberDef::getClassDef(), Definition::getLanguage(), getLanguageFromFileName(), DocTokenizer::getLineNr(), Definition::getOutputFileBase(), Definition::getReference(), Definition::getSourceFileBase(), PageDef::hasParentPage(), DocParserContext::inSeeBlock, SectionManager::instance(), QCString::isEmpty(), Definition::isLinkable(), MemberDef::isObjCMethod(), SectionInfo::label(), linkToText(), m_anchor, m_file, m_isSubPage, DocNode::m_parent, m_ref, m_refType, m_relPath, m_text, markdownFileNameToId(), DocParserContext::memberDef, MemberDef::objCMethodName(), Page, Doxygen::pageLinkedMap, DocNode::parent(), qPrint(), SectionInfo::ref(), DocParserContext::relPath, resolveLink(), DocNode::Section, SrcLangExt_Markdown, SrcLangExt_Unknown, stripKnownExtensions(), Table, DocNode::Table, SectionInfo::title(), toFileDef(), toGroupDef(), DocParser::tokenizer, toMemberDef(), TRUE, SectionInfo::type(), Definition::TypeFile, Definition::TypeGroup, Definition::TypeMember, Definition::TypePage , 以及 warn_doc_error().

成员函数说明

◆ anchor()

◆ file()

◆ hasLinkText()

◆ isSubPage()

bool DocRef::isSubPage ( ) const
inline

◆ kind()

Kind DocRef::kind ( ) const
inlineoverridevirtual

Returns the kind of node. Provides runtime type information

实现了 DocNode.

在文件 docparser.h896 行定义.

896 { return Kind_Ref; }

引用了 DocNode::Kind_Ref.

◆ parse()

void DocRef::parse ( )

在文件 docparser.cpp2504 行定义.

2505 {
2506  auto ns = AutoNodeStack(m_parser,this);
2507  DBG(("DocRef::parse() start\n"));
2508 
2509  int tok;
2510  while ((tok=m_parser.tokenizer.lex()))
2511  {
2512  if (!m_parser.defaultHandleToken(this,tok,m_children))
2513  {
2514  switch (tok)
2515  {
2516  case TK_HTMLTAG:
2517  break;
2518  default:
2519  m_parser.errorHandleDefaultToken(this,tok,m_children,"\\ref");
2520  break;
2521  }
2522  }
2523  }
2524 
2525  if (m_children.empty() && !m_text.isEmpty())
2526  {
2530  m_parser.popContext();
2533  }
2534 
2536 }

引用了 DocParser::context, DBG, DocParser::defaultHandleToken(), DocParser::errorHandleDefaultToken(), FALSE, flattenParagraphs(), DocParser::handlePendingStyleCommands(), DocParserContext::insideHtmlLink, DocParser::internalValidatingParseDoc(), QCString::isEmpty(), DocTokenizer::lex(), CompAccept< DocRef >::m_children, DocNode::m_parser, m_text, DocParser::popContext(), DocParser::pushContext(), TK_HTMLTAG, DocParser::tokenizer , 以及 TRUE.

被这些函数引用 DocPara::handleRef() , 以及 DocHtmlDescTitle::parse().

◆ ref()

QCString DocRef::ref ( ) const
inline

◆ refToAnchor()

bool DocRef::refToAnchor ( ) const
inline

在文件 docparser.h903 行定义.

903 { return m_refType==Anchor; }

引用了 DocNode::Anchor , 以及 m_refType.

◆ refToSection()

bool DocRef::refToSection ( ) const
inline

在文件 docparser.h904 行定义.

904 { return m_refType==Section; }

引用了 m_refType , 以及 DocNode::Section.

◆ refToTable()

bool DocRef::refToTable ( ) const
inline

在文件 docparser.h905 行定义.

905 { return m_refType==Table; }

引用了 m_refType , 以及 DocNode::Table.

被这些函数引用 LatexDocVisitor::visitPost() , 以及 LatexDocVisitor::visitPre().

◆ relPath()

QCString DocRef::relPath ( ) const
inline

在文件 docparser.h898 行定义.

898 { return m_relPath; }

引用了 m_relPath.

被这些函数引用 HtmlDocVisitor::visitPre().

◆ targetTitle()

类成员变量说明

◆ m_anchor

QCString DocRef::m_anchor
private

在文件 docparser.h914 行定义.

被这些函数引用 anchor() , 以及 DocRef().

◆ m_file

QCString DocRef::m_file
private

在文件 docparser.h911 行定义.

被这些函数引用 DocRef() , 以及 file().

◆ m_isSubPage

bool DocRef::m_isSubPage = false
private

在文件 docparser.h910 行定义.

被这些函数引用 DocRef() , 以及 isSubPage().

◆ m_ref

QCString DocRef::m_ref
private

在文件 docparser.h913 行定义.

被这些函数引用 DocRef() , 以及 ref().

◆ m_refType

RefType DocRef::m_refType = Unknown
private

在文件 docparser.h909 行定义.

被这些函数引用 DocRef(), refToAnchor(), refToSection() , 以及 refToTable().

◆ m_relPath

QCString DocRef::m_relPath
private

在文件 docparser.h912 行定义.

被这些函数引用 DocRef() , 以及 relPath().

◆ m_text

QCString DocRef::m_text
private

在文件 docparser.h915 行定义.

被这些函数引用 DocRef(), parse() , 以及 targetTitle().


该类的文档由以下文件生成:
Definition::getSourceFileBase
virtual QCString getSourceFileBase() const =0
SrcLangExt_Unknown
@ SrcLangExt_Unknown
Definition: types.h:43
DocParser::popContext
void popContext()
Definition: docparser.cpp:222
toGroupDef
GroupDef * toGroupDef(Definition *d)
Definition: groupdef.cpp:1766
markdownFileNameToId
QCString markdownFileNameToId(const QCString &fileName)
processes string s and converts markdown into doxygen/html commands.
Definition: markdown.cpp:3053
resolveLink
bool resolveLink(const QCString &scName, const QCString &lr, bool, const Definition **resContext, QCString &resAnchor)
Definition: util.cpp:3037
DocParser::context
DocParserContext context
Definition: docparser.cpp:175
Definition::TypeMember
@ TypeMember
Definition: definition.h:90
DocParserContext::relPath
QCString relPath
Definition: docparser.cpp:111
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
CompAccept< DocRef >
Definition::isLinkable
virtual bool isLinkable() const =0
DocParser::internalValidatingParseDoc
int internalValidatingParseDoc(DocNode *parent, DocNodeList &children, const QCString &doc)
Definition: docparser.cpp:1742
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
DocParser::handlePendingStyleCommands
void handlePendingStyleCommands(DocNode *parent, DocNodeList &children)
Definition: docparser.cpp:912
Doxygen::pageLinkedMap
static PageLinkedMap * pageLinkedMap
Definition: doxygen.h:82
Definition::TypePage
@ TypePage
Definition: definition.h:93
toMemberDef
MemberDef * toMemberDef(Definition *d)
Definition: memberdef.cpp:6088
SrcLangExt
SrcLangExt
Language as given by extension
Definition: types.h:41
DocParser::tokenizer
DocTokenizer tokenizer
Definition: docparser.cpp:176
DocRef::anchor
QCString anchor() const
Definition: docparser.h:900
Definition::TypeGroup
@ TypeGroup
Definition: definition.h:91
warn_doc_error
void warn_doc_error(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:186
SectionType::Table
@ Table
DocRef::m_refType
RefType m_refType
Definition: docparser.h:909
SectionInfo::label
QCString label() const
Definition: section.h:65
SectionInfo::ref
QCString ref() const
Definition: section.h:68
Definition::getLanguage
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
DocNode::Kind_Ref
@ Kind_Ref
Definition: docparser.h:137
MemberDef::isObjCMethod
virtual bool isObjCMethod() const =0
PageDef
A model of a page symbol.
Definition: pagedef.h:25
DocParserContext::memberDef
const MemberDef * memberDef
Definition: docparser.cpp:117
DocParserContext::inSeeBlock
bool inSeeBlock
Definition: docparser.cpp:103
DocParser::defaultHandleToken
bool defaultHandleToken(DocNode *parent, int tok, DocNodeList &children, bool handleWord=TRUE)
Definition: docparser.cpp:1277
DocNode::Section
@ Section
Definition: docparser.h:183
DocParserContext::fileName
QCString fileName
Definition: docparser.cpp:110
DocNode::Anchor
@ Anchor
Definition: docparser.h:183
MemberDef
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
DocParser::errorHandleDefaultToken
void errorHandleDefaultToken(DocNode *parent, int tok, DocNodeList &children, const QCString &txt)
Definition: docparser.cpp:775
Definition::TypeFile
@ TypeFile
Definition: definition.h:88
DocRef::m_isSubPage
bool m_isSubPage
Definition: docparser.h:910
DocNode::m_parser
DocParser & m_parser
Definition: docparser.h:184
MemberDef::getClassDef
virtual const ClassDef * getClassDef() const =0
DocRef::m_ref
QCString m_ref
Definition: docparser.h:913
DocTokenizer::getLineNr
int getLineNr(void)
DocNode::Unknown
@ Unknown
Definition: docparser.h:183
SectionInfo::fileName
QCString fileName() const
Definition: section.h:70
getLanguageFromFileName
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition: util.cpp:5574
TRUE
#define TRUE
Definition: qcstring.h:36
Definition::getOutputFileBase
virtual QCString getOutputFileBase() const =0
LinkedMap::find
const T * find(const std::string &key) const
Find an object given the key.
Definition: linkedmap.h:60
SectionType::Page
@ Page
SectionInfo::title
QCString title() const
Definition: section.h:66
DocParser::pushContext
void pushContext()
Definition: docparser.cpp:208
Definition::definitionType
virtual DefType definitionType() const =0
linkToText
QCString linkToText(SrcLangExt lang, const QCString &link, bool isFileName)
Definition: util.cpp:2943
Definition::getReference
virtual QCString getReference() const =0
SectionType::Anchor
@ Anchor
stripKnownExtensions
static QCString stripKnownExtensions(const QCString &text)
Definition: docparser.cpp:539
DocRef::m_relPath
QCString m_relPath
Definition: docparser.h:912
MemberDef::objCMethodName
virtual QCString objCMethodName(bool localLink, bool showStatic) const =0
SectionManager::instance
static SectionManager & instance()
returns a reference to the singleton
Definition: section.h:172
TK_HTMLTAG
@ TK_HTMLTAG
Command starting with @
Definition: doctokenizer.h:52
flattenParagraphs
static void flattenParagraphs(DocNode *root, DocNodeList &children)
Definition: docparser.cpp:2477
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
DocRef::m_file
QCString m_file
Definition: docparser.h:911
SectionInfo
class that provide information about a section.
Definition: section.h:49
AutoNodeStack
Definition: docparser.cpp:186
ASSERT
#define ASSERT(x)
Definition: qcstring.h:44
SrcLangExt_Markdown
@ SrcLangExt_Markdown
Definition: types.h:57
toFileDef
FileDef * toFileDef(Definition *d)
Definition: filedef.cpp:1778
DocParserContext::insideHtmlLink
bool insideHtmlLink
Definition: docparser.cpp:105
DocTokenizer::lex
int lex()
DocRef::m_text
QCString m_text
Definition: docparser.h:915
DocNode::parent
DocNode * parent() const
Definition: docparser.h:166
DocRef::m_anchor
QCString m_anchor
Definition: docparser.h:914
DBG
#define DBG(x)
Definition: docparser.cpp:58
DocNode::Table
@ Table
Definition: docparser.h:183
SectionInfo::type
SectionType type() const
Definition: section.h:67
CompAccept< DocRef >::m_children
DocNodeList m_children
Definition: docparser.h:211
DocNode::m_parent
DocNode * m_parent
Definition: docparser.h:182
PageDef::hasParentPage
virtual bool hasParentPage() const =0
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108