data: Added CxxParser, currently only detecting classes

This change adds CxxParser a class for parsing cxx files. It holds basic functionality to detect classes using the clang
libTooling classes. CxxParser is derived from a common Parser interface, which can later be used for other language
parsers. The Parser forwards detected elements to a ParserClient interface, which is implemented by the Storage class.
The detected classes only get logged so far.

review id = 6

* bd3c63a - (HEAD, origin/class, class) applied second review <Eberhard Graether> (4 minutes ago)
* 3db7d93 - added missing files <Eberhard Graether> (4 days ago)
* 6d09f4e - applied review <Eberhard Graether> (4 days ago)
* d9d3e64 - fixed CMake files <Eberhard Graether> (4 days ago)
* f22a771 - only one Storage class <Eberhard Graether> (4 days ago)
* 6ee9553 - added tests <Eberhard Graether> (4 days ago)
* 0a525e8 - fixed includes <Eberhard Graether> (4 days ago)
* ca3fbb8 - added StorageManager as ParserClient <Eberhard Graether> (4 days ago)
* fa185a5 - renamed ParseLocation to ParseObject <Eberhard Graether> (4 days ago)
* 8b89808 - pass location with ParseLocation object <Eberhard Graether> (4 days ago)
* 548ae3c - renamed clang AST classes <Eberhard Graether> (4 days ago)
* d3b2caf - cleaned includes <Eberhard Graether> (4 days ago)
* f7fdf33 - removed using namespace stmts <Eberhard Graether> (4 days ago)
* 5378ef6 - using ParserClient <Eberhard Graether> (4 days ago)
* b9ce2f6 - working with test file <Eberhard Graether> (4 days ago)
* 5585abc - added CxxParser and ParserClient <Eberhard Graether> (4 days ago)
This commit is contained in:
Eberhard Graether
2014-05-06 14:50:51 +02:00
parent 6b82ea6860
commit 82c88ebd97
35 changed files with 436 additions and 156 deletions
+20 -2
View File
@@ -1,12 +1,21 @@
#include "Project.h"
#include <vector>
#include <string>
#include "data/parser/cxx/CxxParser.h"
std::shared_ptr<Project> Project::create(
const std::shared_ptr<CodeAccess>& codeAccess,
const std::shared_ptr<GraphAccess>& graphAccess)
std::shared_ptr<CodeAccess> codeAccess,
std::shared_ptr<GraphAccess> graphAccess
)
{
std::shared_ptr<Project> ptr(new Project());
ptr->m_codeAccess = codeAccess;
ptr->m_graphAccess = graphAccess;
ptr->m_storage = std::make_shared<Storage>();
return ptr;
}
@@ -22,3 +31,12 @@ const ProjectSettings& Project::getProjectSettings() const
{
return m_settings;
}
void Project::parseCode()
{
std::vector<std::string> filePaths;
filePaths.push_back("data/test_code.cpp");
CxxParser parser(m_storage);
parser.parseFiles(filePaths);
}