- ASTVisitor uses DataType instead of string to pass on type information. - Edges can have EdgeComponents. - EdgeComponentDataType stores information that modifies the type a ...TYPE_OF edge points to. - EdgeComponentDataType can create a complete DataType using it's internal information. - Fixed a bug where DataTypeModifiers did not apply their qualifiers.
81 lines
3.0 KiB
C++
81 lines
3.0 KiB
C++
#ifndef STORAGE_H
|
|
#define STORAGE_H
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "data/access/GraphAccess.h"
|
|
#include "data/access/LocationAccess.h"
|
|
#include "data/graph/Graph.h"
|
|
#include "data/location/TokenLocationCollection.h"
|
|
#include "data/parser/ParserClient.h"
|
|
|
|
class Storage
|
|
: public ParserClient
|
|
, public GraphAccess
|
|
, public LocationAccess
|
|
{
|
|
public:
|
|
Storage();
|
|
virtual ~Storage();
|
|
|
|
void clear();
|
|
|
|
void logGraph() const;
|
|
void logLocations() const;
|
|
|
|
// ParserClient implementation
|
|
virtual void onTypedefParsed(
|
|
const ParseLocation& location, const std::string& fullName, const DataType& underlyingType,
|
|
AccessType access
|
|
);
|
|
virtual void onClassParsed(const ParseLocation& location, const std::string& fullName, AccessType access);
|
|
virtual void onStructParsed(const ParseLocation& location, const std::string& fullName, AccessType access);
|
|
|
|
virtual void onGlobalVariableParsed(const ParseLocation& location, const ParseVariable& variable);
|
|
virtual void onFieldParsed(const ParseLocation& location, const ParseVariable& variable, AccessType access);
|
|
|
|
virtual void onFunctionParsed(
|
|
const ParseLocation& location, const std::string& fullName, const DataType& returnType,
|
|
const std::vector<ParseVariable>& parameters);
|
|
virtual void onMethodParsed(
|
|
const ParseLocation& location, const std::string& fullName, const DataType& returnType,
|
|
const std::vector<ParseVariable>& parameters, AccessType access, AbstractionType abstraction,
|
|
bool isConst, bool isStatic
|
|
);
|
|
|
|
virtual void onNamespaceParsed(const ParseLocation& location, const std::string& fullName);
|
|
|
|
virtual void onEnumParsed(const ParseLocation& location, const std::string& fullName, AccessType access);
|
|
virtual void onEnumFieldParsed(const ParseLocation& location, const std::string& fullName);
|
|
|
|
virtual void onInheritanceParsed(
|
|
const ParseLocation& location, const std::string& fullName, const std::string& baseName, AccessType access);
|
|
virtual void onCallParsed(
|
|
const ParseLocation& location, const std::string& callerName, const std::string& calleeName);
|
|
|
|
// GraphAccess implementation
|
|
virtual Id getIdForNodeWithName(const std::string& name) const;
|
|
virtual std::string getNameForNodeWithId(Id id) const;
|
|
virtual std::vector<std::string> getNamesForNodesWithNamePrefix(const std::string& prefix) const;
|
|
virtual std::vector<Id> getIdsOfNeighbours(const Id id) const;
|
|
virtual std::vector<std::pair<Id, Id>> getConnectedEdges(const Id id) const;
|
|
|
|
// LocationAccess implementation
|
|
virtual TokenLocationCollection getTokenLocationsForTokenId(Id locationId) const;
|
|
virtual TokenLocationFile getTokenLocationsForLinesInFile(
|
|
const std::string& fileName, unsigned int firstLineNumber, unsigned int lastLineNumber
|
|
) const;
|
|
|
|
private:
|
|
Edge::AccessType convertAccessType(ParserClient::AccessType access) const;
|
|
TokenLocation* addTokenLocation(Token* token, const ParseLocation& location);
|
|
|
|
void log(std::string type, std::string str, const ParseLocation& location) const;
|
|
|
|
Graph m_graph;
|
|
TokenLocationCollection m_locationCollection;
|
|
};
|
|
|
|
#endif // STORAGE_H
|