diff --git a/core/include/DefinitionKind.h b/core/include/DefinitionKind.h index 37bc142..4a8650b 100644 --- a/core/include/DefinitionKind.h +++ b/core/include/DefinitionKind.h @@ -28,14 +28,14 @@ namespace sourcetrail * record an implicit definition kind for those symbols. * If you do not record any definition kind for a symbol, Sourcetrail will show it as "non-indexed". */ - enum DefinitionKind + enum class DefinitionKind : int { - DEFINITION_IMPLICIT = 1, - DEFINITION_EXPLICIT = 2 + IMPLICIT = 1, + EXPLICIT = 2 }; - int definitionKindToInt(DefinitionKind v); - DefinitionKind intToDefinitionKind(int v); + int definitionKindToInt(DefinitionKind kind); + DefinitionKind intToDefinitionKind(int i); } #endif // SOURCETRAIL_DEFINITION_KIND_H diff --git a/core/include/EdgeKind.h b/core/include/EdgeKind.h index 457b947..68ac9b6 100644 --- a/core/include/EdgeKind.h +++ b/core/include/EdgeKind.h @@ -28,28 +28,28 @@ namespace sourcetrail * for edges that will be created implicitly. For example edges of type "EDGE_MEMBER" will be created while storing parent * child node relations when recording symbols with hierarchical names (see NameHierarchy). */ - enum EdgeKind + enum class EdgeKind : int { - EDGE_UNKNOWN = 0, - EDGE_MEMBER = 1 << 0, - EDGE_TYPE_USAGE = 1 << 1, - EDGE_USAGE = 1 << 2, - EDGE_CALL = 1 << 3, - EDGE_INHERITANCE = 1 << 4, - EDGE_OVERRIDE = 1 << 5, - EDGE_TEMPLATE_ARGUMENT = 1 << 6, - EDGE_TYPE_ARGUMENT = 1 << 7, - EDGE_TEMPLATE_DEFAULT_ARGUMENT = 1 << 8, - EDGE_TEMPLATE_SPECIALIZATION = 1 << 9, - EDGE_TEMPLATE_MEMBER_SPECIALIZATION = 1 << 10, - EDGE_INCLUDE = 1 << 11, - EDGE_IMPORT = 1 << 12, - EDGE_AGGREGATION = 1 << 13, - EDGE_MACRO_USAGE = 1 << 14, - EDGE_ANNOTATION_USAGE = 1 << 15 + UNKNOWN = 0, + MEMBER = 1 << 0, + TYPE_USAGE = 1 << 1, + USAGE = 1 << 2, + CALL = 1 << 3, + INHERITANCE = 1 << 4, + OVERRIDE = 1 << 5, + TEMPLATE_ARGUMENT = 1 << 6, + TYPE_ARGUMENT = 1 << 7, + TEMPLATE_DEFAULT_ARGUMENT = 1 << 8, + TEMPLATE_SPECIALIZATION = 1 << 9, + TEMPLATE_MEMBER_SPECIALIZATION = 1 << 10, + INCLUDE = 1 << 11, + IMPORT = 1 << 12, + AGGREGATION = 1 << 13, + MACRO_USAGE = 1 << 14, + ANNOTATION_USAGE = 1 << 15 }; - int edgeKindToInt(EdgeKind edgeKind); + int edgeKindToInt(EdgeKind kind); EdgeKind intToEdgeKind(int i); } diff --git a/core/include/LocationKind.h b/core/include/LocationKind.h index 4219dd4..7cfcc82 100644 --- a/core/include/LocationKind.h +++ b/core/include/LocationKind.h @@ -22,21 +22,21 @@ namespace sourcetrail /** * Enum providing all possible values for kinds of locations that can be stored to the Sourcetrail database. */ - enum LocationKind + enum class LocationKind : int { - LOCATION_TOKEN = 0, - LOCATION_SCOPE = 1, - LOCATION_QUALIFIER = 2, - LOCATION_LOCAL_SYMBOL = 3, - LOCATION_SIGNATURE = 4, - LOCATION_COMMENT = 5, - LOCATION_ERROR = 6, - LOCATION_FULLTEXT_SEARCH = 7, - LOCATION_SCREEN_SEARCH = 8 + TOKEN = 0, + SCOPE = 1, + QUALIFIER = 2, + LOCAL_SYMBOL = 3, + SIGNATURE = 4, + COMMENT = 5, + ERROR = 6, + FULLTEXT_SEARCH = 7, + SCREEN_SEARCH = 8 }; + int locationKindToInt(LocationKind kind); LocationKind intToLocationKind(int i); - int locationKindToInt(LocationKind locationKind); } #endif // SOURCETRAIL_LOCATION_KIND_H diff --git a/core/include/NodeKind.h b/core/include/NodeKind.h index a897de8..893b951 100644 --- a/core/include/NodeKind.h +++ b/core/include/NodeKind.h @@ -22,34 +22,34 @@ namespace sourcetrail /** * Enum providing all possible values for kinds of nodes that can be stored to the Sourcetrail database. */ - enum NodeKind + enum class NodeKind : int { - NODE_UNKNOWN = 1 << 0, - NODE_TYPE = 1 << 1, - NODE_BUILTIN_TYPE = 1 << 2, - NODE_MODULE = 1 << 3, - NODE_NAMESPACE = 1 << 4, - NODE_PACKAGE = 1 << 5, - NODE_STRUCT = 1 << 6, - NODE_CLASS = 1 << 7, - NODE_INTERFACE = 1 << 8, - NODE_ANNOTATION = 1 << 9, - NODE_GLOBAL_VARIABLE = 1 << 10, - NODE_FIELD = 1 << 11, - NODE_FUNCTION = 1 << 12, - NODE_METHOD = 1 << 13, - NODE_ENUM = 1 << 14, - NODE_ENUM_CONSTANT = 1 << 15, - NODE_TYPEDEF = 1 << 16, - NODE_TEMPLATE_PARAMETER = 1 << 17, - NODE_TYPE_PARAMETER = 1 << 18, - NODE_FILE = 1 << 19, - NODE_MACRO = 1 << 20, - NODE_UNION = 1 << 21 + UNKNOWN = 1 << 0, + TYPE = 1 << 1, + BUILTIN_TYPE = 1 << 2, + MODULE = 1 << 3, + NAMESPACE = 1 << 4, + PACKAGE = 1 << 5, + STRUCT = 1 << 6, + CLASS = 1 << 7, + INTERFACE = 1 << 8, + ANNOTATION = 1 << 9, + GLOBAL_VARIABLE = 1 << 10, + FIELD = 1 << 11, + FUNCTION = 1 << 12, + METHOD = 1 << 13, + ENUM = 1 << 14, + ENUM_CONSTANT = 1 << 15, + TYPEDEF = 1 << 16, + TEMPLATE_PARAMETER = 1 << 17, + TYPE_PARAMETER = 1 << 18, + FILE = 1 << 19, + MACRO = 1 << 20, + UNION = 1 << 21 }; - int nodeKindToInt(NodeKind v); - NodeKind intToNodeKind(int v); + int nodeKindToInt(NodeKind kind); + NodeKind intToNodeKind(int i); } #endif // SOURCETRAIL_NODE_KIND_H diff --git a/core/include/ReferenceKind.h b/core/include/ReferenceKind.h index 0ddad8c..e7d443e 100644 --- a/core/include/ReferenceKind.h +++ b/core/include/ReferenceKind.h @@ -24,25 +24,25 @@ namespace sourcetrail /** * Enum providing all possible values for kinds of references that can be recorded using the SourcetrailDBWriter interface. */ - enum ReferenceKind + enum class ReferenceKind { - REFERENCE_TYPE_USAGE, - REFERENCE_USAGE, - REFERENCE_CALL, - REFERENCE_INHERITANCE, - REFERENCE_OVERRIDE, - REFERENCE_TEMPLATE_ARGUMENT, - REFERENCE_TYPE_ARGUMENT, - REFERENCE_TEMPLATE_DEFAULT_ARGUMENT, - REFERENCE_TEMPLATE_SPECIALIZATION, - REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION, - REFERENCE_INCLUDE, - REFERENCE_IMPORT, - REFERENCE_MACRO_USAGE, - REFERENCE_ANNOTATION_USAGE + TYPE_USAGE, + USAGE, + CALL, + INHERITANCE, + OVERRIDE, + TEMPLATE_ARGUMENT, + TYPE_ARGUMENT, + TEMPLATE_DEFAULT_ARGUMENT, + TEMPLATE_SPECIALIZATION, + TEMPLATE_MEMBER_SPECIALIZATION, + INCLUDE, + IMPORT, + MACRO_USAGE, + ANNOTATION_USAGE }; - EdgeKind referenceKindToEdgeKind(ReferenceKind referenceKind); + EdgeKind referenceKindToEdgeKind(ReferenceKind kind); } #endif // SOURCETRAIL_REFERENCE_KIND_H diff --git a/core/include/StorageSymbol.h b/core/include/StorageSymbol.h index 3ce9467..2d4ced3 100644 --- a/core/include/StorageSymbol.h +++ b/core/include/StorageSymbol.h @@ -25,7 +25,7 @@ namespace sourcetrail { StorageSymbol() : id(0) - , definitionKind(definitionKindToInt(DEFINITION_EXPLICIT)) + , definitionKind(definitionKindToInt(DefinitionKind::EXPLICIT)) {} StorageSymbol(int id, int definitionKind) diff --git a/core/include/SymbolKind.h b/core/include/SymbolKind.h index 0a50122..e8d5326 100644 --- a/core/include/SymbolKind.h +++ b/core/include/SymbolKind.h @@ -24,31 +24,31 @@ namespace sourcetrail /** * Enum providing all possible values for kinds of symbols that can be recorded using the SourcetrailDBWriter interface. */ - enum SymbolKind + enum class SymbolKind { - SYMBOL_TYPE, - SYMBOL_BUILTIN_TYPE, - SYMBOL_MODULE, - SYMBOL_NAMESPACE, - SYMBOL_PACKAGE, - SYMBOL_STRUCT, - SYMBOL_CLASS, - SYMBOL_INTERFACE, - SYMBOL_ANNOTATION, - SYMBOL_GLOBAL_VARIABLE, - SYMBOL_FIELD, - SYMBOL_FUNCTION, - SYMBOL_METHOD, - SYMBOL_ENUM, - SYMBOL_ENUM_CONSTANT, - SYMBOL_TYPEDEF, - SYMBOL_TEMPLATE_PARAMETER, - SYMBOL_TYPE_PARAMETER, - SYMBOL_MACRO, - SYMBOL_UNION + TYPE, + BUILTIN_TYPE, + MODULE, + NAMESPACE, + PACKAGE, + STRUCT, + CLASS, + INTERFACE, + ANNOTATION, + GLOBAL_VARIABLE, + FIELD, + FUNCTION, + METHOD, + ENUM, + ENUM_CONSTANT, + TYPEDEF, + TEMPLATE_PARAMETER, + TYPE_PARAMETER, + MACRO, + UNION }; - NodeKind symbolKindToNodeKind(SymbolKind v); + NodeKind symbolKindToNodeKind(SymbolKind kind); } #endif // SOURCETRAIL_SYMBOL_KIND_H diff --git a/core/src/DefinitionKind.cpp b/core/src/DefinitionKind.cpp index 957d2e6..42c6a55 100644 --- a/core/src/DefinitionKind.cpp +++ b/core/src/DefinitionKind.cpp @@ -18,18 +18,23 @@ namespace sourcetrail { - int definitionKindToInt(DefinitionKind v) + int definitionKindToInt(DefinitionKind kind) { - return v; + return static_cast(kind); } - DefinitionKind intToDefinitionKind(int v) + DefinitionKind intToDefinitionKind(int i) { - if (v == definitionKindToInt(DEFINITION_IMPLICIT)) - return DEFINITION_IMPLICIT; - if (v == definitionKindToInt(DEFINITION_EXPLICIT)) - return DEFINITION_EXPLICIT; + const DefinitionKind kinds[] = { DefinitionKind::IMPLICIT, DefinitionKind::EXPLICIT }; - return DEFINITION_EXPLICIT; + for (DefinitionKind kind : kinds) + { + if (i == definitionKindToInt(kind)) + { + return kind; + } + } + + return DefinitionKind::EXPLICIT; } } diff --git a/core/src/EdgeKind.cpp b/core/src/EdgeKind.cpp index 97b8995..17c90e4 100644 --- a/core/src/EdgeKind.cpp +++ b/core/src/EdgeKind.cpp @@ -20,47 +20,39 @@ namespace sourcetrail { - int edgeKindToInt(EdgeKind edgeKind) + int edgeKindToInt(EdgeKind kind) { - return edgeKind; + return static_cast(kind); } EdgeKind intToEdgeKind(int i) { - switch (i) + const EdgeKind kinds[] = { + EdgeKind::MEMBER, + EdgeKind::TYPE_USAGE, + EdgeKind::USAGE, + EdgeKind::CALL, + EdgeKind::INHERITANCE, + EdgeKind::OVERRIDE, + EdgeKind::TEMPLATE_ARGUMENT, + EdgeKind::TYPE_ARGUMENT, + EdgeKind::TEMPLATE_DEFAULT_ARGUMENT, + EdgeKind::TEMPLATE_SPECIALIZATION, + EdgeKind::TEMPLATE_MEMBER_SPECIALIZATION, + EdgeKind::INCLUDE, + EdgeKind::IMPORT, + EdgeKind::AGGREGATION, + EdgeKind::MACRO_USAGE + }; + + for (EdgeKind kind : kinds) { - case EDGE_MEMBER: - return EDGE_MEMBER; - case EDGE_TYPE_USAGE: - return EDGE_TYPE_USAGE; - case EDGE_USAGE: - return EDGE_USAGE; - case EDGE_CALL: - return EDGE_CALL; - case EDGE_INHERITANCE: - return EDGE_INHERITANCE; - case EDGE_OVERRIDE: - return EDGE_OVERRIDE; - case EDGE_TEMPLATE_ARGUMENT: - return EDGE_TEMPLATE_ARGUMENT; - case EDGE_TYPE_ARGUMENT: - return EDGE_TYPE_ARGUMENT; - case EDGE_TEMPLATE_DEFAULT_ARGUMENT: - return EDGE_TEMPLATE_DEFAULT_ARGUMENT; - case EDGE_TEMPLATE_SPECIALIZATION: - return EDGE_TEMPLATE_SPECIALIZATION; - case EDGE_TEMPLATE_MEMBER_SPECIALIZATION: - return EDGE_TEMPLATE_MEMBER_SPECIALIZATION; - case EDGE_INCLUDE: - return EDGE_INCLUDE; - case EDGE_IMPORT: - return EDGE_IMPORT; - case EDGE_AGGREGATION: - return EDGE_AGGREGATION; - case EDGE_MACRO_USAGE: - return EDGE_MACRO_USAGE; + if (i == edgeKindToInt(kind)) + { + return kind; + } } - return EDGE_UNKNOWN; + return EdgeKind::UNKNOWN; } } diff --git a/core/src/LocationKind.cpp b/core/src/LocationKind.cpp index d288a29..5cf2a81 100644 --- a/core/src/LocationKind.cpp +++ b/core/src/LocationKind.cpp @@ -20,34 +20,33 @@ namespace sourcetrail { - LocationKind intToLocationKind(int i) + int locationKindToInt(LocationKind kind) { - switch (i) - { - case LOCATION_TOKEN: - return LOCATION_TOKEN; - case LOCATION_SCOPE: - return LOCATION_SCOPE; - case LOCATION_QUALIFIER: - return LOCATION_QUALIFIER; - case LOCATION_LOCAL_SYMBOL: - return LOCATION_LOCAL_SYMBOL; - case LOCATION_SIGNATURE: - return LOCATION_SIGNATURE; - case LOCATION_COMMENT: - return LOCATION_COMMENT; - case LOCATION_ERROR: - return LOCATION_ERROR; - case LOCATION_FULLTEXT_SEARCH: - return LOCATION_FULLTEXT_SEARCH; - case LOCATION_SCREEN_SEARCH: - return LOCATION_SCREEN_SEARCH; - } - throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to location kind."); + return static_cast(kind); } - int locationKindToInt(LocationKind locationKind) + LocationKind intToLocationKind(int i) { - return locationKind; + const LocationKind kinds[] = { + LocationKind::TOKEN, + LocationKind::SCOPE, + LocationKind::QUALIFIER, + LocationKind::LOCAL_SYMBOL, + LocationKind::SIGNATURE, + LocationKind::COMMENT, + LocationKind::ERROR, + LocationKind::FULLTEXT_SEARCH, + LocationKind::SCREEN_SEARCH + }; + + for (LocationKind kind : kinds) + { + if (i == locationKindToInt(kind)) + { + return kind; + } + } + + throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to location kind."); } } diff --git a/core/src/NodeKind.cpp b/core/src/NodeKind.cpp index fb4b0eb..f7f8828 100644 --- a/core/src/NodeKind.cpp +++ b/core/src/NodeKind.cpp @@ -18,35 +18,46 @@ namespace sourcetrail { - int nodeKindToInt(NodeKind v) + int nodeKindToInt(NodeKind kind) { - return v; + return static_cast(kind); } - NodeKind intToNodeKind(int v) + NodeKind intToNodeKind(int i) { - if (v == nodeKindToInt(NODE_UNKNOWN)) { return NODE_UNKNOWN; } - if (v == nodeKindToInt(NODE_TYPE)) { return NODE_TYPE; } - if (v == nodeKindToInt(NODE_BUILTIN_TYPE)) { return NODE_BUILTIN_TYPE; } - if (v == nodeKindToInt(NODE_MODULE)) { return NODE_MODULE; } - if (v == nodeKindToInt(NODE_NAMESPACE)) { return NODE_NAMESPACE; } - if (v == nodeKindToInt(NODE_PACKAGE)) { return NODE_PACKAGE; } - if (v == nodeKindToInt(NODE_STRUCT)) { return NODE_STRUCT; } - if (v == nodeKindToInt(NODE_CLASS)) { return NODE_CLASS; } - if (v == nodeKindToInt(NODE_INTERFACE)) { return NODE_INTERFACE; } - if (v == nodeKindToInt(NODE_ANNOTATION)) { return NODE_ANNOTATION; } - if (v == nodeKindToInt(NODE_GLOBAL_VARIABLE)) { return NODE_GLOBAL_VARIABLE; } - if (v == nodeKindToInt(NODE_FIELD)) { return NODE_FIELD; } - if (v == nodeKindToInt(NODE_FUNCTION)) { return NODE_FUNCTION; } - if (v == nodeKindToInt(NODE_METHOD)) { return NODE_METHOD; } - if (v == nodeKindToInt(NODE_ENUM)) { return NODE_ENUM; } - if (v == nodeKindToInt(NODE_ENUM_CONSTANT)) { return NODE_ENUM_CONSTANT; } - if (v == nodeKindToInt(NODE_TYPEDEF)) { return NODE_TYPEDEF; } - if (v == nodeKindToInt(NODE_TEMPLATE_PARAMETER)) { return NODE_TEMPLATE_PARAMETER; } - if (v == nodeKindToInt(NODE_TYPE_PARAMETER)) { return NODE_TYPE_PARAMETER; } - if (v == nodeKindToInt(NODE_FILE)) { return NODE_FILE; } - if (v == nodeKindToInt(NODE_MACRO)) { return NODE_MACRO; } - if (v == nodeKindToInt(NODE_UNION)) { return NODE_UNION; } - return NODE_UNKNOWN; + const NodeKind kinds[] = { + NodeKind::UNKNOWN, + NodeKind::TYPE, + NodeKind::BUILTIN_TYPE, + NodeKind::MODULE, + NodeKind::NAMESPACE, + NodeKind::PACKAGE, + NodeKind::STRUCT, + NodeKind::CLASS, + NodeKind::INTERFACE, + NodeKind::ANNOTATION, + NodeKind::GLOBAL_VARIABLE, + NodeKind::FIELD, + NodeKind::FUNCTION, + NodeKind::METHOD, + NodeKind::ENUM, + NodeKind::ENUM_CONSTANT, + NodeKind::TYPEDEF, + NodeKind::TEMPLATE_PARAMETER, + NodeKind::TYPE_PARAMETER, + NodeKind::FILE, + NodeKind::MACRO, + NodeKind::UNION + }; + + for (NodeKind kind : kinds) + { + if (i == nodeKindToInt(kind)) + { + return kind; + } + } + + return NodeKind::UNKNOWN; } } diff --git a/core/src/ReferenceKind.cpp b/core/src/ReferenceKind.cpp index 5a0873b..d748706 100644 --- a/core/src/ReferenceKind.cpp +++ b/core/src/ReferenceKind.cpp @@ -20,39 +20,39 @@ namespace sourcetrail { - EdgeKind referenceKindToEdgeKind(ReferenceKind v) + EdgeKind referenceKindToEdgeKind(ReferenceKind kind) { - switch (v) + switch (kind) { - case REFERENCE_TYPE_USAGE: - return EDGE_TYPE_USAGE; - case REFERENCE_USAGE: - return EDGE_USAGE; - case REFERENCE_CALL: - return EDGE_CALL; - case REFERENCE_INHERITANCE: - return EDGE_INHERITANCE; - case REFERENCE_OVERRIDE: - return EDGE_OVERRIDE; - case REFERENCE_TEMPLATE_ARGUMENT: - return EDGE_TEMPLATE_ARGUMENT; - case REFERENCE_TYPE_ARGUMENT: - return EDGE_TYPE_ARGUMENT; - case REFERENCE_TEMPLATE_DEFAULT_ARGUMENT: - return EDGE_TEMPLATE_DEFAULT_ARGUMENT; - case REFERENCE_TEMPLATE_SPECIALIZATION: - return EDGE_TEMPLATE_SPECIALIZATION; - case REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION: - return EDGE_TEMPLATE_MEMBER_SPECIALIZATION; - case REFERENCE_INCLUDE: - return EDGE_INCLUDE; - case REFERENCE_IMPORT: - return EDGE_IMPORT; - case REFERENCE_MACRO_USAGE: - return EDGE_MACRO_USAGE; - case REFERENCE_ANNOTATION_USAGE: - return EDGE_ANNOTATION_USAGE; + case ReferenceKind::TYPE_USAGE: + return EdgeKind::TYPE_USAGE; + case ReferenceKind::USAGE: + return EdgeKind::USAGE; + case ReferenceKind::CALL: + return EdgeKind::CALL; + case ReferenceKind::INHERITANCE: + return EdgeKind::INHERITANCE; + case ReferenceKind::OVERRIDE: + return EdgeKind::OVERRIDE; + case ReferenceKind::TEMPLATE_ARGUMENT: + return EdgeKind::TEMPLATE_ARGUMENT; + case ReferenceKind::TYPE_ARGUMENT: + return EdgeKind::TYPE_ARGUMENT; + case ReferenceKind::TEMPLATE_DEFAULT_ARGUMENT: + return EdgeKind::TEMPLATE_DEFAULT_ARGUMENT; + case ReferenceKind::TEMPLATE_SPECIALIZATION: + return EdgeKind::TEMPLATE_SPECIALIZATION; + case ReferenceKind::TEMPLATE_MEMBER_SPECIALIZATION: + return EdgeKind::TEMPLATE_MEMBER_SPECIALIZATION; + case ReferenceKind::INCLUDE: + return EdgeKind::INCLUDE; + case ReferenceKind::IMPORT: + return EdgeKind::IMPORT; + case ReferenceKind::MACRO_USAGE: + return EdgeKind::MACRO_USAGE; + case ReferenceKind::ANNOTATION_USAGE: + return EdgeKind::ANNOTATION_USAGE; } - return EDGE_UNKNOWN; + return EdgeKind::UNKNOWN; } } diff --git a/core/src/SourcetrailDBWriter.cpp b/core/src/SourcetrailDBWriter.cpp index ef39146..9a4773a 100644 --- a/core/src/SourcetrailDBWriter.cpp +++ b/core/src/SourcetrailDBWriter.cpp @@ -377,7 +377,7 @@ namespace sourcetrail try { - addSourceLocation(symbolId, location, LOCATION_TOKEN); + addSourceLocation(symbolId, location, LocationKind::TOKEN); return true; } catch (const SourcetrailException e) @@ -397,7 +397,7 @@ namespace sourcetrail try { - addSourceLocation(symbolId, location, LOCATION_SCOPE); + addSourceLocation(symbolId, location, LocationKind::SCOPE); return true; } catch (const SourcetrailException e) @@ -417,7 +417,7 @@ namespace sourcetrail try { - addSourceLocation(symbolId, location, LOCATION_SIGNATURE); + addSourceLocation(symbolId, location, LocationKind::SIGNATURE); return true; } catch (const SourcetrailException e) @@ -456,7 +456,7 @@ namespace sourcetrail try { - addSourceLocation(referenceId, location, LOCATION_TOKEN); + addSourceLocation(referenceId, location, LocationKind::TOKEN); return true; } catch (const SourcetrailException e) @@ -535,7 +535,7 @@ namespace sourcetrail try { - addSourceLocation(localSymbolId, location, LOCATION_LOCAL_SYMBOL); + addSourceLocation(localSymbolId, location, LocationKind::LOCAL_SYMBOL); return true; } catch (const SourcetrailException e) @@ -561,7 +561,7 @@ namespace sourcetrail location.startColumn, location.endLine, location.endColumn, - locationKindToInt(LOCATION_COMMENT) + locationKindToInt(LocationKind::COMMENT) )); return true; @@ -584,7 +584,7 @@ namespace sourcetrail try { const int errorId = m_storage->addError(StorageErrorData(message, "", fatal, true)); - addSourceLocation(errorId, location, LOCATION_ERROR); + addSourceLocation(errorId, location, LocationKind::ERROR); return true; } catch (const SourcetrailException e) @@ -678,13 +678,13 @@ namespace sourcetrail currentNameHierarchy.nameElements.push_back(nameHierarchy.nameElements[i]); int nodeId = m_storage->addNode(StorageNodeData( - nodeKindToInt(NODE_UNKNOWN), + nodeKindToInt(NodeKind::UNKNOWN), serializeNameHierarchyToDatabaseString(currentNameHierarchy) )); if (parentNodeId != 0) { - addEdge(parentNodeId, nodeId, EDGE_MEMBER); + addEdge(parentNodeId, nodeId, EdgeKind::MEMBER); } parentNodeId = nodeId; @@ -701,7 +701,7 @@ namespace sourcetrail nameHierarchy.nameElements.push_back(nameElement); const int nodeId = addNodeHierarchy(nameHierarchy); - m_storage->setNodeType(nodeId, nodeKindToInt(NODE_FILE)); + m_storage->setNodeType(nodeId, nodeKindToInt(NodeKind::FILE)); m_storage->addFile(StorageFile(nodeId, filePath, "", utility::getDateTimeString(time(0)), true, true)); diff --git a/core/src/SymbolKind.cpp b/core/src/SymbolKind.cpp index 243bf61..b918df5 100644 --- a/core/src/SymbolKind.cpp +++ b/core/src/SymbolKind.cpp @@ -20,51 +20,51 @@ namespace sourcetrail { - NodeKind symbolKindToNodeKind(SymbolKind v) + NodeKind symbolKindToNodeKind(SymbolKind kind) { - switch (v) + switch (kind) { - case SYMBOL_TYPE: - return NODE_TYPE; - case SYMBOL_BUILTIN_TYPE: - return NODE_BUILTIN_TYPE; - case SYMBOL_MODULE: - return NODE_MODULE; - case SYMBOL_NAMESPACE: - return NODE_NAMESPACE; - case SYMBOL_PACKAGE: - return NODE_PACKAGE; - case SYMBOL_STRUCT: - return NODE_STRUCT; - case SYMBOL_CLASS: - return NODE_CLASS; - case SYMBOL_INTERFACE: - return NODE_INTERFACE; - case SYMBOL_ANNOTATION: - return NODE_ANNOTATION; - case SYMBOL_GLOBAL_VARIABLE: - return NODE_GLOBAL_VARIABLE; - case SYMBOL_FIELD: - return NODE_FIELD; - case SYMBOL_FUNCTION: - return NODE_FUNCTION; - case SYMBOL_METHOD: - return NODE_METHOD; - case SYMBOL_ENUM: - return NODE_ENUM; - case SYMBOL_ENUM_CONSTANT: - return NODE_ENUM_CONSTANT; - case SYMBOL_TYPEDEF: - return NODE_TYPEDEF; - case SYMBOL_TEMPLATE_PARAMETER: - return NODE_TEMPLATE_PARAMETER; - case SYMBOL_TYPE_PARAMETER: - return NODE_TYPE_PARAMETER; - case SYMBOL_MACRO: - return NODE_MACRO; - case SYMBOL_UNION: - return NODE_UNION; + case SymbolKind::TYPE: + return NodeKind::TYPE; + case SymbolKind::BUILTIN_TYPE: + return NodeKind::BUILTIN_TYPE; + case SymbolKind::MODULE: + return NodeKind::MODULE; + case SymbolKind::NAMESPACE: + return NodeKind::NAMESPACE; + case SymbolKind::PACKAGE: + return NodeKind::PACKAGE; + case SymbolKind::STRUCT: + return NodeKind::STRUCT; + case SymbolKind::CLASS: + return NodeKind::CLASS; + case SymbolKind::INTERFACE: + return NodeKind::INTERFACE; + case SymbolKind::ANNOTATION: + return NodeKind::ANNOTATION; + case SymbolKind::GLOBAL_VARIABLE: + return NodeKind::GLOBAL_VARIABLE; + case SymbolKind::FIELD: + return NodeKind::FIELD; + case SymbolKind::FUNCTION: + return NodeKind::FUNCTION; + case SymbolKind::METHOD: + return NodeKind::METHOD; + case SymbolKind::ENUM: + return NodeKind::ENUM; + case SymbolKind::ENUM_CONSTANT: + return NodeKind::ENUM_CONSTANT; + case SymbolKind::TYPEDEF: + return NodeKind::TYPEDEF; + case SymbolKind::TEMPLATE_PARAMETER: + return NodeKind::TEMPLATE_PARAMETER; + case SymbolKind::TYPE_PARAMETER: + return NodeKind::TYPE_PARAMETER; + case SymbolKind::MACRO: + return NodeKind::MACRO; + case SymbolKind::UNION: + return NodeKind::UNION; } - return NODE_UNKNOWN; + return NodeKind::UNKNOWN; } } diff --git a/core/test/test.cpp b/core/test/test.cpp index 3bb273c..d8b8773 100644 --- a/core/test/test.cpp +++ b/core/test/test.cpp @@ -79,7 +79,7 @@ namespace sourcetrail REQUIRE(nodes.size() == 1); REQUIRE(nodes.front().id == idSymbol1); REQUIRE(nodes.front().serializedName == serializeNameHierarchyToDatabaseString(nameSymbol1)); - REQUIRE(nodes.front().nodeKind == NODE_UNKNOWN); + REQUIRE(nodes.front().nodeKind == nodeKindToInt(NodeKind::UNKNOWN)); } SECTION("writer does not record node for symbol twice") @@ -94,24 +94,24 @@ namespace sourcetrail SECTION("writer records \"explicit\" symbol definition kind") { - const bool success = writer.recordSymbolDefinitionKind(idSymbol1, DEFINITION_EXPLICIT); + const bool success = writer.recordSymbolDefinitionKind(idSymbol1, DefinitionKind::EXPLICIT); REQUIRE(success); REQUIRE(writer.getLastError() == ""); const std::vector symbols = storage->getAll(); REQUIRE(symbols.size() == 1); - REQUIRE(symbols.front().definitionKind == definitionKindToInt(DEFINITION_EXPLICIT)); + REQUIRE(symbols.front().definitionKind == definitionKindToInt(DefinitionKind::EXPLICIT)); } SECTION("writer records \"class\" symbol kind") { - const bool success = writer.recordSymbolKind(idSymbol1, SYMBOL_CLASS); + const bool success = writer.recordSymbolKind(idSymbol1, SymbolKind::CLASS); REQUIRE(success); REQUIRE(writer.getLastError() == ""); const std::vector nodes = storage->getAll(); REQUIRE(nodes.size() == 1); - REQUIRE(nodes.front().nodeKind == symbolKindToNodeKind(SYMBOL_CLASS)); + REQUIRE(nodes.front().nodeKind == nodeKindToInt(NodeKind::CLASS)); } SECTION("writer records symbol locations") @@ -136,7 +136,7 @@ namespace sourcetrail sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_TOKEN)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::TOKEN)); } SECTION("writer records symbol scope location") @@ -150,7 +150,7 @@ namespace sourcetrail sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_SCOPE)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::SCOPE)); } SECTION("writer records symbol signature location") @@ -164,7 +164,7 @@ namespace sourcetrail sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_SIGNATURE)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::SIGNATURE)); } REQUIRE(sourceLocations.front().startLineNumber == startLine); @@ -212,7 +212,7 @@ namespace sourcetrail REQUIRE(idSymbol2 != 0); REQUIRE(writer.getLastError() == ""); - const ReferenceKind kindReference1 = REFERENCE_CALL; + const ReferenceKind kindReference1 = ReferenceKind::CALL; const int idReference1 = writer.recordReference(idSymbol1, idSymbol2, kindReference1); REQUIRE(idReference1 != 0); REQUIRE(writer.getLastError() == ""); @@ -229,7 +229,7 @@ namespace sourcetrail SECTION("writer does not record edge for reference twice") { - const int secondIdReference1 = writer.recordReference(idSymbol1, idSymbol2, REFERENCE_CALL); + const int secondIdReference1 = writer.recordReference(idSymbol1, idSymbol2, ReferenceKind::CALL); REQUIRE(secondIdReference1 == idReference1); REQUIRE(writer.getLastError() == ""); @@ -255,7 +255,7 @@ namespace sourcetrail const std::vector sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_TOKEN)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::TOKEN)); REQUIRE(sourceLocations.front().startLineNumber == startLine); REQUIRE(sourceLocations.front().startColumnNumber == startCol); REQUIRE(sourceLocations.front().endLineNumber == endLine); @@ -392,7 +392,7 @@ namespace sourcetrail const std::vector sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_LOCAL_SYMBOL)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::LOCAL_SYMBOL)); REQUIRE(sourceLocations.front().startLineNumber == startLine); REQUIRE(sourceLocations.front().startColumnNumber == startCol); REQUIRE(sourceLocations.front().endLineNumber == endLine); @@ -445,7 +445,7 @@ namespace sourcetrail { const std::vector sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_COMMENT)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::COMMENT)); REQUIRE(sourceLocations.front().startLineNumber == startLine); REQUIRE(sourceLocations.front().startColumnNumber == startCol); REQUIRE(sourceLocations.front().endLineNumber == endLine); @@ -514,7 +514,7 @@ namespace sourcetrail const std::vector sourceLocations = storage->getAll(); REQUIRE(sourceLocations.size() == 1); - REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LOCATION_ERROR)); + REQUIRE(sourceLocations.front().locationKind == locationKindToInt(LocationKind::ERROR)); REQUIRE(sourceLocations.front().startLineNumber == startLine); REQUIRE(sourceLocations.front().startColumnNumber == startCol); REQUIRE(sourceLocations.front().endLineNumber == endLine); diff --git a/examples/cpp_api_example/src/main.cpp b/examples/cpp_api_example/src/main.cpp index fadc72b..fe5b0b3 100644 --- a/examples/cpp_api_example/src/main.cpp +++ b/examples/cpp_api_example/src/main.cpp @@ -55,8 +55,8 @@ int main(int argc, const char *argv[]) // record namespace "api" sourcetrail::NameHierarchy namespaceName { "::", { { "", "api", "" } } }; int namespaceId = dbWriter.recordSymbol(namespaceName); - dbWriter.recordSymbolDefinitionKind(namespaceId, sourcetrail::DEFINITION_EXPLICIT); - dbWriter.recordSymbolKind(namespaceId, sourcetrail::SYMBOL_NAMESPACE); + dbWriter.recordSymbolDefinitionKind(namespaceId, sourcetrail::DefinitionKind::EXPLICIT); + dbWriter.recordSymbolKind(namespaceId, sourcetrail::SymbolKind::NAMESPACE); dbWriter.recordSymbolLocation(namespaceId, { fileId, 8, 11, 8, 13 }); dbWriter.recordSymbolScopeLocation(namespaceId, { fileId, 8, 1, 24, 1 }); @@ -65,15 +65,15 @@ int main(int argc, const char *argv[]) sourcetrail::NameHierarchy className = namespaceName; className.nameElements.push_back( { "", "MyType", "" } ); int classId = dbWriter.recordSymbol(className); - dbWriter.recordSymbolDefinitionKind(classId, sourcetrail::DEFINITION_EXPLICIT); - dbWriter.recordSymbolKind(classId, sourcetrail::SYMBOL_CLASS); + dbWriter.recordSymbolDefinitionKind(classId, sourcetrail::DefinitionKind::EXPLICIT); + dbWriter.recordSymbolKind(classId, sourcetrail::SymbolKind::CLASS); dbWriter.recordSymbolLocation(classId, { fileId, 11, 7, 11, 12 }); dbWriter.recordSymbolScopeLocation(classId, { fileId, 11, 1, 22, 1 }); // gets highlight when active // record inheritance reference to "BaseType" int baseId = dbWriter.recordSymbol( { "::", { { "", "BaseType", "" } } } ); - int inheritanceId = dbWriter.recordReference(baseId, classId, sourcetrail::REFERENCE_INHERITANCE); + int inheritanceId = dbWriter.recordReference(baseId, classId, sourcetrail::ReferenceKind::INHERITANCE); dbWriter.recordReferenceLocation(inheritanceId, { fileId, 12, 14, 12, 21 }); @@ -81,8 +81,8 @@ int main(int argc, const char *argv[]) sourcetrail::NameHierarchy methodName = className; methodName.nameElements.push_back( { "void", "my_method", "() const" } ); int methodId = dbWriter.recordSymbol(methodName); - dbWriter.recordSymbolDefinitionKind(methodId, sourcetrail::DEFINITION_EXPLICIT); - dbWriter.recordSymbolKind(methodId, sourcetrail::SYMBOL_METHOD); + dbWriter.recordSymbolDefinitionKind(methodId, sourcetrail::DefinitionKind::EXPLICIT); + dbWriter.recordSymbolKind(methodId, sourcetrail::SymbolKind::METHOD); dbWriter.recordSymbolLocation(methodId, { fileId, 15, 10, 15, 18 }); dbWriter.recordSymbolScopeLocation(methodId, { fileId, 15, 5, 21, 5 }); // gets highlight when active dbWriter.recordSymbolSignatureLocation(methodId, { fileId, 15, 5, 15, 45 }); // used in tooltip @@ -90,7 +90,7 @@ int main(int argc, const char *argv[]) // record parameter type "bool" int typeId = dbWriter.recordSymbol({ "::", { { "", "bool", "" } } }); - int typeuseId = dbWriter.recordReference(methodId, typeId, sourcetrail::REFERENCE_TYPE_USAGE); + int typeuseId = dbWriter.recordReference(methodId, typeId, sourcetrail::ReferenceKind::TYPE_USAGE); dbWriter.recordReferenceLocation(typeuseId, { fileId, 15, 20, 15, 23 }); @@ -102,8 +102,8 @@ int main(int argc, const char *argv[]) // record function call reference to "send_signal()" int funcId = dbWriter.recordSymbol({ "::", { { "", "Client", "" }, { "", "send_signal", "()" } } }); - dbWriter.recordSymbolKind(funcId, sourcetrail::SYMBOL_FUNCTION); - int callId = dbWriter.recordReference(methodId, funcId, sourcetrail::REFERENCE_CALL); + dbWriter.recordSymbolKind(funcId, sourcetrail::SymbolKind::FUNCTION); + int callId = dbWriter.recordReference(methodId, funcId, sourcetrail::ReferenceKind::CALL); dbWriter.recordReferenceLocation(callId, { fileId, 19, 13, 19, 33 }); diff --git a/examples/cpp_poetry_indexer/src/main.cpp b/examples/cpp_poetry_indexer/src/main.cpp index da99f92..d11ddab 100644 --- a/examples/cpp_poetry_indexer/src/main.cpp +++ b/examples/cpp_poetry_indexer/src/main.cpp @@ -102,8 +102,8 @@ int main(int argc, const char *argv[]) { // store the author as namespace, the title as type symbolId = dbWriter.recordSymbol(toNameHierarchy({ author, line.content })); - dbWriter.recordSymbolDefinitionKind(symbolId, sourcetrail::DEFINITION_EXPLICIT); - dbWriter.recordSymbolKind(symbolId, line.number == 1 ? sourcetrail::SYMBOL_NAMESPACE : sourcetrail::SYMBOL_TYPE); + dbWriter.recordSymbolDefinitionKind(symbolId, sourcetrail::DefinitionKind::EXPLICIT); + dbWriter.recordSymbolKind(symbolId, line.number == 1 ? sourcetrail::SymbolKind::NAMESPACE : sourcetrail::SymbolKind::TYPE); sourcetrail::SourceRange range = { fileId, line.number, 1, line.number, static_cast(line.content.size()) }; dbWriter.recordSymbolLocation(symbolId, range); @@ -135,8 +135,8 @@ int main(int argc, const char *argv[]) // store each paragraph as method paragraph.id = dbWriter.recordSymbol(toNameHierarchy({ author, poem.name, "paragraph " + std::to_string(paragraph.number) })); - dbWriter.recordSymbolDefinitionKind(paragraph.id, sourcetrail::DEFINITION_EXPLICIT); - dbWriter.recordSymbolKind(paragraph.id, sourcetrail::SYMBOL_METHOD); + dbWriter.recordSymbolDefinitionKind(paragraph.id, sourcetrail::DefinitionKind::EXPLICIT); + dbWriter.recordSymbolKind(paragraph.id, sourcetrail::SymbolKind::METHOD); paragraph.range = { fileId, line.number, 1, 0, 0 }; symbolId = paragraph.id; } @@ -160,11 +160,11 @@ int main(int argc, const char *argv[]) // store each word as global variable int wordId = dbWriter.recordSymbol(toNameHierarchy({ word })); - dbWriter.recordSymbolDefinitionKind(wordId, sourcetrail::DEFINITION_EXPLICIT); - dbWriter.recordSymbolKind(wordId, sourcetrail::SYMBOL_GLOBAL_VARIABLE); + dbWriter.recordSymbolDefinitionKind(wordId, sourcetrail::DefinitionKind::EXPLICIT); + dbWriter.recordSymbolKind(wordId, sourcetrail::SymbolKind::GLOBAL_VARIABLE); // create a reference between word and paragraph - int referenceId = dbWriter.recordReference(symbolId, wordId, sourcetrail::REFERENCE_USAGE); + int referenceId = dbWriter.recordReference(symbolId, wordId, sourcetrail::ReferenceKind::USAGE); sourcetrail::SourceRange range = { fileId, line.number, static_cast(pos + wordPos), line.number, static_cast(pos + wordPos + wordLen) - 1 }; dbWriter.recordReferenceLocation(referenceId, range); diff --git a/resources_swig/src/sourcetraildb.cpp b/resources_swig/src/sourcetraildb.cpp index 0fe5f5c..a7901af 100644 --- a/resources_swig/src/sourcetraildb.cpp +++ b/resources_swig/src/sourcetraildb.cpp @@ -13,60 +13,96 @@ namespace { switch (v) { - case DEFINITION_IMPLICIT: return sourcetrail::DEFINITION_IMPLICIT; - case DEFINITION_EXPLICIT: return sourcetrail::DEFINITION_EXPLICIT; + case DEFINITION_IMPLICIT: + return sourcetrail::DefinitionKind::IMPLICIT; + case DEFINITION_EXPLICIT: + return sourcetrail::DefinitionKind::EXPLICIT; } - return sourcetrail::DEFINITION_EXPLICIT; + return sourcetrail::DefinitionKind::EXPLICIT; } sourcetrail::SymbolKind convertSymbolKind(::SymbolKind v) { switch (v) { - case SYMBOL_TYPE: return sourcetrail::SYMBOL_TYPE; - case SYMBOL_BUILTIN_TYPE: return sourcetrail::SYMBOL_BUILTIN_TYPE; - case SYMBOL_MODULE: return sourcetrail::SYMBOL_MODULE; - case SYMBOL_NAMESPACE: return sourcetrail::SYMBOL_NAMESPACE; - case SYMBOL_PACKAGE: return sourcetrail::SYMBOL_PACKAGE; - case SYMBOL_STRUCT: return sourcetrail::SYMBOL_STRUCT; - case SYMBOL_CLASS: return sourcetrail::SYMBOL_CLASS; - case SYMBOL_INTERFACE: return sourcetrail::SYMBOL_INTERFACE; - case SYMBOL_ANNOTATION: return sourcetrail::SYMBOL_ANNOTATION; - case SYMBOL_GLOBAL_VARIABLE: return sourcetrail::SYMBOL_GLOBAL_VARIABLE; - case SYMBOL_FIELD: return sourcetrail::SYMBOL_FIELD; - case SYMBOL_FUNCTION: return sourcetrail::SYMBOL_FUNCTION; - case SYMBOL_METHOD: return sourcetrail::SYMBOL_METHOD; - case SYMBOL_ENUM: return sourcetrail::SYMBOL_ENUM; - case SYMBOL_ENUM_CONSTANT: return sourcetrail::SYMBOL_ENUM_CONSTANT; - case SYMBOL_TYPEDEF: return sourcetrail::SYMBOL_TYPEDEF; - case SYMBOL_TEMPLATE_PARAMETER: return sourcetrail::SYMBOL_TEMPLATE_PARAMETER; - case SYMBOL_TYPE_PARAMETER: return sourcetrail::SYMBOL_TYPE_PARAMETER; - case SYMBOL_MACRO: return sourcetrail::SYMBOL_MACRO; - case SYMBOL_UNION: return sourcetrail::SYMBOL_UNION; + case SYMBOL_TYPE: + return sourcetrail::SymbolKind::TYPE; + case SYMBOL_BUILTIN_TYPE: + return sourcetrail::SymbolKind::BUILTIN_TYPE; + case SYMBOL_MODULE: + return sourcetrail::SymbolKind::MODULE; + case SYMBOL_NAMESPACE: + return sourcetrail::SymbolKind::NAMESPACE; + case SYMBOL_PACKAGE: + return sourcetrail::SymbolKind::PACKAGE; + case SYMBOL_STRUCT: + return sourcetrail::SymbolKind::STRUCT; + case SYMBOL_CLASS: + return sourcetrail::SymbolKind::CLASS; + case SYMBOL_INTERFACE: + return sourcetrail::SymbolKind::INTERFACE; + case SYMBOL_ANNOTATION: + return sourcetrail::SymbolKind::ANNOTATION; + case SYMBOL_GLOBAL_VARIABLE: + return sourcetrail::SymbolKind::GLOBAL_VARIABLE; + case SYMBOL_FIELD: + return sourcetrail::SymbolKind::FIELD; + case SYMBOL_FUNCTION: + return sourcetrail::SymbolKind::FUNCTION; + case SYMBOL_METHOD: + return sourcetrail::SymbolKind::METHOD; + case SYMBOL_ENUM: + return sourcetrail::SymbolKind::ENUM; + case SYMBOL_ENUM_CONSTANT: + return sourcetrail::SymbolKind::ENUM_CONSTANT; + case SYMBOL_TYPEDEF: + return sourcetrail::SymbolKind::TYPEDEF; + case SYMBOL_TEMPLATE_PARAMETER: + return sourcetrail::SymbolKind::TEMPLATE_PARAMETER; + case SYMBOL_TYPE_PARAMETER: + return sourcetrail::SymbolKind::TYPE_PARAMETER; + case SYMBOL_MACRO: + return sourcetrail::SymbolKind::MACRO; + case SYMBOL_UNION: + return sourcetrail::SymbolKind::UNION; } - return sourcetrail::SYMBOL_TYPE; + return sourcetrail::SymbolKind::TYPE; } sourcetrail::ReferenceKind convertReferenceKind(::ReferenceKind v) { switch (v) { - case REFERENCE_TYPE_USAGE: return sourcetrail::REFERENCE_TYPE_USAGE; - case REFERENCE_USAGE: return sourcetrail::REFERENCE_USAGE; - case REFERENCE_CALL: return sourcetrail::REFERENCE_CALL; - case REFERENCE_INHERITANCE: return sourcetrail::REFERENCE_INHERITANCE; - case REFERENCE_OVERRIDE: return sourcetrail::REFERENCE_OVERRIDE; - case REFERENCE_TEMPLATE_ARGUMENT: return sourcetrail::REFERENCE_TEMPLATE_ARGUMENT; - case REFERENCE_TYPE_ARGUMENT: return sourcetrail::REFERENCE_TYPE_ARGUMENT; - case REFERENCE_TEMPLATE_DEFAULT_ARGUMENT: return sourcetrail::REFERENCE_TEMPLATE_DEFAULT_ARGUMENT; - case REFERENCE_TEMPLATE_SPECIALIZATION: return sourcetrail::REFERENCE_TEMPLATE_SPECIALIZATION; - case REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION: return sourcetrail::REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION; - case REFERENCE_INCLUDE: return sourcetrail::REFERENCE_INCLUDE; - case REFERENCE_IMPORT: return sourcetrail::REFERENCE_IMPORT; - case REFERENCE_MACRO_USAGE: return sourcetrail::REFERENCE_MACRO_USAGE; - case REFERENCE_ANNOTATION_USAGE: return sourcetrail::REFERENCE_ANNOTATION_USAGE; + case REFERENCE_TYPE_USAGE: + return sourcetrail::ReferenceKind::TYPE_USAGE; + case REFERENCE_USAGE: + return sourcetrail::ReferenceKind::USAGE; + case REFERENCE_CALL: + return sourcetrail::ReferenceKind::CALL; + case REFERENCE_INHERITANCE: + return sourcetrail::ReferenceKind::INHERITANCE; + case REFERENCE_OVERRIDE: + return sourcetrail::ReferenceKind::OVERRIDE; + case REFERENCE_TEMPLATE_ARGUMENT: + return sourcetrail::ReferenceKind::TEMPLATE_ARGUMENT; + case REFERENCE_TYPE_ARGUMENT: + return sourcetrail::ReferenceKind::TYPE_ARGUMENT; + case REFERENCE_TEMPLATE_DEFAULT_ARGUMENT: + return sourcetrail::ReferenceKind::TEMPLATE_DEFAULT_ARGUMENT; + case REFERENCE_TEMPLATE_SPECIALIZATION: + return sourcetrail::ReferenceKind::TEMPLATE_SPECIALIZATION; + case REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION: + return sourcetrail::ReferenceKind::TEMPLATE_MEMBER_SPECIALIZATION; + case REFERENCE_INCLUDE: + return sourcetrail::ReferenceKind::INCLUDE; + case REFERENCE_IMPORT: + return sourcetrail::ReferenceKind::IMPORT; + case REFERENCE_MACRO_USAGE: + return sourcetrail::ReferenceKind::MACRO_USAGE; + case REFERENCE_ANNOTATION_USAGE: + return sourcetrail::ReferenceKind::ANNOTATION_USAGE; } - return sourcetrail::REFERENCE_TYPE_USAGE; + return sourcetrail::ReferenceKind::TYPE_USAGE; } }