logic: File Manager

* added FileManager that keeps track of the files analyzed by the project. It therefore checks if files get added, updated or deleted from the source- and include folders.
* refactored ASTVisitor::hasValidLocation() and implemented one version that search for the location in the currently parsed file and one that searches in all the project's source files.
* quickfix: switched order in FileManager so that header files are parsed first.
* created folder for helper classes used in tests.
* added test code for FileManager
* adjusted test code for Parser Tests.
This commit is contained in:
malte_langkabel
2015-02-09 14:52:31 +01:00
parent 4da51180ca
commit 8bc11c9d9c
43 changed files with 536 additions and 124 deletions
+16
View File
@@ -0,0 +1,16 @@
#include "TestFileManager.h"
TestFileManager::TestFileManager()
: FileManager(
std::vector<std::string>(),
std::vector<std::string>(),
std::vector<std::string>(),
std::vector<std::string>()
)
{
}
bool TestFileManager::hasFilePath(const std::string& filePath) const
{
return true;
}
+13
View File
@@ -0,0 +1,13 @@
#ifndef TEST_FILE_MANAGER_H
#define TEST_FILE_MANAGER_H
#include "utility/file/FileManager.h"
class TestFileManager: public FileManager
{
public:
TestFileManager();
virtual bool hasFilePath(const std::string& filePath) const;
};
#endif // TEST_FILE_MANAGER_H
+18
View File
@@ -0,0 +1,18 @@
#include "TestStorage.h"
#include "utility/text/TextAccess.h"
#include "data/parser/cxx/CxxParser.h"
#include "TestFileManager.h"
void TestStorage::parseCxxCode(std::string code)
{
clear();
TestFileManager fm;
CxxParser parser(this, &fm);
parser.parseFile(TextAccess::createFromString(code));
}
const Graph& TestStorage::getGraph() const
{
return Storage::getGraph();
}
+14
View File
@@ -0,0 +1,14 @@
#ifndef TEST_STORAGE_H
#define TEST_STORAGE_H
#include "data/Storage.h"
class TestStorage
: public Storage
{
public:
void parseCxxCode(std::string code);
const Graph& getGraph() const;
};
#endif // TEST_STORAGE_H