logic: Codeview Snippet order

Sorting the Snippets in. the Codeview. Active Token first then declaration,
filename and extension
This commit is contained in:
Andreas Stallinger
2014-10-24 13:37:06 +02:00
parent a1b874c520
commit 0a4c65d198
17 changed files with 157 additions and 42 deletions
+8 -3
View File
@@ -392,7 +392,7 @@ std::shared_ptr<Graph> Storage::getGraphForActiveTokenIds(const std::vector<Id>&
return graph;
}
std::vector<Id> Storage::getActiveTokenIdsForId(Id tokenId) const
std::vector<Id> Storage::getActiveTokenIdsForId(Id tokenId, Id& declarationId) const
{
std::vector<Id> ret;
Token* token = m_graph.getTokenById(tokenId);
@@ -401,17 +401,22 @@ std::vector<Id> Storage::getActiveTokenIdsForId(Id tokenId) const
return ret;
}
ret.push_back(token->getId());
Node* node;
if (token->isEdge())
{
node = dynamic_cast<Edge*>(token)->getTo();
declarationId = node->getId();
ret.push_back(node->getId());
}
else
{
{
node = dynamic_cast<Node*>(token);
declarationId = node->getId();
}
ret.push_back(node->getId());
//ret.push_back(node->getId());
node->forEachEdge(
[&node, &ret](Edge* e)
+1 -1
View File
@@ -75,7 +75,7 @@ public:
virtual std::shared_ptr<Graph> getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId) const;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId, Id& declarationId) const;
virtual std::vector<Id> getLocationIdsForTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<Id> getTokenIdsForQuery(std::string query) const;
+1 -1
View File
@@ -20,7 +20,7 @@ public:
virtual std::shared_ptr<Graph> getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const = 0;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId) const = 0;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId, Id& declarationId) const = 0;
virtual std::vector<Id> getLocationIdsForTokenIds(const std::vector<Id>& tokenIds) const = 0;
virtual std::vector<Id> getTokenIdsForQuery(std::string query) const = 0;
+2 -2
View File
@@ -67,11 +67,11 @@ std::shared_ptr<Graph> GraphAccessProxy::getGraphForActiveTokenIds(const std::ve
return std::make_shared<Graph>();
}
std::vector<Id> GraphAccessProxy::getActiveTokenIdsForId(Id tokenId) const
std::vector<Id> GraphAccessProxy::getActiveTokenIdsForId(Id tokenId, Id& delcarationId) const
{
if (hasSubject())
{
return m_subject->getActiveTokenIdsForId(tokenId);
return m_subject->getActiveTokenIdsForId(tokenId, delcarationId);
}
return std::vector<Id>();
+1 -1
View File
@@ -19,7 +19,7 @@ public:
virtual std::shared_ptr<Graph> getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId) const;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId, Id& declarationId) const;
virtual std::vector<Id> getLocationIdsForTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<Id> getTokenIdsForQuery(std::string query) const;