Doxygen
DocLink类 参考

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

#include <docparser.h>

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

Public 成员函数

 DocLink (DocParser &parser, DocNode *parent, const QCString &target)
 
QCString parse (bool, bool isXmlLink=FALSE)
 
Kind kind () const override
 
QCString file () const
 
QCString relPath () const
 
QCString ref () const
 
QCString anchor () const
 
- Public 成员函数 继承自 CompAccept< DocLink >
 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 属性

QCString m_file
 
QCString m_relPath
 
QCString m_ref
 
QCString m_anchor
 
QCString m_refText
 

额外继承的成员函数

- 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< DocLink >
DocNodeList m_children
 
- Protected 属性 继承自 DocNode
DocNodem_parent = 0
 
DocParserm_parser
 

详细描述

Node representing a link to some item

在文件 docparser.h871 行定义.

构造及析构函数说明

◆ DocLink()

DocLink::DocLink ( DocParser parser,
DocNode parent,
const QCString target 
)

在文件 docparser.cpp2579 行定义.

2579  : CompAccept<DocLink>(parser)
2580 {
2581  m_parent = parent;
2582  const Definition *compound = 0;
2583  QCString anchor;
2584  m_refText = target;
2585  m_relPath = parser.context.relPath;
2586  if (!m_refText.isEmpty() && m_refText.at(0)=='#')
2587  {
2589  }
2590  if (resolveLink(parser.context.context,stripKnownExtensions(target),parser.context.inSeeBlock,&compound,anchor))
2591  {
2592  m_anchor = anchor;
2593  if (compound && compound->isLinkable())
2594  {
2595  m_file = compound->getOutputFileBase();
2596  m_ref = compound->getReference();
2597  }
2598  else if (compound && compound->definitionType()==Definition::TypeFile &&
2599  (toFileDef(compound))->generateSourceFile()
2600  ) // undocumented file that has source code we can link to
2601  {
2602  m_file = compound->getSourceFileBase();
2603  m_ref = compound->getReference();
2604  }
2605  return;
2606  }
2607 
2608  // bogus link target
2609  warn_doc_error(parser.context.fileName,parser.tokenizer.getLineNr(),"unable to resolve link to '%s' for \\link command",
2610  qPrint(target));
2611 }

引用了 anchor(), QCString::at(), DocParserContext::context, DocParser::context, Definition::definitionType(), DocParserContext::fileName, DocTokenizer::getLineNr(), Definition::getOutputFileBase(), Definition::getReference(), Definition::getSourceFileBase(), DocParserContext::inSeeBlock, QCString::isEmpty(), Definition::isLinkable(), QCString::length(), m_anchor, m_file, DocNode::m_parent, m_ref, m_refText, m_relPath, DocNode::parent(), qPrint(), DocParserContext::relPath, resolveLink(), QCString::right(), stripKnownExtensions(), toFileDef(), DocParser::tokenizer, Definition::TypeFile , 以及 warn_doc_error().

成员函数说明

◆ anchor()

◆ file()

◆ kind()

Kind DocLink::kind ( ) const
inlineoverridevirtual

Returns the kind of node. Provides runtime type information

实现了 DocNode.

在文件 docparser.h876 行定义.

876 { return Kind_Link; }

引用了 DocNode::Kind_Link.

◆ parse()

QCString DocLink::parse ( bool  isJavaLink,
bool  isXmlLink = FALSE 
)

在文件 docparser.cpp2614 行定义.

2615 {
2616  QCString result;
2617  auto ns = AutoNodeStack(m_parser,this);
2618  DBG(("DocLink::parse() start\n"));
2619 
2620  int tok;
2621  while ((tok=m_parser.tokenizer.lex()))
2622  {
2624  {
2625  const char *cmd_start = "\\";
2626  switch (tok)
2627  {
2628  case TK_COMMAND_AT:
2629  cmd_start = "@";
2630  // fall through
2631  case TK_COMMAND_BS:
2632  switch (Mappers::cmdMapper->map(m_parser.context.token->name))
2633  {
2634  case CMD_ENDLINK:
2635  if (isJavaLink)
2636  {
2637  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"{@link.. ended with @endlink command");
2638  }
2639  goto endlink;
2640  default:
2641  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"Illegal command %s as part of a \\link",
2642  qPrint(cmd_start + m_parser.context.token->name));
2643  break;
2644  }
2645  break;
2646  case TK_SYMBOL:
2647  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"Unsupported symbol %s found as part of a \\link",
2649  break;
2650  case TK_HTMLTAG:
2651  if (m_parser.context.token->name!="see" || !isXmlLink)
2652  {
2653  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"Unexpected xml/html command %s found as part of a \\link",
2655  }
2656  goto endlink;
2657  case TK_LNKWORD:
2658  case TK_WORD:
2659  if (isJavaLink) // special case to detect closing }
2660  {
2662  int p;
2663  if (w=="}")
2664  {
2665  goto endlink;
2666  }
2667  else if ((p=w.find('}'))!=-1)
2668  {
2669  uint l=w.length();
2670  m_children.push_back(std::make_unique<DocWord>(m_parser,this,w.left(p)));
2671  if ((uint)p<l-1) // something left after the } (for instance a .)
2672  {
2673  result=w.right((int)l-p-1);
2674  }
2675  goto endlink;
2676  }
2677  }
2678  m_children.push_back(std::make_unique<DocWord>(m_parser,this,m_parser.context.token->name));
2679  break;
2680  default:
2683  break;
2684  }
2685  }
2686  }
2687  if (tok==0)
2688  {
2689  warn_doc_error(m_parser.context.fileName,m_parser.tokenizer.getLineNr(),"Unexpected end of comment while inside"
2690  " link command\n");
2691  }
2692 endlink:
2693 
2694  if (m_children.empty()) // no link text
2695  {
2696  m_children.push_back(std::make_unique<DocWord>(m_parser,this,m_refText));
2697  }
2698 
2700  DBG(("DocLink::parse() end\n"));
2701  return result;
2702 }

引用了 CMD_ENDLINK, Mappers::cmdMapper, DocParser::context, DBG, DocParser::defaultHandleToken(), FALSE, DocParserContext::fileName, QCString::find(), DocTokenizer::getLineNr(), DocParser::handlePendingStyleCommands(), QCString::left(), QCString::length(), DocTokenizer::lex(), CompAccept< DocLink >::m_children, DocNode::m_parser, m_refText, TokenInfo::name, qPrint(), QCString::right(), TK_COMMAND_AT, TK_COMMAND_BS, TK_HTMLTAG, TK_LNKWORD, TK_SYMBOL, TK_WORD, DocParserContext::token, DocParser::tokenizer, DocTokenizer::tokToString() , 以及 warn_doc_error().

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

◆ ref()

◆ relPath()

QCString DocLink::relPath ( ) const
inline

在文件 docparser.h878 行定义.

878 { return m_relPath; }

引用了 m_relPath.

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

类成员变量说明

◆ m_anchor

QCString DocLink::m_anchor
private

在文件 docparser.h886 行定义.

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

◆ m_file

QCString DocLink::m_file
private

在文件 docparser.h883 行定义.

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

◆ m_ref

QCString DocLink::m_ref
private

在文件 docparser.h885 行定义.

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

◆ m_refText

QCString DocLink::m_refText
private

在文件 docparser.h887 行定义.

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

◆ m_relPath

QCString DocLink::m_relPath
private

在文件 docparser.h884 行定义.

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


该类的文档由以下文件生成:
Definition::getSourceFileBase
virtual QCString getSourceFileBase() const =0
resolveLink
bool resolveLink(const QCString &scName, const QCString &lr, bool, const Definition **resContext, QCString &resAnchor)
Definition: util.cpp:3037
DocParserContext::token
TokenInfo * token
Definition: docparser.cpp:129
DocParser::context
DocParserContext context
Definition: docparser.cpp:175
DocTokenizer::tokToString
static const char * tokToString(int token)
TK_WORD
@ TK_WORD
Definition: doctokenizer.h:46
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< DocLink >
Definition::isLinkable
virtual bool isLinkable() const =0
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
TokenInfo::name
QCString name
Definition: doctokenizer.h:74
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
DocParser::tokenizer
DocTokenizer tokenizer
Definition: docparser.cpp:176
DocNode::Kind_Link
@ Kind_Link
Definition: docparser.h:136
warn_doc_error
void warn_doc_error(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:186
QCString::at
char & at(size_t i)
Returns a reference to the character at index i.
Definition: qcstring.h:477
QCString::find
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:38
TK_SYMBOL
@ TK_SYMBOL
Definition: doctokenizer.h:53
TK_COMMAND_AT
@ TK_COMMAND_AT
Definition: doctokenizer.h:51
DocParserContext::inSeeBlock
bool inSeeBlock
Definition: docparser.cpp:103
uint
unsigned uint
Definition: qcstring.h:40
DocParser::defaultHandleToken
bool defaultHandleToken(DocNode *parent, int tok, DocNodeList &children, bool handleWord=TRUE)
Definition: docparser.cpp:1277
DocParserContext::fileName
QCString fileName
Definition: docparser.cpp:110
QCString::left
QCString left(size_t len) const
Definition: qcstring.h:212
Definition::TypeFile
@ TypeFile
Definition: definition.h:88
DocNode::m_parser
DocParser & m_parser
Definition: docparser.h:184
DocParserContext::context
QCString context
Definition: docparser.cpp:102
DocTokenizer::getLineNr
int getLineNr(void)
Definition::getOutputFileBase
virtual QCString getOutputFileBase() const =0
TK_LNKWORD
@ TK_LNKWORD
Definition: doctokenizer.h:47
Definition::definitionType
virtual DefType definitionType() const =0
Definition::getReference
virtual QCString getReference() const =0
stripKnownExtensions
static QCString stripKnownExtensions(const QCString &text)
Definition: docparser.cpp:539
TK_HTMLTAG
@ TK_HTMLTAG
Command starting with @
Definition: doctokenizer.h:52
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
Mappers::cmdMapper
static Mapper * cmdMapper
Definition: cmdmapper.h:234
AutoNodeStack
Definition: docparser.cpp:186
toFileDef
FileDef * toFileDef(Definition *d)
Definition: filedef.cpp:1778
DocTokenizer::lex
int lex()
DocNode::parent
DocNode * parent() const
Definition: docparser.h:166
DBG
#define DBG(x)
Definition: docparser.cpp:58
CompAccept< DocLink >::m_children
DocNodeList m_children
Definition: docparser.h:211
TK_COMMAND_BS
@ TK_COMMAND_BS
Definition: doctokenizer.h:57
CMD_ENDLINK
@ CMD_ENDLINK
Definition: cmdmapper.h:49
QCString::right
QCString right(size_t len) const
Definition: qcstring.h:217
DocNode::m_parent
DocNode * m_parent
Definition: docparser.h:182
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108