src: Refactored TokenLocation classes to SourceLocation classes

* Removed TokenLocationLine
* decoupled TokenLocationFile from TokenLocationCollection
* save vector of Token ids to SourceLocation
* refactored SourceLocationFile::getFilteredByLines()
* refactored snippet creation
This commit is contained in:
Eberhard Graether
2017-03-25 02:05:48 +01:00
parent 4c64822504
commit 4e9ba897ac
53 changed files with 1453 additions and 1796 deletions
+10 -13
View File
@@ -9,7 +9,6 @@
#include "data/access/StorageAccess.h"
#include "data/fulltextsearch/FullTextSearchIndex.h"
#include "data/graph/token_component/TokenComponentAccess.h"
#include "data/location/TokenLocationCollection.h"
#include "data/parser/ParserClient.h"
#include "data/parser/ParseLocation.h"
#include "data/search/SearchIndex.h"
@@ -111,8 +110,9 @@ public:
virtual StorageEdge getEdgeById(Id edgeId) const;
virtual bool checkEdgeExists(Id edgeId) const;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm, bool caseSensitive) const;
virtual std::shared_ptr<SourceLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm, bool caseSensitive) const;
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
std::vector<SearchMatch> getAutocompletionSymbolMatches(const std::string& query, size_t maxResultsCount) const;
std::vector<SearchMatch> getAutocompletionFileMatches(const std::string& query, size_t maxResultsCount) const;
@@ -125,18 +125,15 @@ public:
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId, Id* declarationId) const;
virtual std::vector<Id> getNodeIdsForLocationIds(const std::vector<Id>& locationIds) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds
) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(
const std::vector<Id>& locationIds
) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
virtual std::shared_ptr<SourceLocationCollection> getSourceLocationsForTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::shared_ptr<SourceLocationCollection> getSourceLocationsForLocationIds(const std::vector<Id>& locationIds) const;
virtual std::shared_ptr<SourceLocationFile> getSourceLocationsForFile(const FilePath& filePath) const;
virtual std::shared_ptr<SourceLocationFile> getSourceLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<SourceLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
@@ -148,7 +145,7 @@ public:
virtual ErrorCountInfo getErrorCount() const;
virtual std::vector<ErrorInfo> getErrors() const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<SourceLocationCollection> getErrorSourceLocations(std::vector<ErrorInfo>* errors) const;
private:
Id getFileNodeId(const FilePath& filePath) const;