56 const std::shared_ptr<Entry> &root,
57 ClangTUParser *clangParser) = 0;
82class CodeParserInterface
110 virtual
void parseCode(OutputCodeList &codeOutList,
111 const QCString &scopeName,
112 const QCString &input,
114 bool stripCodeComments,
116 const QCString &exampleName=QCString(),
117 const FileDef *fileDef=
nullptr,
120 bool inlineFragment=
FALSE,
121 const MemberDef *memberDef=
nullptr,
122 bool showLineNumbers=
TRUE,
123 const Definition *searchCtx=
nullptr,
124 bool collectXRefs=
TRUE
132 virtual
void resetCodeParserState() = 0;
152 : outlineParserFactory(opf), codeParserFactory(cpf), parserName(pn)
168 : m_defaultParsers(outlineParserFactory,codeParserFactory, QCString())
183 m_parsers.emplace(name.
str(),ParserPair(outlineParserFactory,codeParserFactory,name));
193 const auto &parserIt = m_parsers.find(parserName.
str());
194 if (parserIt == m_parsers.end())
return FALSE;
196 auto extensionIt = m_extensions.find(extension.
str());
197 if (extensionIt != m_extensions.end())
199 m_extensions.erase(extensionIt);
201 m_extensions.emplace(extension.
str(),parserIt->second);
211 return getParsers(extension).outlineParserFactory();
218 std::unique_ptr<CodeParserInterface>
getCodeParser(
const QCString &extension)
220 auto factory = getCodeParserFactory(extension);
227 return getParsers(extension).codeParserFactory;
236 return getParsers(extension).parserName;
242 QCString ext = extension.
lower();
243 if (ext.
isEmpty()) ext=
".no_extension";
244 auto it = m_extensions.
find(ext.
data());
245 if (it==m_extensions.end() && ext.
length()>4)
247 it = m_extensions.find(ext.
left(4).
data());
249 return it!=m_extensions.end() ? it->second : m_defaultParsers;
252 std::map<std::string,ParserPair> m_parsers;
253 std::map<std::string,ParserPair &> m_extensions;
254 ParserPair m_defaultParsers;
Clang parser object for a single translation unit, which consists of a source file and the directly o...
The common base class of all entity definitions found in the sources.
Represents an unstructured piece of information, about an entity found in the sources.
A model of a file symbol.
A model of a class/file/namespace member symbol.
Abstract interface for outline parsers.
virtual bool needsPreprocessing(const QCString &extension) const =0
Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed t...
virtual void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser)=0
Parses a single input file with the goal to build an Entry tree.
virtual void parsePrototype(const QCString &text)=0
Callback function called by the comment block scanner.
Class representing a list of different code generators.
bool registerExtension(const QCString &extension, const QCString &parserName)
Registers a file extension with a parser with name parserName.
void registerParser(const QCString &name, const OutlineParserFactory &outlineParserFactory, const CodeParserFactory &codeParserFactory)
Registers an additional parser.
std::unique_ptr< OutlineParserInterface > getOutlineParser(const QCString &extension)
Gets the interface to the parser associated with a given extension.
std::unique_ptr< CodeParserInterface > getCodeParser(const QCString &extension)
Gets the interface to the parser associated with a given extension.
CodeParserFactory & getCodeParserFactory(const QCString &extension)
Get the factory for create code parser objects with a given extension.
ParserManager(const OutlineParserFactory &outlineParserFactory, const CodeParserFactory &codeParserFactory)
Create the parser manager.
ParserPair & getParsers(const QCString &extension)
QCString getParserName(const QCString &extension)
Gets the name of the parser associated with given extension.
int find(char c, int index=0, bool cs=TRUE) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool isEmpty() const
Returns TRUE iff the string is empty.
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
QCString left(size_t len) const
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
std::function< std::unique_ptr< CodeParserInterface >()> CodeParserFactory
std::function< std::unique_ptr< OutlineParserInterface >()> OutlineParserFactory
ParserPair(OutlineParserFactory opf, const CodeParserFactory &cpf, const QCString &pn)
This file contains a number of basic enums and types.
SrcLangExt
Language as given by extension.