ui: snippet sizes

* added SnippetMerger class that conducts the merging and snapping of TokenLocations to create snippets.
* added parameters for snippet snapping and merging to ApplicationSettings.
* added forEachStartTokenLocation() and forEachEndTokenLocation() to TokenLocationLine and TokenLocationFile.
* added < and > operators to TokenLocation that compare the location part (not the id).
This commit is contained in:
malte_langkabel
2015-05-04 15:00:18 +02:00
parent 4ec3dfd372
commit fd73abde64
19 changed files with 345 additions and 35 deletions
+2
View File
@@ -11,6 +11,7 @@
#include "data/search/SearchMatch.h"
class Graph;
class TokenLocation;
class TokenLocationCollection;
class TokenLocationFile;
@@ -38,6 +39,7 @@ public:
const std::string& filePath, uint firstLineNumber, uint lastLineNumber) const = 0;
virtual TokenLocationCollection getErrorTokenLocations(std::vector<std::string>* errorMessages) const = 0;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationOfParentScope(const TokenLocation* child) const = 0;
};
#endif // STORAGE_ACCESS_H
@@ -153,3 +153,13 @@ TokenLocationCollection StorageAccessProxy::getErrorTokenLocations(std::vector<s
return TokenLocationCollection();
}
std::shared_ptr<TokenLocationFile> StorageAccessProxy::getTokenLocationOfParentScope(const TokenLocation* child) const
{
if (hasSubject())
{
return m_subject->getTokenLocationOfParentScope(child);
}
return std::make_shared<TokenLocationFile>("");
}
+2
View File
@@ -34,6 +34,8 @@ public:
virtual TokenLocationCollection getErrorTokenLocations(std::vector<std::string>* errorMessages) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationOfParentScope(const TokenLocation* child) const;
private:
StorageAccess* m_subject;
};