Doxygen
MarkdownOutlineParser类 参考

#include <markdown.h>

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

struct  Private
 

Public 成员函数

 MarkdownOutlineParser ()
 
virtual ~MarkdownOutlineParser ()
 
void parseInput (const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser)
 Parses a single input file with the goal to build an Entry tree. 更多...
 
bool needsPreprocessing (const QCString &) const
 Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser. 更多...
 
void parsePrototype (const QCString &text)
 Callback function called by the comment block scanner. 更多...
 
- Public 成员函数 继承自 OutlineParserInterface
virtual ~OutlineParserInterface ()
 

Private 属性

std::unique_ptr< Privatep
 

详细描述

在文件 markdown.h91 行定义.

构造及析构函数说明

◆ MarkdownOutlineParser()

MarkdownOutlineParser::MarkdownOutlineParser ( )

在文件 markdown.cpp3081 行定义.

3081  : p(std::make_unique<Private>())
3082 {
3083 }

◆ ~MarkdownOutlineParser()

MarkdownOutlineParser::~MarkdownOutlineParser ( )
virtual

在文件 markdown.cpp3085 行定义.

3086 {
3087 }

成员函数说明

◆ needsPreprocessing()

bool MarkdownOutlineParser::needsPreprocessing ( const QCString extension) const
inlinevirtual

Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.

参见
parseInput()

实现了 OutlineParserInterface.

在文件 markdown.h100 行定义.

100 { return FALSE; }

引用了 FALSE.

◆ parseInput()

void MarkdownOutlineParser::parseInput ( const QCString fileName,
const char *  fileBuf,
const std::shared_ptr< Entry > &  root,
ClangTUParser clangParser 
)
virtual

Parses a single input file with the goal to build an Entry tree.

参数
[in]fileNameThe full name of the file.
[in]fileBufThe contents of the file (zero terminated).
[in,out]rootThe root of the tree of Entry *nodes representing the information extracted from the file.
[in]clangParserThe clang translation unit parser object or nullptr if disabled.

实现了 OutlineParserInterface.

在文件 markdown.cpp3089 行定义.

3093 {
3094  std::shared_ptr<Entry> current = std::make_shared<Entry>();
3095  int prepend = 0; // number of empty lines in front
3096  current->lang = SrcLangExt_Markdown;
3097  current->fileName = fileName;
3098  current->docFile = fileName;
3099  current->docLine = 1;
3100  QCString docs = fileBuf;
3101  Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n",qPrint(fileBuf));
3102  QCString id;
3103  Markdown markdown(fileName,1,0);
3104  QCString title=markdown.extractPageTitle(docs,id,prepend).stripWhiteSpace();
3105  if (id.startsWith("autotoc_md")) id = "";
3106  int indentLevel=title.isEmpty() ? 0 : -1;
3107  markdown.setIndentLevel(indentLevel);
3108  QCString fn = FileInfo(fileName.str()).fileName();
3110  QCString mdfileAsMainPage = Config_getString(USE_MDFILE_AS_MAINPAGE);
3111  bool wasEmpty = id.isEmpty();
3112  if (wasEmpty) id = markdownFileNameToId(fileName);
3113  if (!isExplicitPage(docs))
3114  {
3115  if (!mdfileAsMainPage.isEmpty() &&
3116  (fn==mdfileAsMainPage || // name reference
3117  FileInfo(fileName.str()).absFilePath()==
3118  FileInfo(mdfileAsMainPage.str()).absFilePath()) // file reference with path
3119  )
3120  {
3121  docs.prepend("@anchor " + id + "\\ilinebr ");
3122  docs.prepend("@mainpage "+title+"\\ilinebr ");
3123  }
3124  else if (id=="mainpage" || id=="index")
3125  {
3126  if (title.isEmpty()) title = titleFn;
3127  docs.prepend("@anchor " + id + "\\ilinebr ");
3128  docs.prepend("@mainpage "+title+"\\ilinebr ");
3129  }
3130  else
3131  {
3132  if (title.isEmpty()) {title = titleFn;prepend=0;}
3133  if (!wasEmpty) docs.prepend("@anchor " + markdownFileNameToId(fileName) + "\\ilinebr ");
3134  docs.prepend("@page "+id+" "+title+"\\ilinebr ");
3135  }
3136  for (int i = 0; i < prepend; i++) docs.prepend("\n");
3137  }
3138  int lineNr=1;
3139 
3140  p->commentScanner.enterFile(fileName,lineNr);
3141  Protection prot=Public;
3142  bool needsEntry = FALSE;
3143  int position=0;
3144  QCString processedDocs = markdown.process(docs,lineNr,true);
3145  while (p->commentScanner.parseCommentBlock(
3146  this,
3147  current.get(),
3148  processedDocs,
3149  fileName,
3150  lineNr,
3151  FALSE, // isBrief
3152  FALSE, // javadoc autobrief
3153  FALSE, // inBodyDocs
3154  prot, // protection
3155  position,
3156  needsEntry,
3157  true))
3158  {
3159  if (needsEntry)
3160  {
3161  QCString docFile = current->docFile;
3162  root->moveToSubEntryAndRefresh(current);
3163  current->lang = SrcLangExt_Markdown;
3164  current->docFile = docFile;
3165  current->docLine = lineNr;
3166  }
3167  }
3168  if (needsEntry)
3169  {
3170  root->moveToSubEntryAndKeep(current);
3171  }
3172  p->commentScanner.leaveFile(fileName,lineNr);
3173 }

引用了 FileInfo::absFilePath(), Config_getString, Markdown::extractPageTitle(), FALSE, FileInfo::fileName(), getFileNameExtension(), QCString::isEmpty(), isExplicitPage(), Debug::Markdown, markdownFileNameToId(), p, QCString::prepend(), Debug::print(), Markdown::process(), Public, qPrint(), Markdown::setIndentLevel(), SrcLangExt_Markdown, QCString::str(), stripExtensionGeneral() , 以及 QCString::stripWhiteSpace().

◆ parsePrototype()

void MarkdownOutlineParser::parsePrototype ( const QCString text)
virtual

Callback function called by the comment block scanner.

It provides a string text containing the prototype of a function or variable. The parser should parse this and store the information in the Entry node that corresponds with the node for which the comment block parser was invoked.

实现了 OutlineParserInterface.

在文件 markdown.cpp3175 行定义.

3176 {
3177  Doxygen::parserManager->getOutlineParser("*.cpp")->parsePrototype(text);
3178 }

引用了 ParserManager::getOutlineParser() , 以及 Doxygen::parserManager.

类成员变量说明

◆ p

std::unique_ptr<Private> MarkdownOutlineParser::p
private

在文件 markdown.h103 行定义.

被这些函数引用 parseInput().


该类的文档由以下文件生成:
markdownFileNameToId
QCString markdownFileNameToId(const QCString &fileName)
processes string s and converts markdown into doxygen/html commands.
Definition: markdown.cpp:3053
Protection
Protection
Protection level of members
Definition: types.h:26
stripExtensionGeneral
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
Definition: util.cpp:5285
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
MarkdownOutlineParser::p
std::unique_ptr< Private > p
Definition: markdown.h:103
QCString::str
std::string str() const
Definition: qcstring.h:442
Public
@ Public
Definition: types.h:26
isExplicitPage
static bool isExplicitPage(const QCString &docs)
returns TRUE if input string docs starts with @page or @mainpage command
Definition: markdown.cpp:2856
QCString::stripWhiteSpace
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition: qcstring.h:243
Doxygen::parserManager
static ParserManager * parserManager
Definition: doxygen.h:111
ParserManager::getOutlineParser
std::unique_ptr< OutlineParserInterface > getOutlineParser(const QCString &extension)
Gets the interface to the parser associated with a given extension.
Definition: parserintf.h:208
Debug::print
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition: debug.cpp:57
Markdown
Helper class to process markdown formatted text
Definition: markdown.h:32
Debug::Markdown
@ Markdown
Definition: debug.h:37
FileInfo
Minimal replacement for QFileInfo.
Definition: fileinfo.h:22
FileInfo::absFilePath
std::string absFilePath() const
Definition: fileinfo.cpp:101
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
Config_getString
#define Config_getString(name)
Definition: config.h:32
SrcLangExt_Markdown
@ SrcLangExt_Markdown
Definition: types.h:57
getFileNameExtension
QCString getFileNameExtension(const QCString &fn)
Definition: util.cpp:5621
FileInfo::fileName
std::string fileName() const
Definition: fileinfo.cpp:118
QCString::prepend
QCString & prepend(const char *s)
Definition: qcstring.h:339
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108