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,6 +2,7 @@
#define CODE_CONTROLLER_H
#include <string>
#include <map>
#include "component/controller/Controller.h"
#include "component/view/CodeView.h"
@@ -13,6 +14,10 @@
#include "utility/messaging/type/MessageShowFile.h"
#include "utility/types.h"
#include "component/controller/helper/SnippetMerger.h"
class StorageAccess;
class TokenLocationFile;
@@ -42,7 +47,8 @@ private:
std::vector<CodeView::CodeSnippetParams> getSnippetsForActiveTokenIds(
const std::vector<Id>& ids, Id declarationId) const;
std::vector<CodeView::CodeSnippetParams> getSnippetsForFile(const TokenLocationFile* file) const;
std::vector<std::pair<uint, uint>> getSnippetRangesForFile(const TokenLocationFile* file) const;
std::shared_ptr<SnippetMerger> buildMergerHierarchy(
TokenLocation* location, SnippetMerger& fileScopedMerger, std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const;
StorageAccess* m_storageAccess;
};