doxygen
Classes | Public Member Functions | List of all members
ParserManager Class Reference

Manages programming language parsers. More...

#include <parserintf.h>

Public Member Functions

 ParserManager (OutlineParserFactory outlineParserFactory, CodeParserFactory codeParserFactory)
 Create the parser manager. More...
 
void registerParser (const char *name, OutlineParserFactory outlineParserFactory, CodeParserFactory codeParserFactory)
 Registers an additional parser. More...
 
bool registerExtension (const char *extension, const char *parserName)
 Registers a file extension with a parser with name parserName. More...
 
std::unique_ptr< OutlineParserInterfacegetOutlineParser (const char *extension)
 Gets the interface to the parser associated with a given extension. More...
 
std::unique_ptr< CodeParserInterfacegetCodeParser (const char *extension)
 Gets the interface to the parser associated with a given extension. More...
 
CodeParserFactory & getCodeParserFactory (const char *extension)
 Get the factory for create code parser objects with a given extension. More...
 
QCString getParserName (const char *extension)
 Gets the name of the parser associated with given extension. More...
 

Detailed Description

Manages programming language parsers.

This class manages the language parsers in the system. One can register parsers, and obtain a parser given a file extension.

Constructor & Destructor Documentation

◆ ParserManager()

ParserManager::ParserManager ( OutlineParserFactory  outlineParserFactory,
CodeParserFactory  codeParserFactory 
)
inline

Create the parser manager.

Parameters
outlineParserFactorythe fallback outline parser factory to use for unknown extensions
codeParserFactorythe fallback code parser factory to use for unknown extensions

Member Function Documentation

◆ getCodeParser()

std::unique_ptr<CodeParserInterface> ParserManager::getCodeParser ( const char *  extension)
inline

Gets the interface to the parser associated with a given extension.

If there is no parser explicitly registered for the supplied extension, the interface to the default parser will be returned.

◆ getCodeParserFactory()

CodeParserFactory& ParserManager::getCodeParserFactory ( const char *  extension)
inline

Get the factory for create code parser objects with a given extension.

◆ getOutlineParser()

std::unique_ptr<OutlineParserInterface> ParserManager::getOutlineParser ( const char *  extension)
inline

Gets the interface to the parser associated with a given extension.

If there is no parser explicitly registered for the supplied extension, the interface to the default parser will be returned.

◆ getParserName()

QCString ParserManager::getParserName ( const char *  extension)
inline

Gets the name of the parser associated with given extension.

If there is no parser explicitly registered for the supplied extension, te empty string will be reurned.

◆ registerExtension()

bool ParserManager::registerExtension ( const char *  extension,
const char *  parserName 
)
inline

Registers a file extension with a parser with name parserName.

Returns TRUE if the extension was successfully registered.

◆ registerParser()

void ParserManager::registerParser ( const char *  name,
OutlineParserFactory  outlineParserFactory,
CodeParserFactory  codeParserFactory 
)
inline

Registers an additional parser.

Parameters
[in]nameA symbolic name of the parser, i.e. "c", "python", "fortran", "vhdl", ...
[in]outlineParserFactoryA factory method to create a language parser (scanner) that is to be used for the given name.
[in]codeParserFactoryA factory method to create a code parser that is to be used for the given name.

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