ui: renamed undefined to non-indexed and made node/edge names more readable

This commit is contained in:
malte_langkabel
2017-02-06 16:18:00 +01:00
parent be1a44a763
commit 1bb25140a7
28 changed files with 163 additions and 149 deletions
@@ -325,7 +325,7 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
{
node->hasParent = false;
if (node->data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE | Node::NODE_PACKAGE))
if (node->data->isType(Node::NODE_NON_INDEXED | Node::NODE_NAMESPACE | Node::NODE_PACKAGE))
{
node->name = node->data->getFullName();
}
@@ -764,7 +764,7 @@ void GraphController::bundleNodes()
return !info.isDefined && info.isReferencing && !info.layoutVertical;
},
2,
"Undefined Symbols"
"Non-indexed Symbols"
);
bundleNodesAndEdgesMatching(
@@ -773,7 +773,7 @@ void GraphController::bundleNodes()
return !info.isDefined && info.isReferenced && !info.layoutVertical;
},
2,
"Undefined Symbols"
"Non-indexed Symbols"
);
bundleNodesAndEdgesMatching(
@@ -1013,7 +1013,7 @@ void GraphController::bundleNodesByType()
bundleByType(nodes, Node::NODE_ENUM_CONSTANT, "Enum Constants");
bundleByType(nodes, Node::NODE_TEMPLATE_PARAMETER_TYPE, "Template Parameter Types");
bundleByType(nodes, Node::NODE_TYPE_PARAMETER, "Type Parameters");
bundleByType(nodes, Node::NODE_UNDEFINED, "Undefined Symbols");
bundleByType(nodes, Node::NODE_NON_INDEXED, "Non-indexed Symbols");
if (nodes.size())
{
@@ -1135,7 +1135,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
}
else if (node->isBundleNode())
{
if (node->bundledNodeType != Node::NODE_UNDEFINED)
if (node->bundledNodeType != Node::NODE_NON_INDEXED)
{
margins = GraphViewStyle::getMarginsForNodeType(node->bundledNodeType, false);
}
@@ -1436,20 +1436,20 @@ void GraphController::handleMessage(MessageColorSchemeTest* message)
std::function<void(Id, Node::NodeType)> createNodes(
[&](Id id, Node::NodeType type)
{
std::string name = Node::getTypeString(type);
std::string name = Node::getReadableTypeString(type);
graph->createNode(id + 1, type, NameHierarchy(name), true);
graph->createNode(id + 2, type, NameHierarchy("focused " + name), true);
graph->createNode(id + 3, type, NameHierarchy("active " + name), true);
graph->createNode(id + 4, type, NameHierarchy("undefined " + name), true);
graph->createNode(id + 5, type, NameHierarchy("undefined focused " + name), true);
graph->createNode(id + 6, type, NameHierarchy("undefined active " + name), true);
graph->createNode(id + 4, type, NameHierarchy("Non-indexed " + name), true);
graph->createNode(id + 5, type, NameHierarchy("Non-indexed focused " + name), true);
graph->createNode(id + 6, type, NameHierarchy("Non-indexed active " + name), true);
}
);
createNodes( 0, Node::NODE_FUNCTION);
createNodes(10, Node::NODE_GLOBAL_VARIABLE);
createNodes(20, Node::NODE_UNDEFINED);
createNodes(20, Node::NODE_NON_INDEXED);
createNodes(30, Node::NODE_TYPE);
createNodes(40, Node::NODE_TYPEDEF);
createNodes(50, Node::NODE_NAMESPACE);
@@ -1475,8 +1475,8 @@ void GraphController::handleMessage(MessageColorSchemeTest* message)
[&](Id id, std::string name)
{
Node* enumNode = graph->createNode(id, Node::NODE_ENUM,
NameHierarchy(name + Node::getTypeString(Node::NODE_ENUM)), true);
createChild(enumNode, id + 10, Node::NODE_ENUM_CONSTANT, name + Node::getTypeString(Node::NODE_ENUM_CONSTANT), ACCESS_NONE);
NameHierarchy(name + Node::getReadableTypeString(Node::NODE_ENUM)), true);
createChild(enumNode, id + 10, Node::NODE_ENUM_CONSTANT, name + Node::getReadableTypeString(Node::NODE_ENUM_CONSTANT), ACCESS_NONE);
}
);
@@ -1484,14 +1484,14 @@ void GraphController::handleMessage(MessageColorSchemeTest* message)
createEnum(102, "focused ");
createEnum(103, "active ");
createEnum(104, "undefined ");
createEnum(105, "undefined focused ");
createEnum(106, "undefined active ");
createEnum(104, "Non-indexed ");
createEnum(105, "Non-indexed focused ");
createEnum(106, "Non-indexed active ");
std::function<void(Id, Node::NodeType, std::string)> createClass(
[&](Id id, Node::NodeType type, std::string name)
{
Node* classNode = graph->createNode(id, type, NameHierarchy(name + Node::getTypeString(type)), true);
Node* classNode = graph->createNode(id, type, NameHierarchy(name + Node::getReadableTypeString(type)), true);
if (type == Node::NODE_CLASS)
{
@@ -1514,9 +1514,9 @@ void GraphController::handleMessage(MessageColorSchemeTest* message)
createClass(id + 2, type, "focused ");
createClass(id + 3, type, "active ");
createClass(id + 4, type, "undefined ");
createClass(id + 5, type, "undefined focused ");
createClass(id + 6, type, "undefined active ");
createClass(id + 4, type, "Non-indexed ");
createClass(id + 5, type, "Non-indexed focused ");
createClass(id + 6, type, "Non-indexed active ");
}
);
@@ -1531,24 +1531,24 @@ void GraphController::handleMessage(MessageColorSchemeTest* message)
if (origin == Node::NODE_METHOD)
{
Node* classNode = graph->createNode(id + 101, Node::NODE_CLASS,
NameHierarchy(name + Node::getTypeString(Node::NODE_CLASS)), true);
originNode = createChild(classNode, id + 111, Node::NODE_METHOD, name + Edge::getTypeString(type), ACCESS_PUBLIC);
NameHierarchy(name + Node::getReadableTypeString(Node::NODE_CLASS)), true);
originNode = createChild(classNode, id + 111, Node::NODE_METHOD, name + Edge::getReadableTypeString(type), ACCESS_PUBLIC);
}
else
{
originNode = graph->createNode(id + 1, origin, NameHierarchy(name + Edge::getTypeString(type)), true);
originNode = graph->createNode(id + 1, origin, NameHierarchy(name + Edge::getReadableTypeString(type)), true);
}
Node* targetNode;
if (target == Node::NODE_METHOD)
{
Node* classNode = graph->createNode(id + 201, Node::NODE_CLASS,
NameHierarchy(name + Node::getTypeString(Node::NODE_CLASS)), true);
targetNode = createChild(classNode, id + 211, Node::NODE_METHOD, name + Edge::getTypeString(type), ACCESS_PUBLIC);
NameHierarchy(name + Node::getReadableTypeString(Node::NODE_CLASS)), true);
targetNode = createChild(classNode, id + 211, Node::NODE_METHOD, name + Edge::getReadableTypeString(type), ACCESS_PUBLIC);
}
else
{
targetNode = graph->createNode(id + 11, target, NameHierarchy(name + Edge::getTypeString(type)), true);
targetNode = graph->createNode(id + 11, target, NameHierarchy(name + Edge::getReadableTypeString(type)), true);
}
Edge* edge = graph->createEdge(id, type, originNode, targetNode);
@@ -67,7 +67,7 @@ public:
, bundleId(0)
, layoutBucket(0, 0)
, bundledNodeCount(0)
, bundledNodeType(Node::NODE_UNDEFINED)
, bundledNodeType(Node::NODE_NON_INDEXED)
, textNode(false)
{
}
+5 -5
View File
@@ -180,7 +180,7 @@ size_t GraphViewStyle::getFontSizeForNodeType(Node::NodeType type)
case Node::NODE_PACKAGE:
return s_fontSize - 3;
case Node::NODE_UNDEFINED:
case Node::NODE_NON_INDEXED:
case Node::NODE_TYPE:
case Node::NODE_BUILTIN_TYPE:
case Node::NODE_STRUCT:
@@ -268,7 +268,7 @@ GraphViewStyle::NodeMargins GraphViewStyle::getMarginsForNodeType(Node::NodeType
case Node::NODE_FILE:
case Node::NODE_MACRO:
margins.iconWidth = s_fontSize + 11;
case Node::NODE_UNDEFINED:
case Node::NODE_NON_INDEXED:
case Node::NODE_TYPE:
case Node::NODE_BUILTIN_TYPE:
case Node::NODE_STRUCT:
@@ -381,7 +381,7 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
){
NodeStyle style;
style.color = getNodeColor(Node::getTypeString(type), isActive || isFocused);
style.color = getNodeColor(Node::getUnderscoredTypeString(type), isActive || isFocused);
style.fontName = getFontNameForNodeType(type);
style.fontSize = getFontSizeForNodeType(type);
@@ -409,7 +409,7 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
style.textOffset.y = 3;
break;
case Node::NODE_UNDEFINED:
case Node::NODE_NON_INDEXED:
case Node::NODE_TYPE:
case Node::NODE_BUILTIN_TYPE:
case Node::NODE_STRUCT:
@@ -565,7 +565,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
style.originOffset.y = -1;
style.targetOffset.y = 1;
style.color = getEdgeColor(Edge::getTypeString(type), isActive || isFocused);
style.color = getEdgeColor(Edge::getUnderscoredTypeString(type), isActive || isFocused);
switch (type)
{
+4 -4
View File
@@ -605,13 +605,13 @@ std::set<SearchMatch> PersistentStorage::getAutocompletionSymbolMatches(const st
match.indices = result.indices;
match.score = result.score;
match.nodeType = Node::intToType(firstNode->type);
match.typeName = Node::getTypeString(match.nodeType);
match.typeName = Node::getReadableTypeString(match.nodeType);
match.searchType = SearchMatch::SEARCH_TOKEN;
if (storageSymbolMap.find(firstNode->id) == storageSymbolMap.end() &&
match.nodeType != Node::NODE_UNDEFINED)
match.nodeType != Node::NODE_NON_INDEXED)
{
match.typeName = "undefined " + match.typeName;
match.typeName = "non-indexed " + match.typeName;
}
matches.insert(match);
@@ -642,7 +642,7 @@ std::set<SearchMatch> PersistentStorage::getAutocompletionFileMatches(const std:
match.score = result.score;
match.nodeType = Node::NODE_FILE;
match.typeName = Node::getTypeString(match.nodeType);
match.typeName = Node::getReadableTypeString(match.nodeType);
match.searchType = SearchMatch::SEARCH_TOKEN;
+1 -1
View File
@@ -63,7 +63,7 @@ Node::NodeType StorageAccessProxy::getNodeTypeForNodeWithId(Id id) const
{
return m_subject->getNodeTypeForNodeWithId(id);
}
return Node::NODE_UNDEFINED;
return Node::NODE_NON_INDEXED;
}
NameHierarchy StorageAccessProxy::getNameHierarchyForNodeWithId(Id id) const
+18 -13
View File
@@ -106,7 +106,7 @@ Node* Edge::getTo() const
std::string Edge::getName() const
{
return getTypeString() + ":" + getFrom()->getFullName() + "->" + getTo()->getFullName();
return getReadableTypeString() + ":" + getFrom()->getFullName() + "->" + getTo()->getFullName();
}
bool Edge::isNode() const
@@ -127,7 +127,7 @@ void Edge::addComponentAggregation(std::shared_ptr<TokenComponentAggregation> co
}
else if (m_type != EDGE_AGGREGATION)
{
LOG_ERROR("TokenComponentAggregation can't be set on edge of type: " + getTypeString());
LOG_ERROR("TokenComponentAggregation can't be set on edge of type: " + getReadableTypeString());
}
else
{
@@ -135,7 +135,12 @@ void Edge::addComponentAggregation(std::shared_ptr<TokenComponentAggregation> co
}
}
std::string Edge::getTypeString(EdgeType type)
std::string Edge::getUnderscoredTypeString(EdgeType type)
{
return utility::replace(utility::replace(getReadableTypeString(type), "-", "_"), " ", "_");
}
std::string Edge::getReadableTypeString(EdgeType type)
{
switch (type)
{
@@ -144,7 +149,7 @@ std::string Edge::getTypeString(EdgeType type)
case EDGE_MEMBER:
return "child";
case EDGE_TYPE_USAGE:
return "type_use";
return "type use";
case EDGE_USAGE:
return "use";
case EDGE_CALL:
@@ -154,15 +159,15 @@ std::string Edge::getTypeString(EdgeType type)
case EDGE_OVERRIDE:
return "override";
case EDGE_TEMPLATE_ARGUMENT:
return "template_argument";
return "template argument";
case EDGE_TYPE_ARGUMENT:
return "type_argument";
return "type argument";
case EDGE_TEMPLATE_DEFAULT_ARGUMENT:
return "template_default_argument";
return "template default argument";
case EDGE_TEMPLATE_SPECIALIZATION:
return "template_specialization";
return "template specialization";
case EDGE_TEMPLATE_MEMBER_SPECIALIZATION:
return "template_member_specialization";
return "template member specialization";
case EDGE_INCLUDE:
return "include";
case EDGE_IMPORT:
@@ -170,21 +175,21 @@ std::string Edge::getTypeString(EdgeType type)
case EDGE_AGGREGATION:
return "aggregation";
case EDGE_MACRO_USAGE:
return "macro_use";
return "macro use";
}
return "";
}
std::string Edge::getTypeString() const
std::string Edge::getReadableTypeString() const
{
return getTypeString(m_type);
return getReadableTypeString(m_type);
}
std::string Edge::getAsString() const
{
std::stringstream str;
str << "[" << getId() << "] " << getTypeString() << ": \"" << m_from->getName() << "\" -> \"" + m_to->getName() << "\"";
str << "[" << getId() << "] " << getReadableTypeString() << ": \"" << m_from->getName() << "\" -> \"" + m_to->getName() << "\"";
TokenComponentAggregation* aggregation = getComponent<TokenComponentAggregation>();
if (aggregation)
+3 -2
View File
@@ -58,9 +58,10 @@ public:
// Component setters
void addComponentAggregation(std::shared_ptr<TokenComponentAggregation> component);
static std::string getUnderscoredTypeString(EdgeType type);
static std::string getReadableTypeString(EdgeType type);
// Logging.
static std::string getTypeString(EdgeType type);
virtual std::string getTypeString() const;
virtual std::string getReadableTypeString() const;
std::string getAsString() const;
private:
+1 -1
View File
@@ -311,7 +311,7 @@ void Graph::printBasic(std::ostream& ostream) const
forEachNode(
[&ostream](Node* n)
{
ostream << ' ' << n->getTypeString() << ':' << n->getFullName();
ostream << ' ' << n->getReadableTypeString() << ':' << n->getFullName();
}
);
ostream << '\n';
+27 -21
View File
@@ -3,6 +3,7 @@
#include <sstream>
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
#include "data/graph/token_component/TokenComponentAbstraction.h"
#include "data/graph/token_component/TokenComponentAccess.h"
@@ -11,18 +12,23 @@
#include "data/graph/token_component/TokenComponentFilePath.h"
#include "data/graph/token_component/TokenComponentSignature.h"
const Node::NodeTypeMask Node::NODE_NOT_VISIBLE = Node::NODE_UNDEFINED | Node::NODE_NAMESPACE | Node::NODE_PACKAGE;
const Node::NodeTypeMask Node::NODE_USEABLE_TYPE = Node::NODE_UNDEFINED | Node::NODE_BUILTIN_TYPE |
const Node::NodeTypeMask Node::NODE_NOT_VISIBLE = Node::NODE_NON_INDEXED | Node::NODE_NAMESPACE | Node::NODE_PACKAGE;
const Node::NodeTypeMask Node::NODE_USEABLE_TYPE = Node::NODE_NON_INDEXED | Node::NODE_BUILTIN_TYPE |
Node::NODE_BUILTIN_TYPE | Node::NODE_STRUCT | Node::NODE_CLASS | Node::NODE_INTERFACE | Node::NODE_TYPEDEF;
std::string Node::getTypeString(NodeType type)
std::string Node::getUnderscoredTypeString(NodeType type)
{
return utility::replace(utility::replace(getReadableTypeString(type), "-", "_"), " ", "_");
}
std::string Node::getReadableTypeString(NodeType type)
{
switch (type)
{
case NODE_UNDEFINED:
return "undefined";
case NODE_NON_INDEXED:
return "non-indexed";
case NODE_BUILTIN_TYPE:
return "builtin_type";
return "built-in type";
case NODE_TYPE:
return "type";
case NODE_NAMESPACE:
@@ -36,7 +42,7 @@ std::string Node::getTypeString(NodeType type)
case NODE_INTERFACE:
return "interface";
case NODE_GLOBAL_VARIABLE:
return "global_variable";
return "global variable";
case NODE_FIELD:
return "field";
case NODE_FUNCTION:
@@ -46,13 +52,13 @@ std::string Node::getTypeString(NodeType type)
case NODE_ENUM:
return "enum";
case NODE_ENUM_CONSTANT:
return "enum_constant";
return "enum constant";
case NODE_TYPEDEF:
return "typedef";
case NODE_TEMPLATE_PARAMETER_TYPE:
return "template_parameter_type";
return "template parameter type";
case NODE_TYPE_PARAMETER:
return "type_parameter";
return "type parameter";
case NODE_FILE:
return "file";
case NODE_MACRO:
@@ -109,7 +115,7 @@ Node::NodeType Node::intToType(int value)
return NODE_MACRO;
}
return NODE_UNDEFINED;
return NODE_NON_INDEXED;
}
Node::Node(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined)
@@ -133,10 +139,10 @@ Node::NodeType Node::getType() const
void Node::setType(NodeType type)
{
if (!isType(type | NODE_UNDEFINED))
if (!isType(type | NODE_NON_INDEXED))
{
LOG_WARNING(
"Cannot change NodeType after it was already set from " + getTypeString() + " to " + getTypeString(type)
"Cannot change NodeType after it was already set from " + getReadableTypeString() + " to " + getReadableTypeString(type)
);
return;
}
@@ -362,7 +368,7 @@ void Node::addComponentAbstraction(std::shared_ptr<TokenComponentAbstraction> co
}
else if (!isType(NODE_METHOD))
{
LOG_ERROR("TokenComponentAbstraction can't be set on node of type: " + getTypeString());
LOG_ERROR("TokenComponentAbstraction can't be set on node of type: " + getReadableTypeString());
}
else
{
@@ -379,7 +385,7 @@ void Node::addComponentConst(std::shared_ptr<TokenComponentConst> component)
}
else if (!isType(NODE_METHOD))
{
LOG_ERROR("TokenComponentConst can't be set on node of type: " + getTypeString());
LOG_ERROR("TokenComponentConst can't be set on node of type: " + getReadableTypeString());
}
else
{
@@ -396,7 +402,7 @@ void Node::addComponentStatic(std::shared_ptr<TokenComponentStatic> component)
}
else if (!isType(NODE_GLOBAL_VARIABLE | NODE_FIELD | NODE_FUNCTION | NODE_METHOD))
{
LOG_ERROR("TokenComponentStatic can't be set on node of type: " + getTypeString());
LOG_ERROR("TokenComponentStatic can't be set on node of type: " + getReadableTypeString());
}
else
{
@@ -413,7 +419,7 @@ void Node::addComponentFilePath(std::shared_ptr<TokenComponentFilePath> componen
}
else if (!isType(NODE_FILE))
{
LOG_ERROR("TokenComponentFilePath can't be set on node of type: " + getTypeString());
LOG_ERROR("TokenComponentFilePath can't be set on node of type: " + getReadableTypeString());
}
else
{
@@ -430,7 +436,7 @@ void Node::addComponentSignature(std::shared_ptr<TokenComponentSignature> compon
}
else if (!isType(NODE_FUNCTION | NODE_METHOD))
{
LOG_ERROR("TokenComponentFilePath can't be set on node of type: " + getTypeString());
LOG_ERROR("TokenComponentFilePath can't be set on node of type: " + getReadableTypeString());
}
else
{
@@ -451,15 +457,15 @@ void Node::addComponentAccess(std::shared_ptr<TokenComponentAccess> component)
}
}
std::string Node::getTypeString() const
std::string Node::getReadableTypeString() const
{
return getTypeString(m_type);
return getReadableTypeString(m_type);
}
std::string Node::getAsString() const
{
std::stringstream str;
str << "[" << getId() << "] " << getTypeString() << ": " << "\"" << getName() << "\"";
str << "[" << getId() << "] " << getReadableTypeString() << ": " << "\"" << getName() << "\"";
TokenComponentAccess* access = getComponent<TokenComponentAccess>();
if (access)
+5 -3
View File
@@ -24,7 +24,7 @@ public:
typedef int NodeTypeMask;
enum NodeType : NodeTypeMask
{ // make sure that the value of 0x0 is not used here because it doesn't work for bitmasking.
NODE_UNDEFINED = 0x1,
NODE_NON_INDEXED = 0x1,
NODE_TYPE = 0x2,
NODE_BUILTIN_TYPE = 0x4,
@@ -48,7 +48,9 @@ public:
NODE_MACRO = 0x40000
};
static std::string getTypeString(NodeType type);
static std::string getUnderscoredTypeString(NodeType type);
static std::string getReadableTypeString(NodeType type);
static int typeToInt(NodeType type);
static NodeType intToType(int value);
@@ -107,7 +109,7 @@ public:
void addComponentAccess(std::shared_ptr<TokenComponentAccess> component);
// Logging.
virtual std::string getTypeString() const;
virtual std::string getReadableTypeString() const;
std::string getAsString() const;
private:
+1 -1
View File
@@ -30,7 +30,7 @@ public:
std::shared_ptr<ComponentType> removeComponent();
// Logging.
virtual std::string getTypeString() const = 0;
virtual std::string getReadableTypeString() const = 0;
protected:
Token(const Token& other);
+3 -3
View File
@@ -32,16 +32,16 @@ public:
virtual void finishParsingFile() = 0;
virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
AccessKind access, DefinitionKind definitionKind) = 0;
virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
const ParseLocation& location,
AccessKind access, DefinitionKind definitionKind) = 0;
virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
const ParseLocation& location, const ParseLocation& scopeLocation,
AccessKind access, DefinitionKind definitionKind) = 0;
+10 -10
View File
@@ -34,34 +34,34 @@ void ParserClientImpl::finishParsingFile()
}
Id ParserClientImpl::recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
AccessKind access, DefinitionKind definitionKind
)
{
Id nodeId = addNodeHierarchy(symbolName, symbolKindToNodeType(symbolType));
Id nodeId = addNodeHierarchy(symbolName, symbolKindToNodeType(symbolKind));
addSymbol(nodeId, definitionKind);
addAccess(nodeId, access);
return nodeId;
}
Id ParserClientImpl::recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
const ParseLocation& location,
AccessKind access, DefinitionKind definitionKind
)
{
Id nodeId = recordSymbol(symbolName, symbolType, access, definitionKind);
Id nodeId = recordSymbol(symbolName, symbolKind, access, definitionKind);
addSourceLocation(nodeId, location, locationTypeToInt(LOCATION_TOKEN));
return nodeId;
}
Id ParserClientImpl::recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
const ParseLocation& location, const ParseLocation& scopeLocation,
AccessKind access, DefinitionKind definitionKind
)
{
Id nodeId = recordSymbol(symbolName, symbolType, location, access, definitionKind);
Id nodeId = recordSymbol(symbolName, symbolKind, location, access, definitionKind);
addSourceLocation(nodeId, scopeLocation, locationTypeToInt(LOCATION_SCOPE));
return nodeId;
}
@@ -102,9 +102,9 @@ void ParserClientImpl::onCommentParsed(const ParseLocation& location)
addCommentLocation(location);
}
Node::NodeType ParserClientImpl::symbolKindToNodeType(SymbolKind symbolType) const
Node::NodeType ParserClientImpl::symbolKindToNodeType(SymbolKind symbolKind) const
{
switch (symbolType)
switch (symbolKind)
{
case SYMBOL_BUILTIN_TYPE:
return Node::NODE_BUILTIN_TYPE;
@@ -143,7 +143,7 @@ Node::NodeType ParserClientImpl::symbolKindToNodeType(SymbolKind symbolType) con
default:
break;
}
return Node::NODE_UNDEFINED;
return Node::NODE_NON_INDEXED;
}
Edge::EdgeType ParserClientImpl::referenceKindToEdgeType(ReferenceKind referenceKind) const
@@ -204,7 +204,7 @@ Id ParserClientImpl::addNodeHierarchy(NameHierarchy nameHierarchy, Node::NodeTyp
{
currentNameHierarchy.push(nameHierarchy[i]);
const bool currentIsLastElement = (i == nameHierarchy.size() - 1);
const Node::NodeType currentType = (currentIsLastElement ? nodeType : Node::NODE_UNDEFINED); // TODO: rename to unknown!
const Node::NodeType currentType = (currentIsLastElement ? nodeType : Node::NODE_NON_INDEXED); // TODO: rename to unknown!
Id nodeId = addNode(currentType, currentNameHierarchy);
+4 -4
View File
@@ -23,16 +23,16 @@ public:
virtual void finishParsingFile();
virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
AccessKind access, DefinitionKind definitionKind);
virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
const ParseLocation& location,
AccessKind access, DefinitionKind definitionKind);
virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolType,
const NameHierarchy& symbolName, SymbolKind symbolKind,
const ParseLocation& location, const ParseLocation& scopeLocation,
AccessKind access, DefinitionKind definitionKind);
@@ -49,7 +49,7 @@ private:
Node::NodeType symbolKindToNodeType(SymbolKind symbolType) const;
Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const;
void addAccess(Id nodeId, AccessKind access);
Id addNodeHierarchy(NameHierarchy nameHierarchy, Node::NodeType nodeType = Node::NODE_UNDEFINED);
Id addNodeHierarchy(NameHierarchy nameHierarchy, Node::NodeType nodeType = Node::NODE_NON_INDEXED);
Id addNode(Node::NodeType nodeType, NameHierarchy nameHierarchy);
void addFile(Id id, const FilePath& filePath, const std::string& modificationTime);
+2 -2
View File
@@ -191,9 +191,9 @@ std::string SearchMatch::getFullName() const
return name;
}
std::string SearchMatch::getNodeTypeAsString() const
std::string SearchMatch::getNodeTypeAsUnderscoredString() const
{
return Node::getTypeString(nodeType);
return Node::getUnderscoredTypeString(nodeType);
}
std::string SearchMatch::getSearchTypeName() const
+1 -1
View File
@@ -48,7 +48,7 @@ struct SearchMatch
void print(std::ostream& ostream) const;
std::string getFullName() const;
std::string getNodeTypeAsString() const;
std::string getNodeTypeAsUnderscoredString() const;
std::string getSearchTypeName() const;
std::string name;
+2 -2
View File
@@ -28,7 +28,7 @@ std::string ColorScheme::getColor(const std::string& key, const std::string& def
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const
{
return getNodeTypeColor(Node::getTypeString(type), key, state);
return getNodeTypeColor(Node::getUnderscoredTypeString(type), key, state);
}
std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const
@@ -60,7 +60,7 @@ std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std:
std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, ColorState state) const
{
return getEdgeTypeColor(Edge::getTypeString(type), state);
return getEdgeTypeColor(Edge::getUnderscoredTypeString(type), state);
}
std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState state) const
@@ -35,7 +35,7 @@ public:
std::string getFullName() const
{
std::string name = Edge::getTypeString(type) + ":";
std::string name = Edge::getReadableTypeString(type) + ":";
name += fromNameHierarchy.getQualifiedNameWithSignature() + "->";
name += toNameHierarchy.getQualifiedNameWithSignature();
return name;
@@ -35,7 +35,7 @@ public:
{
ActiveNode node;
node.nodeId = 0;
node.type = Node::NODE_UNDEFINED;
node.type = Node::NODE_NON_INDEXED;
node.nameHierarchy = nameHierarchy;
nodes.push_back(node);
@@ -150,7 +150,7 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
if (type.size() && type != "command")
{
const GraphViewStyle::NodeColor& nodeColor = GraphViewStyle::getNodeColor(Node::getTypeString(nodeType), false);
const GraphViewStyle::NodeColor& nodeColor = GraphViewStyle::getNodeColor(Node::getUnderscoredTypeString(nodeType), false);
fillColor = QColor(nodeColor.fill.c_str());
textColor = QColor(nodeColor.text.c_str());
}
+5 -5
View File
@@ -724,11 +724,11 @@ void QtSmartSearchBox::updateElements()
if (match.searchType == SearchMatch::SEARCH_TOKEN)
{
element->setObjectName(QString::fromStdString("search_element_" + match.getNodeTypeAsString()));
color = GraphViewStyle::getNodeColor(Node::getTypeString(match.nodeType), false).fill;
hoverColor = GraphViewStyle::getNodeColor(Node::getTypeString(match.nodeType), true).fill;
textColor = GraphViewStyle::getNodeColor(Node::getTypeString(match.nodeType), false).text;
textHoverColor = GraphViewStyle::getNodeColor(Node::getTypeString(match.nodeType), true).text;
element->setObjectName(QString::fromStdString("search_element_" + match.getNodeTypeAsUnderscoredString()));
color = GraphViewStyle::getNodeColor(Node::getUnderscoredTypeString(match.nodeType), false).fill;
hoverColor = GraphViewStyle::getNodeColor(Node::getUnderscoredTypeString(match.nodeType), true).fill;
textColor = GraphViewStyle::getNodeColor(Node::getUnderscoredTypeString(match.nodeType), false).text;
textHoverColor = GraphViewStyle::getNodeColor(Node::getUnderscoredTypeString(match.nodeType), true).text;
}
else
{
@@ -147,7 +147,7 @@ void QtGraphEdge::updateLine()
style, m_weight, showArrow);
}
QString toolTip = utility::replace(Edge::getTypeString(type), "_", " ").c_str();
QString toolTip = Edge::getReadableTypeString(type).c_str();
if (type == Edge::EDGE_AGGREGATION)
{
toolTip += ": " + QString::number(m_weight) + " edge";
@@ -41,15 +41,15 @@ void QtGraphNodeBundle::onClick()
{
MessageGraphNodeBundleSplit(
m_tokenId,
m_type != Node::NODE_UNDEFINED && getName() != "Anonymous Namespaces",
m_type != Node::NODE_UNDEFINED
m_type != Node::NODE_NON_INDEXED && getName() != "Anonymous Namespaces",
m_type != Node::NODE_NON_INDEXED
).dispatch();
}
void QtGraphNodeBundle::updateStyle()
{
GraphViewStyle::NodeStyle style;
if (m_type != Node::NODE_UNDEFINED)
if (m_type != Node::NODE_NON_INDEXED)
{
style = GraphViewStyle::getStyleForNodeType(m_type, true, false, m_isHovering, false, false);
}
@@ -18,10 +18,10 @@ QtGraphNodeData::QtGraphNodeData(const Node* data, const std::string& name, bool
this->setName(name);
std::string toolTip = data->getTypeString();
if (!data->isDefined() && !data->isType(Node::NODE_UNDEFINED))
std::string toolTip = data->getReadableTypeString();
if (!data->isDefined() && !data->isType(Node::NODE_NON_INDEXED))
{
toolTip = "undefined " + toolTip;
toolTip = "non-indexed " + toolTip;
}
else if (data->isImplicit())
{
@@ -21,7 +21,7 @@ QtGraphNodeQualifier::QtGraphNodeQualifier(const NameHierarchy& name)
m_rightArrowSmall = new QGraphicsPolygonItem(this);
QFont font;
font.setFamily(GraphViewStyle::getFontNameForNodeType(Node::NODE_UNDEFINED).c_str());
font.setFamily(GraphViewStyle::getFontNameForNodeType(Node::NODE_NON_INDEXED).c_str());
font.setPixelSize(GraphViewStyle::getFontSizeOfQualifier());
font.setWeight(QFont::Normal);
+6 -6
View File
@@ -132,7 +132,7 @@ void JavaParser::doLogError(jstring jError)
}
void JavaParser::doRecordSymbol(
jstring jSymbolName, jint jSymbolType,
jstring jSymbolName, jint jSymbolKind,
jint jAccess, jint jDefinitionKind
)
{
@@ -141,14 +141,14 @@ void JavaParser::doRecordSymbol(
m_client->recordSymbol(
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)),
intToSymbolKind(jSymbolType),
intToSymbolKind(jSymbolKind),
access,
definitionKind
);
}
void JavaParser::doRecordSymbolWithLocation(
jstring jSymbolName, jint jSymbolType,
jstring jSymbolName, jint jSymbolKind,
jint beginLine, jint beginColumn, jint endLine, jint endColumn,
jint jAccess, jint jDefinitionKind
)
@@ -158,7 +158,7 @@ void JavaParser::doRecordSymbolWithLocation(
m_client->recordSymbol(
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)),
intToSymbolKind(jSymbolType),
intToSymbolKind(jSymbolKind),
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
access,
definitionKind
@@ -166,7 +166,7 @@ void JavaParser::doRecordSymbolWithLocation(
}
void JavaParser::doRecordSymbolWithLocationAndScope(
jstring jSymbolName, jint jSymbolType,
jstring jSymbolName, jint jSymbolKind,
jint beginLine, jint beginColumn, jint endLine, jint endColumn,
jint scopeBeginLine, jint scopeBeginColumn, jint scopeEndLine, jint scopeEndColumn,
jint jAccess, jint jDefinitionKind
@@ -177,7 +177,7 @@ void JavaParser::doRecordSymbolWithLocationAndScope(
m_client->recordSymbol(
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)),
intToSymbolKind(jSymbolType),
intToSymbolKind(jSymbolKind),
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
ParseLocation(m_currentFilePath, scopeBeginLine, scopeBeginColumn, scopeEndLine, scopeEndColumn),
access,
+3 -3
View File
@@ -146,18 +146,18 @@ private:
void doLogError(jstring jError);
void doRecordSymbol(
jstring jSymbolName, jint jSymbolType,
jstring jSymbolName, jint jSymbolKind,
jint jAccess, jint jDefinitionKind
);
void doRecordSymbolWithLocation(
jstring jSymbolName, jint jSymbolType,
jstring jSymbolName, jint jSymbolKind,
jint beginLine, jint beginColumn, jint endLine, jint endColumn,
jint jAccess, jint jDefinitionKind
);
void doRecordSymbolWithLocationAndScope(
jstring jSymbolName, jint jSymbolType,
jstring jSymbolName, jint jSymbolKind,
jint beginLine, jint beginColumn, jint endLine, jint endColumn,
jint scopeBeginLine, jint scopeBeginColumn, jint scopeEndLine, jint scopeEndColumn,
jint jAccess, jint jDefinitionKind
+25 -25
View File
@@ -92,7 +92,7 @@ public:
void test_nodes_are_nodes()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
TS_ASSERT(a.isNode());
TS_ASSERT(!a.isEdge());
@@ -100,8 +100,8 @@ public:
void test_edges_are_edges()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Edge e(3, Edge::EDGE_USAGE, &a, &b);
TS_ASSERT(!e.isNode());
@@ -114,9 +114,9 @@ public:
TS_ASSERT_EQUALS(Node::NODE_FUNCTION, n.getType());
}
void test_set_type_of_node_from_undefined()
void test_set_type_of_node_from_non_indexed()
{
Node n(2, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node n(2, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
n.setType(Node::NODE_CLASS);
TS_ASSERT_EQUALS(Node::NODE_CLASS, n.getType());
}
@@ -148,8 +148,8 @@ public:
void test_get_type_of_edges()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Edge e(3, Edge::EDGE_USAGE, &a, &b);
TS_ASSERT_EQUALS(Edge::EDGE_USAGE, e.getType());
@@ -157,8 +157,8 @@ public:
void test_edge_can_be_copied_and_keeps_same_id()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Edge e(3, Edge::EDGE_USAGE, &a, &b);
Edge e2(e, &a, &b);
@@ -169,8 +169,8 @@ public:
void test_edge_type_bit_masking()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Edge e(3, Edge::EDGE_USAGE, &a, &b);
TS_ASSERT(e.isType(Edge::EDGE_MEMBER | Edge::EDGE_CALL | Edge::EDGE_USAGE));
@@ -179,9 +179,9 @@ public:
void test_node_finds_child_node()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node c(3, Node::NODE_UNDEFINED, NameHierarchy("C"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Node c(3, Node::NODE_NON_INDEXED, NameHierarchy("C"), false);
Edge e(4, Edge::EDGE_MEMBER, &a, &b);
Edge e2(5, Edge::EDGE_MEMBER, &a, &c);
@@ -198,9 +198,9 @@ public:
void test_node_can_not_find_child_node()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node c(3, Node::NODE_UNDEFINED, NameHierarchy("C"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Node c(3, Node::NODE_NON_INDEXED, NameHierarchy("C"), false);
Edge e(4, Edge::EDGE_MEMBER, &a, &b);
Edge e2(5, Edge::EDGE_MEMBER, &a, &c);
@@ -216,9 +216,9 @@ public:
void test_node_visits_child_nodes()
{
Node a(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node b(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node c(3, Node::NODE_UNDEFINED, NameHierarchy("C"), false);
Node a(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node b(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
Node c(3, Node::NODE_NON_INDEXED, NameHierarchy("C"), false);
Edge e(4, Edge::EDGE_MEMBER, &a, &b);
Edge e2(5, Edge::EDGE_MEMBER, &a, &c);
@@ -238,8 +238,8 @@ public:
void test_graph_saves_nodes()
{
Graph graph;
Node* a = graph.createNode(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
Node* b = graph.createNode(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node* a = graph.createNode(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
Node* b = graph.createNode(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
TS_ASSERT_EQUALS(2, graph.getNodeCount());
TS_ASSERT_EQUALS(0, graph.getEdgeCount());
@@ -273,8 +273,8 @@ public:
{
Graph graph;
Node* a = graph.createNode(1, Node::NODE_UNDEFINED, NameHierarchy("A"), false);
graph.createNode(2, Node::NODE_UNDEFINED, NameHierarchy("B"), false);
Node* a = graph.createNode(1, Node::NODE_NON_INDEXED, NameHierarchy("A"), false);
graph.createNode(2, Node::NODE_NON_INDEXED, NameHierarchy("B"), false);
TS_ASSERT_EQUALS(2, graph.getNodeCount());
TS_ASSERT_EQUALS(0, graph.getEdgeCount());
@@ -319,7 +319,7 @@ private:
return Token::removeComponent<ComponentType>();
}
virtual std::string getTypeString() const
virtual std::string getReadableTypeString() const
{
return "";
}