data: Extended CxxParser to detect elements

Detects most elements in the code, currently classes, structs, global variables, fields, functions, methods, namespaces
and enums. The structs ParseLocation and ParseVariable are helper objects to transmit information to the ParserClient.
Currently the parsed information only gets logged in the Storage.

review id = 15

fortune cookie message = In dreams and in life, nothing is impossible.
This commit is contained in:
Eberhard Graether
2014-05-19 12:51:00 +02:00
parent bb6640369a
commit 38c8aaebe8
15 changed files with 738 additions and 68 deletions
+33 -2
View File
@@ -2,16 +2,47 @@
#define PARSER_CLIENT_H
#include <string>
#include <vector>
#include "data/parser/ParseObject.h"
struct ParseLocation;
struct ParseVariable;
class ParserClient
{
public:
enum AccessType {
ACCESS_PUBLIC,
ACCESS_PROTECTED,
ACCESS_PRIVATE,
ACCESS_NONE
};
enum AbstractionType {
ABSTRACTION_VIRTUAL,
ABSTRACTION_PURE_VIRTUAL,
ABSTRACTION_NONE
};
ParserClient();
virtual ~ParserClient();
virtual void addClass(const ParseObject& object) = 0;
virtual void onClassParsed(const ParseLocation& location, const std::string& fullName, AccessType access) = 0;
virtual void onStructParsed(const ParseLocation& location, const std::string& fullName, AccessType access) = 0;
virtual void onGlobalVariableParsed(const ParseLocation& location, const ParseVariable& variable) = 0;
virtual void onFieldParsed(const ParseLocation& location, const ParseVariable& variable, AccessType access) = 0;
virtual void onFunctionParsed(
const ParseLocation& location, const std::string& fullName, const std::string& returnTypeName,
const std::vector<ParseVariable>& parameters) = 0;
virtual void onMethodParsed(const ParseLocation& location, const std::string& fullName,
const std::string& returnTypeName, const std::vector<ParseVariable>& parameters, AccessType access,
AbstractionType abstraction, bool isConst, bool isStatic) = 0;
virtual void onNamespaceParsed(const ParseLocation& location, const std::string& fullName) = 0;
virtual void onEnumParsed(const ParseLocation& location, const std::string& fullName, AccessType access) = 0;
virtual void onEnumFieldParsed(const ParseLocation& location, const std::string& fullName) = 0;
};
#endif // PARSER_CLIENT_H