switched enum syntax in core to enum class
This commit is contained in:
@@ -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
|
||||
|
||||
+19
-19
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -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
|
||||
|
||||
+25
-25
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace sourcetrail
|
||||
{
|
||||
StorageSymbol()
|
||||
: id(0)
|
||||
, definitionKind(definitionKindToInt(DEFINITION_EXPLICIT))
|
||||
, definitionKind(definitionKindToInt(DefinitionKind::EXPLICIT))
|
||||
{}
|
||||
|
||||
StorageSymbol(int id, int definitionKind)
|
||||
|
||||
+22
-22
@@ -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
|
||||
|
||||
@@ -18,18 +18,23 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int definitionKindToInt(DefinitionKind v)
|
||||
int definitionKindToInt(DefinitionKind kind)
|
||||
{
|
||||
return v;
|
||||
return static_cast<int>(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;
|
||||
}
|
||||
}
|
||||
|
||||
+26
-34
@@ -20,47 +20,39 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int edgeKindToInt(EdgeKind edgeKind)
|
||||
int edgeKindToInt(EdgeKind kind)
|
||||
{
|
||||
return edgeKind;
|
||||
return static_cast<int>(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;
|
||||
}
|
||||
}
|
||||
|
||||
+24
-25
@@ -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<int>(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.");
|
||||
}
|
||||
}
|
||||
|
||||
+37
-26
@@ -18,35 +18,46 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int nodeKindToInt(NodeKind v)
|
||||
int nodeKindToInt(NodeKind kind)
|
||||
{
|
||||
return v;
|
||||
return static_cast<int>(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;
|
||||
}
|
||||
}
|
||||
|
||||
+31
-31
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
+43
-43
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -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<StorageSymbol> symbols = storage->getAll<StorageSymbol>();
|
||||
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<StorageNode> nodes = storage->getAll<StorageNode>();
|
||||
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<StorageSourceLocation>();
|
||||
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<StorageSourceLocation>();
|
||||
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<StorageSourceLocation>();
|
||||
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<StorageSourceLocation> sourceLocations = storage->getAll<StorageSourceLocation>();
|
||||
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<StorageSourceLocation> sourceLocations = storage->getAll<StorageSourceLocation>();
|
||||
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<StorageSourceLocation> sourceLocations = storage->getAll<StorageSourceLocation>();
|
||||
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<StorageSourceLocation> sourceLocations = storage->getAll<StorageSourceLocation>();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user