logic: indexer commands
* replaced parser arguments by project specific IndexerCommands that know everything the indexer needs to know to do its job * added different language and project specific indexers that know how to handle a certain kind of indexer command * refactored FileManager and FileRegister to have less overhead * removed no-rtti restriction for clang files in lib cxx * uncommented deprecated interprocess code. fortune cookie message = Happiness will bring you good luck.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "data/indexer/IndexerCommandJava.h"
|
||||
|
||||
std::string IndexerCommandJava::getIndexerKindString()
|
||||
{
|
||||
return "Java";
|
||||
}
|
||||
|
||||
IndexerCommandJava::IndexerCommandJava(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::set<FilePath>& indexedPaths,
|
||||
const std::set<FilePath>& excludedPaths,
|
||||
const std::vector<FilePath>& classPath
|
||||
)
|
||||
: IndexerCommand(sourceFilePath, indexedPaths, excludedPaths)
|
||||
, m_classPath(classPath)
|
||||
{
|
||||
}
|
||||
|
||||
IndexerCommandJava::~IndexerCommandJava()
|
||||
{
|
||||
}
|
||||
|
||||
std::string IndexerCommandJava::getKindString() const
|
||||
{
|
||||
return getIndexerKindString();
|
||||
}
|
||||
|
||||
std::vector<FilePath> IndexerCommandJava::getClassPath() const
|
||||
{
|
||||
return m_classPath;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef INDEXER_COMMAND_JAVA_H
|
||||
#define INDEXER_COMMAND_JAVA_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "data/indexer/IndexerCommand.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class IndexerCommandJava: public IndexerCommand
|
||||
{
|
||||
public:
|
||||
static std::string getIndexerKindString();
|
||||
|
||||
IndexerCommandJava(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::set<FilePath>& indexedPaths,
|
||||
const std::set<FilePath>& excludedPaths,
|
||||
const std::vector<FilePath>& classPath);
|
||||
virtual ~IndexerCommandJava();
|
||||
|
||||
virtual std::string getKindString() const;
|
||||
|
||||
std::vector<FilePath> getClassPath() const;
|
||||
|
||||
private:
|
||||
std::vector<FilePath> m_classPath;
|
||||
};
|
||||
|
||||
#endif // INDEXER_COMMAND_JAVA_H
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "data/indexer/IndexerFactoryModuleJava.h"
|
||||
|
||||
#include "data/indexer/IndexerJava.h"
|
||||
|
||||
IndexerFactoryModuleJava::~IndexerFactoryModuleJava()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<IndexerBase> IndexerFactoryModuleJava::createIndexer()
|
||||
{
|
||||
return std::make_shared<IndexerJava>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef INDEXER_FACTORY_MODULE_JAVA_H
|
||||
#define INDEXER_FACTORY_MODULE_JAVA_H
|
||||
|
||||
#include "data/indexer/IndexerFactoryModule.h"
|
||||
|
||||
class IndexerFactoryModuleJava: public IndexerFactoryModule
|
||||
{
|
||||
public:
|
||||
virtual ~IndexerFactoryModuleJava();
|
||||
virtual std::shared_ptr<IndexerBase> createIndexer();
|
||||
};
|
||||
|
||||
#endif // INDEXER_FACTORY_MODULE_JAVA_H
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "data/indexer/IndexerJava.h"
|
||||
|
||||
#include "data/parser/ParserClientImpl.h"
|
||||
#include "data/parser/java/JavaParser.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
|
||||
IndexerJava::IndexerJava()
|
||||
{
|
||||
}
|
||||
|
||||
IndexerJava::~IndexerJava()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<IntermediateStorage> IndexerJava::index(std::shared_ptr<IndexerCommandJava> indexerCommand, std::shared_ptr<FileRegister> fileRegister)
|
||||
{
|
||||
std::shared_ptr<ParserClientImpl> parserClient = std::make_shared<ParserClientImpl>();
|
||||
std::shared_ptr<JavaParser> parser = std::make_shared<JavaParser>(parserClient);
|
||||
|
||||
std::shared_ptr<IntermediateStorage> storage = std::make_shared<IntermediateStorage>();
|
||||
parserClient->setStorage(storage);
|
||||
parserClient->startParsingFile();
|
||||
|
||||
fileRegister->markFileIndexing(indexerCommand->getSourceFilePath());
|
||||
parser->buildIndex(indexerCommand);
|
||||
fileRegister->markIndexingFilesIndexed();
|
||||
|
||||
parserClient->finishParsingFile();
|
||||
parserClient->resetStorage();
|
||||
|
||||
if (interrupted())
|
||||
{
|
||||
return std::shared_ptr<IntermediateStorage>();
|
||||
}
|
||||
|
||||
return storage;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef INDEXER_JAVA_H
|
||||
#define INDEXER_JAVA_H
|
||||
|
||||
#include "data/indexer/Indexer.h"
|
||||
#include "data/indexer/IndexerCommandJava.h"
|
||||
|
||||
class IndexerJava: public Indexer<IndexerCommandJava>
|
||||
{
|
||||
public:
|
||||
IndexerJava();
|
||||
virtual ~IndexerJava();
|
||||
|
||||
private:
|
||||
virtual std::shared_ptr<IntermediateStorage> index(std::shared_ptr<IndexerCommandJava> indexerCommand, std::shared_ptr<FileRegister> fileRegister);
|
||||
};
|
||||
|
||||
#endif // INDEXER_JAVA_H
|
||||
Reference in New Issue
Block a user