data: saving graph nodes with short name only
This change saves only the short names in the node, getName() no only gives the short version. The fullName is assembled from the parent nodes on demand using the getFullName() method.
This commit is contained in:
@@ -238,26 +238,23 @@ void Storage::onGlobalVariableUsageParsed(
|
||||
addTokenLocation(edge, location);
|
||||
}
|
||||
|
||||
Id Storage::getIdForNodeWithName(const std::string& name) const
|
||||
Id Storage::getIdForNodeWithName(const std::string& fullName) const
|
||||
{
|
||||
Node* node = m_graph.findNode([&](Node* node){
|
||||
return node->getName() == name;
|
||||
});
|
||||
|
||||
Node* node = m_graph.getNode(fullName);
|
||||
return (node ? node->getId() : 0);
|
||||
}
|
||||
|
||||
std::string Storage::getNameForNodeWithId(Id id) const
|
||||
{
|
||||
Node* node = m_graph.getNodeById(id);
|
||||
return (node ? node->getName() : "");
|
||||
return (node ? node->getFullName() : "");
|
||||
}
|
||||
|
||||
std::vector<std::string> Storage::getNamesForNodesWithNamePrefix(const std::string& prefix) const
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
m_graph.forEachNode([&](Node* node){
|
||||
const std::string& nodeName = node->getName();
|
||||
const std::string& nodeName = node->getFullName();
|
||||
if (utility::isPrefix(prefix, nodeName))
|
||||
{
|
||||
names.push_back(nodeName);
|
||||
|
||||
Reference in New Issue
Block a user