summaryrefslogtreecommitdiffstats
path: root/src/parserintf.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/parserintf.h')
-rw-r--r--src/parserintf.h42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/parserintf.h b/src/parserintf.h
index 2fde2f1..ccb4359 100644
--- a/src/parserintf.h
+++ b/src/parserintf.h
@@ -18,8 +18,6 @@
#ifndef PARSERINTF_H
#define PARSERINTF_H
-#include <qstrlist.h>
-
#include <functional>
#include <memory>
#include <map>
@@ -54,7 +52,7 @@ class OutlineParserInterface
* @param[in] clangParser The clang translation unit parser object
* or nullptr if disabled.
*/
- virtual void parseInput(const char *fileName,
+ virtual void parseInput(const QCString &fileName,
const char *fileBuf,
const std::shared_ptr<Entry> &root,
ClangTUParser *clangParser) = 0;
@@ -72,7 +70,7 @@ class OutlineParserInterface
* in the Entry node that corresponds with the node for which the
* comment block parser was invoked.
*/
- virtual void parsePrototype(const char *text) = 0;
+ virtual void parsePrototype(const QCString &text) = 0;
};
@@ -90,9 +88,9 @@ class CodeParserInterface
/** Parses a source file or fragment with the goal to produce
* highlighted and cross-referenced output.
* @param[in] codeOutIntf Abstract interface for writing the result.
- * @param[in] lang The programming language of the code fragment.
* @param[in] scopeName Name of scope to which the code belongs.
* @param[in] input Actual code in the form of a string
+ * @param[in] lang The programming language of the code fragment.
* @param[in] isExampleBlock TRUE iff the code is part of an example.
* @param[in] exampleName Name of the example.
* @param[in] fileDef File definition to which the code
@@ -110,11 +108,11 @@ class CodeParserInterface
* @param[in] collectXRefs collect cross-reference relations.
*/
virtual void parseCode(CodeOutputInterface &codeOutIntf,
- const char *scopeName,
+ const QCString &scopeName,
const QCString &input,
SrcLangExt lang,
bool isExampleBlock,
- const char *exampleName=0,
+ const QCString &exampleName=QCString(),
FileDef *fileDef=0,
int startLine=-1,
int endLine=-1,
@@ -149,7 +147,7 @@ class ParserManager
struct ParserPair
{
- ParserPair(OutlineParserFactory opf, CodeParserFactory cpf, const QCString pn)
+ ParserPair(OutlineParserFactory opf, CodeParserFactory cpf, const QCString &pn)
: outlineParserFactory(opf), codeParserFactory(cpf), parserName(pn)
{
}
@@ -166,7 +164,7 @@ class ParserManager
*/
ParserManager(OutlineParserFactory outlineParserFactory,
CodeParserFactory codeParserFactory)
- : m_defaultParsers(outlineParserFactory,codeParserFactory, "")
+ : m_defaultParsers(outlineParserFactory,codeParserFactory, QCString())
{
}
@@ -178,28 +176,28 @@ class ParserManager
* @param[in] codeParserFactory A factory method to create a code parser that is to be used
* for the given name.
*/
- void registerParser(const char *name,OutlineParserFactory outlineParserFactory,
+ void registerParser(const QCString &name,OutlineParserFactory outlineParserFactory,
CodeParserFactory codeParserFactory)
{
- m_parsers.emplace(std::string(name),ParserPair(outlineParserFactory,codeParserFactory,name));
+ m_parsers.emplace(name.str(),ParserPair(outlineParserFactory,codeParserFactory,name));
}
/** Registers a file \a extension with a parser with name \a parserName.
* Returns TRUE if the extension was successfully registered.
*/
- bool registerExtension(const char *extension, const char *parserName)
+ bool registerExtension(const QCString &extension, const QCString &parserName)
{
- if (parserName==0 || extension==0) return FALSE;
+ if (parserName.isEmpty() || extension.isEmpty()) return FALSE;
- const auto &parserIt = m_parsers.find(parserName);
+ const auto &parserIt = m_parsers.find(parserName.str());
if (parserIt == m_parsers.end()) return FALSE;
- auto extensionIt = m_extensions.find(extension);
+ auto extensionIt = m_extensions.find(extension.str());
if (extensionIt != m_extensions.end()) // extension already exists
{
m_extensions.erase(extensionIt); // remove it (e.g. user specified extension overrules built in one)
}
- m_extensions.emplace(std::string(extension),parserIt->second); // add new mapping
+ m_extensions.emplace(extension.str(),parserIt->second); // add new mapping
return TRUE;
}
@@ -207,7 +205,7 @@ class ParserManager
* If there is no parser explicitly registered for the supplied extension,
* the interface to the default parser will be returned.
*/
- std::unique_ptr<OutlineParserInterface> getOutlineParser(const char *extension)
+ std::unique_ptr<OutlineParserInterface> getOutlineParser(const QCString &extension)
{
return getParsers(extension).outlineParserFactory();
}
@@ -216,14 +214,14 @@ class ParserManager
* If there is no parser explicitly registered for the supplied extension,
* the interface to the default parser will be returned.
*/
- std::unique_ptr<CodeParserInterface> getCodeParser(const char *extension)
+ std::unique_ptr<CodeParserInterface> getCodeParser(const QCString &extension)
{
auto factory = getCodeParserFactory(extension);
return factory();
}
/** Get the factory for create code parser objects with a given \a extension. */
- CodeParserFactory &getCodeParserFactory(const char *extension)
+ CodeParserFactory &getCodeParserFactory(const QCString &extension)
{
return getParsers(extension).codeParserFactory;
}
@@ -232,15 +230,15 @@ class ParserManager
* If there is no parser explicitly registered for the supplied extension,
* te empty string will be reurned.
*/
- QCString getParserName(const char *extension)
+ QCString getParserName(const QCString &extension)
{
return getParsers(extension).parserName;
}
private:
- ParserPair &getParsers(const char *extension)
+ ParserPair &getParsers(const QCString &extension)
{
- QCString ext = QCString(extension).lower().data();
+ QCString ext = extension.lower();
if (ext.isEmpty()) ext=".no_extension";
auto it = m_extensions.find(ext.data());
if (it==m_extensions.end() && ext.length()>4)