My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
MarkdownFileParser Class Reference

#include <markdown.h>

Inheritance diagram for MarkdownFileParser:
ParserInterface

Public Member Functions

virtual ~MarkdownFileParser ()
 
void startTranslationUnit (const char *)
 
void finishTranslationUnit ()
 
void parseInput (const char *fileName, const char *fileBuf, Entry *root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit)
 
bool needsPreprocessing (const QCString &)
 
void parseCode (CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, MemberDef *memberDef=0, bool showLineNumbers=TRUE, Definition *searchCtx=0, bool collectXRefs=TRUE)
 
void resetCodeParserState ()
 
void parsePrototype (const char *text)
 
- Public Member Functions inherited from ParserInterface
virtual ~ParserInterface ()
 

Detailed Description

Definition at line 28 of file markdown.h.

Constructor & Destructor Documentation

virtual MarkdownFileParser::~MarkdownFileParser ( )
inlinevirtual

Definition at line 31 of file markdown.h.

{}

Member Function Documentation

void MarkdownFileParser::finishTranslationUnit ( )
inlinevirtual

Called after all files in a translation unit have been processed.

Implements ParserInterface.

Definition at line 33 of file markdown.h.

{}
bool MarkdownFileParser::needsPreprocessing ( const QCString &  extension)
inlinevirtual

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

See Also
parseInput()

Implements ParserInterface.

Definition at line 39 of file markdown.h.

{ return FALSE; }
void MarkdownFileParser::parseCode ( CodeOutputInterface codeOutIntf,
const char *  scopeName,
const QCString &  input,
SrcLangExt  lang,
bool  isExampleBlock,
const char *  exampleName = 0,
FileDef fileDef = 0,
int  startLine = -1,
int  endLine = -1,
bool  inlineFragment = FALSE,
MemberDef memberDef = 0,
bool  showLineNumbers = TRUE,
Definition searchCtx = 0,
bool  collectXRefs = TRUE 
)
virtual

Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.

Parameters
[in]codeOutIntfAbstract interface for writing the result.
[in]langThe programming language of the code fragment.
[in]scopeNameName of scope to which the code belongs.
[in]inputActual code in the form of a string
[in]isExampleBlockTRUE iff the code is part of an example.
[in]exampleNameName of the example.
[in]fileDefFile definition to which the code is associated.
[in]startLineStarting line in case of a code fragment.
[in]endLineEnding line of the code fragment.
[in]inlineFragmentCode fragment that is to be shown inline as part of the documentation.
[in]memberDefMember definition to which the code is associated (non null in case of an inline fragment for a member).
[in]showLineNumbersif set to TRUE and also fileDef is not 0, line numbers will be added to the source fragement
[in]searchCtxcontext under which search data has to be stored.
[in]collectXRefscollect cross-reference relations.

Implements ParserInterface.

Definition at line 2464 of file markdown.cpp.

References ParserManager::getParser(), ParserInterface::parseCode(), and Doxygen::parserManager.

{
if (pIntf!=this)
{
pIntf->parseCode(
codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName,
fileDef,startLine,endLine,inlineFragment,memberDef,showLineNumbers,
searchCtx,collectXRefs);
}
}
void MarkdownFileParser::parseInput ( const char *  fileName,
const char *  fileBuf,
Entry root,
bool  sameTranslationUnit,
QStrList &  filesInSameTranslationUnit 
)
virtual

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

Parameters
[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]sameTranslationUnitTRUE if this file was found in the same translation unit (in the filesInSameTranslationUnit list returned for another file).
[in,out]filesInSameTranslationUnitother files expected to be found in the same translation unit (used for libclang)

Implements ParserInterface.

Definition at line 2382 of file markdown.cpp.

References Entry::addSubEntry(), Config_getString, Entry::docFile, Entry::docLine, extractPageTitle(), Entry::fileName, isExplicitPage(), Entry::lang, markdownFileNameToId(), Doxygen::markdownSupport, parseCommentBlock(), Public, and SrcLangExt_Markdown.

{
Entry *current = new Entry;
current->fileName = fileName;
current->docFile = fileName;
current->docLine = 1;
QCString docs = fileBuf;
QCString id;
QCString title=extractPageTitle(docs,id).stripWhiteSpace();
QCString titleFn = QFileInfo(fileName).baseName().utf8();
QCString fn = QFileInfo(fileName).fileName().utf8();
static QCString mdfileAsMainPage = Config_getString(USE_MDFILE_AS_MAINPAGE);
if (id.isEmpty()) id = markdownFileNameToId(fileName);
if (!isExplicitPage(docs))
{
if (!mdfileAsMainPage.isEmpty() &&
(fn==mdfileAsMainPage || // name reference
QFileInfo(fileName).absFilePath()==
QFileInfo(mdfileAsMainPage).absFilePath()) // file reference with path
)
{
docs.prepend("@mainpage "+title+"\n");
}
else if (id=="mainpage" || id=="index")
{
if (title.isEmpty()) title = titleFn;
docs.prepend("@mainpage "+title+"\n");
}
else
{
if (title.isEmpty()) title = titleFn;
docs.prepend("@page "+id+" "+title+"\n");
}
}
int lineNr=1;
int position=0;
// even without markdown support enabled, we still
// parse markdown files as such
bool markdownEnabled = Doxygen::markdownSupport;
bool needsEntry = FALSE;
this,
current,
docs,
fileName,
lineNr,
FALSE, // isBrief
FALSE, // javadoc autobrief
FALSE, // inBodyDocs
prot, // protection
position,
needsEntry))
{
if (needsEntry)
{
QCString docFile = current->docFile;
root->addSubEntry(current);
current = new Entry;
current->docFile = docFile;
current->docLine = lineNr;
}
}
if (needsEntry)
{
root->addSubEntry(current);
}
// restore setting
Doxygen::markdownSupport = markdownEnabled;
//g_correctSectionLevel = FALSE;
}
void MarkdownFileParser::parsePrototype ( const char *  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.

Implements ParserInterface.

Definition at line 2499 of file markdown.cpp.

References ParserManager::getParser(), ParserInterface::parsePrototype(), and Doxygen::parserManager.

{
if (pIntf!=this)
{
pIntf->parsePrototype(text);
}
}
void MarkdownFileParser::resetCodeParserState ( )
virtual

Resets the state of the code parser. Since multiple code fragments can together form a single example, an explicit function is used to reset the code parser state.

See Also
parseCode()

Implements ParserInterface.

Definition at line 2490 of file markdown.cpp.

References ParserManager::getParser(), Doxygen::parserManager, and ParserInterface::resetCodeParserState().

{
if (pIntf!=this)
{
}
}
void MarkdownFileParser::startTranslationUnit ( const char *  fileName)
inlinevirtual

Starts processing a translation unit (source files + headers). After this call parseInput() is called with sameTranslationUnit set to FALSE. If parseInput() returns additional include files, these are also processed using parseInput() with sameTranslationUnit set to TRUE. After that finishTranslationUnit() is called.

Implements ParserInterface.

Definition at line 32 of file markdown.h.

{}

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