src: code cleanup
* removed unused code: ParseFunction, ParseVariable and ParseTypeUsage. All this is handled using NameHierarchies now. * Moved the getErrorCount method from ParserClient to the StorageAccess * MessageFinishedParsing doesn't know the error count anymore. * StatusBarController now has a StorageAccess to fetch the error count when needed.
This commit is contained in:
@@ -19,10 +19,7 @@
|
||||
#include "data/location/TokenLocation.h"
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
#include "data/location/TokenLocationLine.h"
|
||||
#include "data/parser/ParseFunction.h"
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ParseTypeUsage.h"
|
||||
#include "data/parser/ParseVariable.h"
|
||||
#include "data/type/DataType.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
@@ -209,11 +206,6 @@ void Storage::onError(const ParseLocation& location, const std::string& message,
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCountInfo Storage::getErrorCount() const
|
||||
{
|
||||
return ErrorCountInfo(m_sqliteStorage.getAllErrors().size(), m_sqliteStorage.getFatalErrors().size());
|
||||
}
|
||||
|
||||
Id Storage::onTypedefParsed(
|
||||
const ParseLocation& location, const NameHierarchy& typedefName, AccessType access
|
||||
){
|
||||
@@ -1091,6 +1083,11 @@ TimePoint Storage::getFileModificationTime(const FilePath& filePath) const
|
||||
return TimePoint(m_sqliteStorage.getFileByPath(filePath.str()).modificationTime);
|
||||
}
|
||||
|
||||
ErrorCountInfo Storage::getErrorCount() const
|
||||
{
|
||||
return ErrorCountInfo(m_sqliteStorage.getAllErrors().size(), m_sqliteStorage.getFatalErrors().size());
|
||||
}
|
||||
|
||||
StorageStats Storage::getStorageStats() const
|
||||
{
|
||||
StorageStats stats;
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
const ParseLocation& location, const NameHierarchy& argumentTypeNameHierarchy,
|
||||
const NameHierarchy& templateNameHierarchy);
|
||||
virtual Id onTemplateDefaultArgumentTypeParsed(
|
||||
const ParseLocation& location, const NameHierarchy& defaultArgumentTypeNameHierarchy,
|
||||
const ParseLocation& location, const NameHierarchy& defaultArgumentTypeNameHierarchy,
|
||||
const NameHierarchy& templateParameterNameHierarchy);
|
||||
virtual Id onTemplateParameterTypeParsed(
|
||||
const ParseLocation& location, const NameHierarchy& templateParameterTypeNameHierarchy);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "data/graph/Node.h"
|
||||
#include "data/search/SearchMatch.h"
|
||||
#include "data/ErrorCountInfo.h"
|
||||
#include "data/StorageStats.h"
|
||||
|
||||
struct FileInfo;
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const = 0;
|
||||
virtual TimePoint getFileModificationTime(const FilePath& filePath) const = 0;
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const = 0;
|
||||
virtual StorageStats getStorageStats() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -275,6 +275,16 @@ TimePoint StorageAccessProxy::getFileModificationTime(const FilePath& filePath)
|
||||
return TimePoint(boost::posix_time::not_a_date_time);
|
||||
}
|
||||
|
||||
ErrorCountInfo StorageAccessProxy::getErrorCount() const
|
||||
{
|
||||
if (hasSubject())
|
||||
{
|
||||
return m_subject->getErrorCount();
|
||||
}
|
||||
|
||||
return ErrorCountInfo();
|
||||
}
|
||||
|
||||
StorageStats StorageAccessProxy::getStorageStats() const
|
||||
{
|
||||
if (hasSubject())
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
|
||||
virtual TimePoint getFileModificationTime(const FilePath& filePath) const;
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const;
|
||||
virtual StorageStats getStorageStats() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "data/parser/ParseFunction.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
ParseFunction::ParseFunction(
|
||||
const ParseTypeUsage& returnType,
|
||||
const NameHierarchy& nameHierarchy,
|
||||
const std::vector<ParseTypeUsage>& parameters,
|
||||
bool isStatic,
|
||||
bool isConst
|
||||
)
|
||||
: returnType(returnType)
|
||||
, nameHierarchy(nameHierarchy)
|
||||
, parameters(parameters)
|
||||
, isStatic(isStatic)
|
||||
, isConst(isConst)
|
||||
{
|
||||
}
|
||||
|
||||
std::string ParseFunction::getFullName() const
|
||||
{
|
||||
return nameHierarchy.getQualifiedNameWithSignature();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef PARSE_FUNCTION_H
|
||||
#define PARSE_FUNCTION_H
|
||||
|
||||
#include "data/name/NameHierarchy.h"
|
||||
#include "data/parser/ParseTypeUsage.h"
|
||||
|
||||
struct ParseFunction
|
||||
{
|
||||
ParseFunction(
|
||||
const ParseTypeUsage& returnType,
|
||||
const NameHierarchy& nameHierarchy,
|
||||
const std::vector<ParseTypeUsage>& parameters,
|
||||
bool isStatic = false,
|
||||
bool isConst = false
|
||||
);
|
||||
|
||||
std::string getFullName() const;
|
||||
|
||||
const ParseTypeUsage returnType;
|
||||
const NameHierarchy nameHierarchy;
|
||||
const std::vector<ParseTypeUsage> parameters;
|
||||
const bool isStatic;
|
||||
const bool isConst;
|
||||
};
|
||||
|
||||
#endif // PARSE_FUNCTION_H
|
||||
@@ -1,7 +0,0 @@
|
||||
#include "data/parser/ParseTypeUsage.h"
|
||||
|
||||
ParseTypeUsage::ParseTypeUsage(const ParseLocation& location, const std::shared_ptr<DataType> dataType)
|
||||
: location(location)
|
||||
, dataType(dataType)
|
||||
{
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef PARSE_TYPE_USAGE_H
|
||||
#define PARSE_TYPE_USAGE_H
|
||||
|
||||
#include <memory>
|
||||
#include "data/type/DataType.h"
|
||||
#include "data/parser/ParseLocation.h"
|
||||
|
||||
struct ParseTypeUsage
|
||||
{
|
||||
ParseTypeUsage(const ParseLocation& location, const std::shared_ptr<DataType> dataType);
|
||||
|
||||
const ParseLocation location;
|
||||
const std::shared_ptr<DataType> dataType;
|
||||
};
|
||||
|
||||
#endif // PARSE_TYPE_USAGE_H
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "data/parser/ParseVariable.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
ParseVariable::ParseVariable(const ParseTypeUsage& type, const NameHierarchy& nameHierarchy, bool isStatic)
|
||||
: type(type)
|
||||
, nameHierarchy(nameHierarchy)
|
||||
, isStatic(isStatic)
|
||||
{
|
||||
}
|
||||
|
||||
std::string ParseVariable::getFullName() const
|
||||
{
|
||||
return nameHierarchy.getQualifiedNameWithSignature();
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef PARSE_VARIABLE_H
|
||||
#define PARSE_VARIABLE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "data/name/NameHierarchy.h"
|
||||
#include "data/parser/ParseTypeUsage.h"
|
||||
|
||||
struct ParseVariable
|
||||
{
|
||||
ParseVariable(const ParseTypeUsage& type, const NameHierarchy& nameHierarchy, bool isStatic);
|
||||
|
||||
std::string getFullName() const;
|
||||
|
||||
const ParseTypeUsage type;
|
||||
const NameHierarchy nameHierarchy;
|
||||
const bool isStatic;
|
||||
};
|
||||
|
||||
#endif // PARSE_VARIABLE_H
|
||||
@@ -2,10 +2,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "data/parser/ParseFunction.h"
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ParseTypeUsage.h"
|
||||
#include "data/parser/ParseVariable.h"
|
||||
#include "data/type/DataType.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
@@ -85,34 +82,6 @@ std::string ParserClient::addLocationSuffix(
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string ParserClient::variableStr(const ParseVariable& variable)
|
||||
{
|
||||
std::string str = variable.type.dataType->getFullTypeName() + " " + variable.getFullName();
|
||||
return addStaticPrefix(str, variable.isStatic);
|
||||
}
|
||||
|
||||
std::string ParserClient::parameterStr(const std::vector<ParseTypeUsage> parameters)
|
||||
{
|
||||
std::string str = "(";
|
||||
for (size_t i = 0; i < parameters.size(); i++)
|
||||
{
|
||||
str += parameters[i].dataType->getFullTypeName();
|
||||
if (i < parameters.size() - 1)
|
||||
{
|
||||
str += ", ";
|
||||
}
|
||||
}
|
||||
return str + ")";
|
||||
}
|
||||
|
||||
std::string ParserClient::functionStr(const ParseFunction& function)
|
||||
{
|
||||
/*std::string str =
|
||||
function.returnType.dataType->getFullTypeName() + " " + function.getFullName() + parameterStr(function.parameters);
|
||||
return addConstPrefix(addStaticPrefix(str, function.isStatic), function.isConst, false);*/
|
||||
return function.nameHierarchy.getQualifiedNameWithSignature();
|
||||
}
|
||||
|
||||
ParserClient::ParserClient()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,17 +6,10 @@
|
||||
|
||||
#include "utility/types.h"
|
||||
#include "data/name/NameHierarchy.h"
|
||||
#include "data/ErrorCountInfo.h"
|
||||
|
||||
#include "utility/file/FileInfo.h"
|
||||
|
||||
#include "ParseLocation.h"
|
||||
|
||||
|
||||
struct ParseFunction;
|
||||
struct ParseLocation;
|
||||
struct ParseTypeUsage;
|
||||
struct ParseVariable;
|
||||
class DataType;
|
||||
|
||||
class ParserClient
|
||||
@@ -48,10 +41,6 @@ public:
|
||||
static std::string addLocationSuffix(
|
||||
const std::string& str, const ParseLocation& location, const ParseLocation& scopeLocation);
|
||||
|
||||
static std::string variableStr(const ParseVariable& variable);
|
||||
static std::string parameterStr(const std::vector<ParseTypeUsage> parameters);
|
||||
static std::string functionStr(const ParseFunction& function);
|
||||
static std::string functionSignatureStr(const ParseFunction& function); // should this be in here? consider languages other than c++.
|
||||
|
||||
ParserClient();
|
||||
virtual ~ParserClient();
|
||||
@@ -63,7 +52,6 @@ public:
|
||||
virtual void finishParsingFile(const FilePath& filePath) = 0;
|
||||
|
||||
virtual void onError(const ParseLocation& location, const std::string& message, bool fatal) = 0;
|
||||
virtual ErrorCountInfo getErrorCount() const = 0;
|
||||
|
||||
virtual Id onTypedefParsed(
|
||||
const ParseLocation& location, const NameHierarchy& typedefName, AccessType access) = 0;
|
||||
@@ -107,7 +95,7 @@ public:
|
||||
const ParseLocation& location, const NameHierarchy& argumentTypeNameHierarchy,
|
||||
const NameHierarchy& templateNameHierarchy) = 0;
|
||||
virtual Id onTemplateDefaultArgumentTypeParsed(
|
||||
const ParseLocation& location, const NameHierarchy& defaultArgumentTypeNameHierarchy,
|
||||
const ParseLocation& location, const NameHierarchy& defaultArgumentTypeNameHierarchy,
|
||||
const NameHierarchy& templateArgumentTypeNameHierarchy) = 0;
|
||||
virtual Id onTemplateParameterTypeParsed(
|
||||
const ParseLocation& location, const NameHierarchy& templateParameterTypeNameHierarchy) = 0;
|
||||
@@ -121,7 +109,6 @@ public:
|
||||
virtual Id onFileIncludeParsed(
|
||||
const ParseLocation& location, const FileInfo& fileInfo, const FileInfo& includedFileInfo) = 0;
|
||||
|
||||
|
||||
virtual Id onMacroDefineParsed(
|
||||
const ParseLocation& location, const NameHierarchy& macroNameHierarchy, const ParseLocation& scopeLocation) = 0;
|
||||
virtual Id onMacroExpandParsed(
|
||||
|
||||
Reference in New Issue
Block a user