apply clang-format
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: false
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 140
|
||||
CompactNamespaces: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
FixNamespaceComments: true
|
||||
IncludeBlocks: Preserve
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: None
|
||||
PenaltyBreakAssignment: 50
|
||||
PenaltyBreakBeforeFirstCallParameter: 0
|
||||
PenaltyBreakComment: 100
|
||||
PenaltyBreakFirstLessLess: 200
|
||||
PenaltyBreakString: 100
|
||||
PenaltyBreakTemplateDeclaration: 0
|
||||
PenaltyExcessCharacter: 10
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: false
|
||||
SpaceBeforeInheritanceColon: false
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 4
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++17
|
||||
TabWidth: 4
|
||||
UseTab: Always
|
||||
---
|
||||
Language: Cpp
|
||||
---
|
||||
Language: Java
|
||||
#BasedOnStyle: Google
|
||||
#BreakAfterJavaFieldAnnotations: true
|
||||
@@ -141,6 +141,6 @@ namespace sourcetrail
|
||||
std::vector<StorageOccurrence> DatabaseStorage::doGetAll<StorageOccurrence>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageError> DatabaseStorage::doGetAll<StorageError>(const std::string& query) const;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_DATABASE_STORAGE_H
|
||||
|
||||
@@ -23,10 +23,10 @@ namespace sourcetrail
|
||||
* Enum providing all possible values for a symbol's definition kind.
|
||||
*
|
||||
* The DefinitionKind specifies "how" a symbol is defined.
|
||||
* When recording the definition of a symbol, you would usually also record an explicit definition kind.
|
||||
* However, you may also want to record symbols that are implicitly generated by the compiler. In this case you can
|
||||
* 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".
|
||||
* When recording the definition of a symbol, you would usually also record an explicit definition
|
||||
* kind. However, you may also want to record symbols that are implicitly generated by the compiler.
|
||||
* In this case you can 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 class DefinitionKind : int
|
||||
{
|
||||
@@ -36,6 +36,6 @@ namespace sourcetrail
|
||||
|
||||
int definitionKindToInt(DefinitionKind kind);
|
||||
DefinitionKind intToDefinitionKind(int i);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_DEFINITION_KIND_H
|
||||
|
||||
@@ -47,6 +47,6 @@ namespace sourcetrail
|
||||
|
||||
int edgeKindToInt(EdgeKind kind);
|
||||
EdgeKind intToEdgeKind(int i);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_EDGE_KIND_H
|
||||
|
||||
@@ -29,6 +29,6 @@ namespace sourcetrail
|
||||
|
||||
int elementComponentKindToInt(ElementComponentKind kind);
|
||||
ElementComponentKind intToElementComponentKind(int i);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_ELEMENT_COMPONENT_KIND_H
|
||||
|
||||
@@ -38,6 +38,6 @@ namespace sourcetrail
|
||||
|
||||
int locationKindToInt(LocationKind kind);
|
||||
LocationKind intToLocationKind(int i);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_LOCATION_KIND_H
|
||||
|
||||
@@ -93,6 +93,6 @@ namespace sourcetrail
|
||||
* INTERNAL: Converts a NameHierarchy to a string in Sourcetrail database format
|
||||
*/
|
||||
std::string serializeNameHierarchyToDatabaseString(const NameHierarchy& nameHierarchy);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_NAME_HIERARCHY_H
|
||||
|
||||
@@ -49,6 +49,6 @@ namespace sourcetrail
|
||||
|
||||
int nodeKindToInt(NodeKind kind);
|
||||
NodeKind intToNodeKind(int i);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_NODE_KIND_H
|
||||
|
||||
@@ -40,6 +40,6 @@ namespace sourcetrail
|
||||
};
|
||||
|
||||
EdgeKind referenceKindToEdgeKind(ReferenceKind kind);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_REFERENCE_KIND_H
|
||||
|
||||
@@ -33,6 +33,6 @@ namespace sourcetrail
|
||||
int endLine;
|
||||
int endColumn;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SOURCE_RANGE_H
|
||||
|
||||
@@ -519,6 +519,6 @@ namespace sourcetrail
|
||||
std::unique_ptr<DatabaseStorage> m_storage;
|
||||
mutable std::string m_lastError;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SRCTRLDB_WRITER_H
|
||||
|
||||
@@ -29,11 +29,14 @@ namespace sourcetrail
|
||||
public:
|
||||
SourcetrailException(std::string message): m_message(message) {}
|
||||
virtual ~SourcetrailException() = default;
|
||||
std::string getMessage() const { return m_message; }
|
||||
std::string getMessage() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_message;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SOURCETRAIL_EXCEPTION_H
|
||||
|
||||
@@ -21,17 +21,12 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageEdgeData
|
||||
{
|
||||
StorageEdgeData()
|
||||
: sourceNodeId(0)
|
||||
, targetNodeId(0)
|
||||
, edgeKind(0)
|
||||
{}
|
||||
StorageEdgeData(): sourceNodeId(0), targetNodeId(0), edgeKind(0) {}
|
||||
|
||||
StorageEdgeData(int sourceNodeId, int targetNodeId, int edgeKind)
|
||||
: sourceNodeId(sourceNodeId)
|
||||
, targetNodeId(targetNodeId)
|
||||
, edgeKind(edgeKind)
|
||||
{}
|
||||
: sourceNodeId(sourceNodeId), targetNodeId(targetNodeId), edgeKind(edgeKind)
|
||||
{
|
||||
}
|
||||
|
||||
int sourceNodeId;
|
||||
int targetNodeId;
|
||||
@@ -40,23 +35,14 @@ namespace sourcetrail
|
||||
|
||||
struct StorageEdge: public StorageEdgeData
|
||||
{
|
||||
StorageEdge()
|
||||
: StorageEdgeData()
|
||||
, id(0)
|
||||
{}
|
||||
StorageEdge(): StorageEdgeData(), id(0) {}
|
||||
|
||||
StorageEdge(int id, const StorageEdgeData& data)
|
||||
: StorageEdgeData(data)
|
||||
, id(id)
|
||||
{}
|
||||
StorageEdge(int id, const StorageEdgeData& data): StorageEdgeData(data), id(id) {}
|
||||
|
||||
StorageEdge(int id, int sourceNodeId, int targetNodeId, int edgeKind)
|
||||
: StorageEdgeData(sourceNodeId, targetNodeId, edgeKind)
|
||||
, id(id)
|
||||
{}
|
||||
StorageEdge(int id, int sourceNodeId, int targetNodeId, int edgeKind): StorageEdgeData(sourceNodeId, targetNodeId, edgeKind), id(id) {}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_EDGE_H
|
||||
|
||||
@@ -23,17 +23,12 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageElementComponentData
|
||||
{
|
||||
StorageElementComponentData()
|
||||
: elementId(0)
|
||||
, componentKind(0)
|
||||
, data("")
|
||||
{}
|
||||
StorageElementComponentData(): elementId(0), componentKind(0), data("") {}
|
||||
|
||||
StorageElementComponentData(int elementId, int componentKind, std::string data)
|
||||
: elementId(elementId)
|
||||
, componentKind(componentKind)
|
||||
, data(std::move(data))
|
||||
{}
|
||||
: elementId(elementId), componentKind(componentKind), data(std::move(data))
|
||||
{
|
||||
}
|
||||
|
||||
int elementId;
|
||||
int componentKind;
|
||||
@@ -42,23 +37,17 @@ namespace sourcetrail
|
||||
|
||||
struct StorageElementComponent: public StorageElementComponentData
|
||||
{
|
||||
StorageElementComponent()
|
||||
: StorageElementComponentData()
|
||||
, id(0)
|
||||
{}
|
||||
StorageElementComponent(): StorageElementComponentData(), id(0) {}
|
||||
|
||||
StorageElementComponent(int id, const StorageElementComponentData& data)
|
||||
: StorageElementComponentData(data)
|
||||
, id(id)
|
||||
{}
|
||||
StorageElementComponent(int id, const StorageElementComponentData& data): StorageElementComponentData(data), id(id) {}
|
||||
|
||||
StorageElementComponent(int id, int elementId, int componentKind, std::string data)
|
||||
: StorageElementComponentData(elementId, componentKind, data)
|
||||
, id(id)
|
||||
{}
|
||||
: StorageElementComponentData(elementId, componentKind, data), id(id)
|
||||
{
|
||||
}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_ELEMENT_COMPONENT_H
|
||||
|
||||
+12
-42
@@ -23,25 +23,12 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageErrorData
|
||||
{
|
||||
StorageErrorData()
|
||||
: message("")
|
||||
, translationUnit("")
|
||||
, fatal(0)
|
||||
, indexed(0)
|
||||
StorageErrorData(): message(""), translationUnit(""), fatal(0), indexed(0) {}
|
||||
|
||||
{}
|
||||
|
||||
StorageErrorData(
|
||||
std::string message,
|
||||
std::string translationUnit,
|
||||
bool fatal,
|
||||
bool indexed
|
||||
)
|
||||
: message(std::move(message))
|
||||
, translationUnit(std::move(translationUnit))
|
||||
, fatal(fatal)
|
||||
, indexed(indexed)
|
||||
{}
|
||||
StorageErrorData(std::string message, std::string translationUnit, bool fatal, bool indexed)
|
||||
: message(std::move(message)), translationUnit(std::move(translationUnit)), fatal(fatal), indexed(indexed)
|
||||
{
|
||||
}
|
||||
|
||||
std::string message;
|
||||
std::string translationUnit;
|
||||
@@ -51,34 +38,17 @@ namespace sourcetrail
|
||||
|
||||
struct StorageError: public StorageErrorData
|
||||
{
|
||||
StorageError()
|
||||
: StorageErrorData()
|
||||
, id(0)
|
||||
{}
|
||||
StorageError(): StorageErrorData(), id(0) {}
|
||||
|
||||
StorageError(int id, const StorageErrorData& data)
|
||||
: StorageErrorData(data)
|
||||
, id(id)
|
||||
{}
|
||||
StorageError(int id, const StorageErrorData& data): StorageErrorData(data), id(id) {}
|
||||
|
||||
StorageError(
|
||||
int id,
|
||||
std::string message,
|
||||
std::string translationUnit,
|
||||
bool fatal,
|
||||
bool indexed
|
||||
)
|
||||
: StorageErrorData(
|
||||
std::move(message),
|
||||
std::move(translationUnit),
|
||||
fatal,
|
||||
indexed
|
||||
)
|
||||
, id(id)
|
||||
{}
|
||||
StorageError(int id, std::string message, std::string translationUnit, bool fatal, bool indexed)
|
||||
: StorageErrorData(std::move(message), std::move(translationUnit), fatal, indexed), id(id)
|
||||
{
|
||||
}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_ERROR_H
|
||||
|
||||
@@ -23,14 +23,7 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageFile
|
||||
{
|
||||
StorageFile()
|
||||
: id(0)
|
||||
, filePath("")
|
||||
, languageIdentifier("")
|
||||
, modificationTime("")
|
||||
, indexed(true)
|
||||
, complete(true)
|
||||
{}
|
||||
StorageFile(): id(0), filePath(""), languageIdentifier(""), modificationTime(""), indexed(true), complete(true) {}
|
||||
|
||||
StorageFile(int id, std::string filePath, std::string languageIdentifier, std::string modificationTime, bool indexed, bool complete)
|
||||
: id(id)
|
||||
@@ -39,7 +32,8 @@ namespace sourcetrail
|
||||
, modificationTime(std::move(modificationTime))
|
||||
, indexed(indexed)
|
||||
, complete(complete)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int id;
|
||||
std::string filePath;
|
||||
@@ -48,6 +42,6 @@ namespace sourcetrail
|
||||
bool indexed;
|
||||
bool complete;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_FILE_H
|
||||
|
||||
@@ -23,36 +23,23 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageLocalSymbolData
|
||||
{
|
||||
StorageLocalSymbolData()
|
||||
: name("")
|
||||
{}
|
||||
StorageLocalSymbolData(): name("") {}
|
||||
|
||||
StorageLocalSymbolData(std::string name)
|
||||
: name(std::move(name))
|
||||
{}
|
||||
StorageLocalSymbolData(std::string name): name(std::move(name)) {}
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct StorageLocalSymbol: public StorageLocalSymbolData
|
||||
{
|
||||
StorageLocalSymbol()
|
||||
: StorageLocalSymbolData()
|
||||
, id(0)
|
||||
{}
|
||||
StorageLocalSymbol(): StorageLocalSymbolData(), id(0) {}
|
||||
|
||||
StorageLocalSymbol(int id, const StorageLocalSymbolData& data)
|
||||
: StorageLocalSymbolData(data)
|
||||
, id(id)
|
||||
{}
|
||||
StorageLocalSymbol(int id, const StorageLocalSymbolData& data): StorageLocalSymbolData(data), id(id) {}
|
||||
|
||||
StorageLocalSymbol(int id, std::string name)
|
||||
: StorageLocalSymbolData(std::move(name))
|
||||
, id(id)
|
||||
{}
|
||||
StorageLocalSymbol(int id, std::string name): StorageLocalSymbolData(std::move(name)), id(id) {}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_LOCAL_SYMBOL_H
|
||||
|
||||
@@ -23,15 +23,9 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageNodeData
|
||||
{
|
||||
StorageNodeData()
|
||||
: nodeKind(0)
|
||||
, serializedName("")
|
||||
{}
|
||||
StorageNodeData(): nodeKind(0), serializedName("") {}
|
||||
|
||||
StorageNodeData(int nodeKind, std::string serializedName)
|
||||
: nodeKind(nodeKind)
|
||||
, serializedName(std::move(serializedName))
|
||||
{}
|
||||
StorageNodeData(int nodeKind, std::string serializedName): nodeKind(nodeKind), serializedName(std::move(serializedName)) {}
|
||||
|
||||
int nodeKind;
|
||||
std::string serializedName;
|
||||
@@ -39,23 +33,14 @@ namespace sourcetrail
|
||||
|
||||
struct StorageNode: public StorageNodeData
|
||||
{
|
||||
StorageNode()
|
||||
: StorageNodeData()
|
||||
, id(0)
|
||||
{}
|
||||
StorageNode(): StorageNodeData(), id(0) {}
|
||||
|
||||
StorageNode(int id, int nodeKind, std::string serializedName)
|
||||
: StorageNodeData(nodeKind, std::move(serializedName))
|
||||
, id(id)
|
||||
{}
|
||||
StorageNode(int id, int nodeKind, std::string serializedName): StorageNodeData(nodeKind, std::move(serializedName)), id(id) {}
|
||||
|
||||
StorageNode(int id, const StorageNodeData& data)
|
||||
: StorageNodeData(data)
|
||||
, id(id)
|
||||
{}
|
||||
StorageNode(int id, const StorageNodeData& data): StorageNodeData(data), id(id) {}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_NODE_H
|
||||
|
||||
@@ -21,19 +21,13 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageOccurrence
|
||||
{
|
||||
StorageOccurrence()
|
||||
: elementId(0)
|
||||
, sourceLocationId(0)
|
||||
{}
|
||||
StorageOccurrence(): elementId(0), sourceLocationId(0) {}
|
||||
|
||||
StorageOccurrence(int elementId, int sourceLocationId)
|
||||
: elementId(elementId)
|
||||
, sourceLocationId(sourceLocationId)
|
||||
{}
|
||||
StorageOccurrence(int elementId, int sourceLocationId): elementId(elementId), sourceLocationId(sourceLocationId) {}
|
||||
|
||||
int elementId;
|
||||
int sourceLocationId;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_OCCURRENCE_H
|
||||
|
||||
@@ -22,13 +22,9 @@ namespace sourcetrail
|
||||
struct StorageSourceLocationData
|
||||
{
|
||||
StorageSourceLocationData()
|
||||
: fileNodeId(0)
|
||||
, startLineNumber(-1)
|
||||
, startColumnNumber(-1)
|
||||
, endLineNumber(-1)
|
||||
, endColumnNumber(-1)
|
||||
, locationKind(0)
|
||||
{}
|
||||
: fileNodeId(0), startLineNumber(-1), startColumnNumber(-1), endLineNumber(-1), endColumnNumber(-1), locationKind(0)
|
||||
{
|
||||
}
|
||||
|
||||
StorageSourceLocationData(int fileNodeId, int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber, int locationKind)
|
||||
: fileNodeId(fileNodeId)
|
||||
@@ -37,7 +33,8 @@ namespace sourcetrail
|
||||
, endLineNumber(endLineNumber)
|
||||
, endColumnNumber(endColumnNumber)
|
||||
, locationKind(locationKind)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int fileNodeId;
|
||||
int startLineNumber;
|
||||
@@ -49,23 +46,18 @@ namespace sourcetrail
|
||||
|
||||
struct StorageSourceLocation: public StorageSourceLocationData
|
||||
{
|
||||
StorageSourceLocation()
|
||||
: StorageSourceLocationData()
|
||||
, id(0)
|
||||
{}
|
||||
StorageSourceLocation(): StorageSourceLocationData(), id(0) {}
|
||||
|
||||
StorageSourceLocation(int id, const StorageSourceLocationData& data)
|
||||
: StorageSourceLocationData(data)
|
||||
, id(id)
|
||||
{}
|
||||
StorageSourceLocation(int id, const StorageSourceLocationData& data): StorageSourceLocationData(data), id(id) {}
|
||||
|
||||
StorageSourceLocation(int id, int fileNodeId, int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber, int locationKind)
|
||||
: StorageSourceLocationData(fileNodeId, startLineNumber, startColumnNumber, endLineNumber, endColumnNumber, locationKind)
|
||||
, id(id)
|
||||
{}
|
||||
StorageSourceLocation(
|
||||
int id, int fileNodeId, int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber, int locationKind)
|
||||
: StorageSourceLocationData(fileNodeId, startLineNumber, startColumnNumber, endLineNumber, endColumnNumber, locationKind), id(id)
|
||||
{
|
||||
}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_SOURCE_LOCATION_H
|
||||
|
||||
@@ -23,19 +23,13 @@ namespace sourcetrail
|
||||
{
|
||||
struct StorageSymbol
|
||||
{
|
||||
StorageSymbol()
|
||||
: id(0)
|
||||
, definitionKind(definitionKindToInt(DefinitionKind::EXPLICIT))
|
||||
{}
|
||||
StorageSymbol(): id(0), definitionKind(definitionKindToInt(DefinitionKind::EXPLICIT)) {}
|
||||
|
||||
StorageSymbol(int id, int definitionKind)
|
||||
: id(id)
|
||||
, definitionKind(definitionKind)
|
||||
{}
|
||||
StorageSymbol(int id, int definitionKind): id(id), definitionKind(definitionKind) {}
|
||||
|
||||
int id;
|
||||
int definitionKind;
|
||||
};
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_SYMBOL_H
|
||||
|
||||
@@ -48,6 +48,6 @@ namespace sourcetrail
|
||||
};
|
||||
|
||||
NodeKind symbolKindToNodeKind(SymbolKind kind);
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SYMBOL_KIND_H
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace sourcetrail
|
||||
std::string getFileContent(const std::string& filePath);
|
||||
std::string getDateTimeString(const time_t& time);
|
||||
int getLineCount(const std::string s);
|
||||
}
|
||||
}
|
||||
} // namespace utility
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_UTILITY_H
|
||||
|
||||
+54
-126
@@ -18,11 +18,11 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "NodeKind.h"
|
||||
#include "SourcetrailException.h"
|
||||
#include "StorageFile.h"
|
||||
#include "StorageNode.h"
|
||||
#include "StorageSymbol.h"
|
||||
#include "NodeKind.h"
|
||||
#include "utility.h"
|
||||
#include "version.h"
|
||||
|
||||
@@ -94,9 +94,7 @@ namespace sourcetrail
|
||||
bool DatabaseStorage::isEmpty() const
|
||||
{
|
||||
const std::string tableName = "meta";
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT name FROM sqlite_master WHERE type='table' AND name='" + tableName + "';"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT name FROM sqlite_master WHERE type='table' AND name='" + tableName + "';");
|
||||
|
||||
if (!q.eof())
|
||||
{
|
||||
@@ -394,15 +392,13 @@ namespace sourcetrail
|
||||
" key TEXT, "
|
||||
" value TEXT, "
|
||||
" PRIMARY KEY(id)"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS element("
|
||||
" id INTEGER, "
|
||||
" PRIMARY KEY(id)"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS element_component("
|
||||
@@ -412,8 +408,7 @@ namespace sourcetrail
|
||||
" data TEXT, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(element_id) REFERENCES element(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS edge("
|
||||
@@ -425,8 +420,7 @@ namespace sourcetrail
|
||||
" FOREIGN KEY(id) REFERENCES element(id) ON DELETE CASCADE, "
|
||||
" FOREIGN KEY(source_node_id) REFERENCES node(id) ON DELETE CASCADE, "
|
||||
" FOREIGN KEY(target_node_id) REFERENCES node(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS node("
|
||||
@@ -435,8 +429,7 @@ namespace sourcetrail
|
||||
" serialized_name TEXT, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(id) REFERENCES element(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS symbol("
|
||||
@@ -444,8 +437,7 @@ namespace sourcetrail
|
||||
" definition_kind INTEGER NOT NULL, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(id) REFERENCES node(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS file("
|
||||
@@ -458,8 +450,7 @@ namespace sourcetrail
|
||||
" line_count INTEGER, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(id) REFERENCES node(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS filecontent("
|
||||
@@ -468,8 +459,7 @@ namespace sourcetrail
|
||||
" FOREIGN KEY(id) REFERENCES file(id)"
|
||||
" ON DELETE CASCADE "
|
||||
" ON UPDATE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS local_symbol("
|
||||
@@ -477,8 +467,7 @@ namespace sourcetrail
|
||||
" name TEXT, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(id) REFERENCES element(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS source_location("
|
||||
@@ -491,8 +480,7 @@ namespace sourcetrail
|
||||
" type INTEGER, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(file_node_id) REFERENCES node(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS occurrence("
|
||||
@@ -501,8 +489,7 @@ namespace sourcetrail
|
||||
" PRIMARY KEY(element_id, source_location_id), "
|
||||
" FOREIGN KEY(element_id) REFERENCES element(id) ON DELETE CASCADE, "
|
||||
" FOREIGN KEY(source_location_id) REFERENCES source_location(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS component_access("
|
||||
@@ -510,8 +497,7 @@ namespace sourcetrail
|
||||
" type INTEGER NOT NULL, "
|
||||
" PRIMARY KEY(node_id), "
|
||||
" FOREIGN KEY(node_id) REFERENCES node(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE IF NOT EXISTS error("
|
||||
@@ -522,8 +508,7 @@ namespace sourcetrail
|
||||
" translation_unit TEXT, "
|
||||
" PRIMARY KEY(id), "
|
||||
" FOREIGN KEY(id) REFERENCES element(id) ON DELETE CASCADE"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
}
|
||||
|
||||
void DatabaseStorage::clearTables()
|
||||
@@ -541,8 +526,7 @@ namespace sourcetrail
|
||||
"node",
|
||||
"edge",
|
||||
"element_component"
|
||||
"element"
|
||||
};
|
||||
"element"};
|
||||
|
||||
for (const std::string& tableName: tableNames)
|
||||
{
|
||||
@@ -552,85 +536,50 @@ namespace sourcetrail
|
||||
|
||||
void DatabaseStorage::setupIndices()
|
||||
{
|
||||
executeStatement(
|
||||
"CREATE INDEX IF NOT EXISTS node_serialized_name_index ON node(serialized_name);"
|
||||
);
|
||||
executeStatement("CREATE INDEX IF NOT EXISTS node_serialized_name_index ON node(serialized_name);");
|
||||
|
||||
executeStatement(
|
||||
"CREATE INDEX IF NOT EXISTS edge_source_target_type_index ON edge(source_node_id, target_node_id, type);"
|
||||
);
|
||||
executeStatement("CREATE INDEX IF NOT EXISTS edge_source_target_type_index ON edge(source_node_id, target_node_id, type);");
|
||||
|
||||
executeStatement(
|
||||
"CREATE INDEX IF NOT EXISTS local_symbol_name_index ON local_symbol(name);"
|
||||
);
|
||||
executeStatement("CREATE INDEX IF NOT EXISTS local_symbol_name_index ON local_symbol(name);");
|
||||
|
||||
executeStatement(
|
||||
"CREATE INDEX IF NOT EXISTS source_location_all_data_index "
|
||||
"ON source_location(file_node_id, start_line, start_column, end_line, end_column, type);"
|
||||
);
|
||||
"ON source_location(file_node_id, start_line, start_column, end_line, end_column, type);");
|
||||
|
||||
executeStatement(
|
||||
"CREATE INDEX IF NOT EXISTS error_all_data_index ON error(message, fatal);"
|
||||
);
|
||||
executeStatement("CREATE INDEX IF NOT EXISTS error_all_data_index ON error(message, fatal);");
|
||||
}
|
||||
|
||||
void DatabaseStorage::setupPrecompiledStatements()
|
||||
{
|
||||
m_insertElementStatement = compileStatement(
|
||||
"INSERT INTO element(id) VALUES(NULL);"
|
||||
);
|
||||
m_insertElementStatement = compileStatement("INSERT INTO element(id) VALUES(NULL);");
|
||||
|
||||
m_insertElementComponentStatement = compileStatement(
|
||||
"INSERT INTO element_component(id, element_id, type, data) VALUES(NULL, ?, ?, ?);"
|
||||
);
|
||||
"INSERT INTO element_component(id, element_id, type, data) VALUES(NULL, ?, ?, ?);");
|
||||
|
||||
m_findNodeStatement = compileStatement(
|
||||
"SELECT id FROM node WHERE serialized_name == ? LIMIT 1;"
|
||||
);
|
||||
m_findNodeStatement = compileStatement("SELECT id FROM node WHERE serialized_name == ? LIMIT 1;");
|
||||
|
||||
m_insertNodeStatement = compileStatement(
|
||||
"INSERT INTO node(id, type, serialized_name) VALUES(?, ?, ?);"
|
||||
);
|
||||
m_insertNodeStatement = compileStatement("INSERT INTO node(id, type, serialized_name) VALUES(?, ?, ?);");
|
||||
|
||||
m_setNodeTypeStmt = compileStatement(
|
||||
"UPDATE node SET type = ? WHERE id == ?;"
|
||||
);
|
||||
m_setNodeTypeStmt = compileStatement("UPDATE node SET type = ? WHERE id == ?;");
|
||||
|
||||
m_insertSymbolStatement = compileStatement(
|
||||
"INSERT OR IGNORE INTO symbol(id, definition_kind) VALUES(?, ?);"
|
||||
);
|
||||
m_insertSymbolStatement = compileStatement("INSERT OR IGNORE INTO symbol(id, definition_kind) VALUES(?, ?);");
|
||||
|
||||
m_findFileStatement = compileStatement(
|
||||
"SELECT id FROM file WHERE id == ?;"
|
||||
);
|
||||
m_findFileStatement = compileStatement("SELECT id FROM file WHERE id == ?;");
|
||||
|
||||
m_insertFileStatement = compileStatement(
|
||||
"INSERT OR IGNORE INTO file(id, path, language, modification_time, indexed, complete, line_count) VALUES(?, ?, ?, ?, ?, ?, ?);"
|
||||
);
|
||||
"INSERT OR IGNORE INTO file(id, path, language, modification_time, indexed, complete, line_count) VALUES(?, ?, ?, ?, ?, ?, ?);");
|
||||
|
||||
m_setFileLanguageStmt = compileStatement(
|
||||
"UPDATE file SET language = ? WHERE id == ?;"
|
||||
);
|
||||
m_setFileLanguageStmt = compileStatement("UPDATE file SET language = ? WHERE id == ?;");
|
||||
|
||||
m_insertFileContentStatement = compileStatement(
|
||||
"INSERT INTO filecontent(id, content) VALUES(?, ?);"
|
||||
);
|
||||
m_insertFileContentStatement = compileStatement("INSERT INTO filecontent(id, content) VALUES(?, ?);");
|
||||
|
||||
m_findEdgeStatement = compileStatement(
|
||||
"SELECT id FROM edge WHERE source_node_id == ? AND target_node_id == ? AND type == ? LIMIT 1;"
|
||||
);
|
||||
m_findEdgeStatement = compileStatement("SELECT id FROM edge WHERE source_node_id == ? AND target_node_id == ? AND type == ? LIMIT 1;");
|
||||
|
||||
m_insertEdgeStatement = compileStatement(
|
||||
"INSERT INTO edge(id, type, source_node_id, target_node_id) VALUES(?, ?, ?, ?);"
|
||||
);
|
||||
m_insertEdgeStatement = compileStatement("INSERT INTO edge(id, type, source_node_id, target_node_id) VALUES(?, ?, ?, ?);");
|
||||
|
||||
m_findLocalSymbolStmt = compileStatement(
|
||||
"SELECT id FROM local_symbol WHERE name == ? LIMIT 1;"
|
||||
);
|
||||
m_findLocalSymbolStmt = compileStatement("SELECT id FROM local_symbol WHERE name == ? LIMIT 1;");
|
||||
|
||||
m_insertLocalSymbolStmt = compileStatement(
|
||||
"INSERT INTO local_symbol(id, name) VALUES(?, ?);"
|
||||
);
|
||||
m_insertLocalSymbolStmt = compileStatement("INSERT INTO local_symbol(id, name) VALUES(?, ?);");
|
||||
|
||||
m_findSourceLocationStmt = compileStatement(
|
||||
"SELECT id FROM source_location WHERE "
|
||||
@@ -640,36 +589,29 @@ namespace sourcetrail
|
||||
"end_line = ? AND "
|
||||
"end_column = ? AND "
|
||||
"type = ? "
|
||||
"LIMIT 1;"
|
||||
);
|
||||
"LIMIT 1;");
|
||||
|
||||
m_insertSourceLocationStmt = compileStatement(
|
||||
"INSERT INTO source_location("
|
||||
"id, file_node_id, start_line, start_column, end_line, end_column, type) "
|
||||
"VALUES(NULL, ?, ?, ?, ?, ?, ?);"
|
||||
);
|
||||
"VALUES(NULL, ?, ?, ?, ?, ?, ?);");
|
||||
|
||||
m_insertOccurenceStmt = compileStatement(
|
||||
"INSERT OR IGNORE INTO occurrence(element_id, source_location_id) VALUES(?, ?);"
|
||||
);
|
||||
m_insertOccurenceStmt = compileStatement("INSERT OR IGNORE INTO occurrence(element_id, source_location_id) VALUES(?, ?);");
|
||||
|
||||
m_findErrorStatement = compileStatement(
|
||||
"SELECT id FROM error WHERE "
|
||||
"message = ? AND "
|
||||
"fatal == ? "
|
||||
"LIMIT 1;"
|
||||
);
|
||||
"LIMIT 1;");
|
||||
|
||||
m_insertErrorStatement = compileStatement(
|
||||
"INSERT INTO error(id, message, fatal, indexed, translation_unit) "
|
||||
"VALUES(?, ?, ?, ?, ?);"
|
||||
);
|
||||
"VALUES(?, ?, ?, ?, ?);");
|
||||
|
||||
m_insertOrUpdateMetaValueStmt = compileStatement(
|
||||
"INSERT OR REPLACE INTO meta(id, key, value) VALUES("
|
||||
"(SELECT id FROM meta WHERE key = ?), ?, ?"
|
||||
");"
|
||||
);
|
||||
");");
|
||||
}
|
||||
|
||||
void DatabaseStorage::clearPrecompiledStatements()
|
||||
@@ -778,9 +720,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageEdge> DatabaseStorage::doGetAll<StorageEdge>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, type, source_node_id, target_node_id FROM edge " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT id, type, source_node_id, target_node_id FROM edge " + query + ";");
|
||||
|
||||
std::vector<StorageEdge> edges;
|
||||
while (!q.eof())
|
||||
@@ -803,9 +743,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageNode> DatabaseStorage::doGetAll<StorageNode>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, type, serialized_name FROM node " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT id, type, serialized_name FROM node " + query + ";");
|
||||
|
||||
std::vector<StorageNode> nodes;
|
||||
while (!q.eof())
|
||||
@@ -827,9 +765,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageSymbol> DatabaseStorage::doGetAll<StorageSymbol>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, definition_kind FROM symbol " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT id, definition_kind FROM symbol " + query + ";");
|
||||
|
||||
std::vector<StorageSymbol> symbols;
|
||||
while (!q.eof())
|
||||
@@ -850,9 +786,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageFile> DatabaseStorage::doGetAll<StorageFile>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, path, language, modification_time, indexed, complete FROM file " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT id, path, language, modification_time, indexed, complete FROM file " + query + ";");
|
||||
|
||||
std::vector<StorageFile> files;
|
||||
while (!q.eof())
|
||||
@@ -877,9 +811,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageLocalSymbol> DatabaseStorage::doGetAll<StorageLocalSymbol>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, name FROM local_symbol " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT id, name FROM local_symbol " + query + ";");
|
||||
|
||||
std::vector<StorageLocalSymbol> localSymbols;
|
||||
|
||||
@@ -902,8 +834,7 @@ namespace sourcetrail
|
||||
std::vector<StorageSourceLocation> DatabaseStorage::doGetAll<StorageSourceLocation>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, file_node_id, start_line, start_column, end_line, end_column, type FROM source_location " + query + ";"
|
||||
);
|
||||
"SELECT id, file_node_id, start_line, start_column, end_line, end_column, type FROM source_location " + query + ";");
|
||||
|
||||
std::vector<StorageSourceLocation> sourceLocations;
|
||||
|
||||
@@ -917,10 +848,11 @@ namespace sourcetrail
|
||||
const int endColNumber = q.getIntField(5, -1);
|
||||
const int locationKind = q.getIntField(6, -1);
|
||||
|
||||
if (id != 0 && fileNodeId != 0 && startLineNumber != -1 && startColNumber != -1 && endLineNumber != -1 &&
|
||||
endColNumber != -1 && locationKind != -1)
|
||||
if (id != 0 && fileNodeId != 0 && startLineNumber != -1 && startColNumber != -1 && endLineNumber != -1 && endColNumber != -1 &&
|
||||
locationKind != -1)
|
||||
{
|
||||
sourceLocations.emplace_back(StorageSourceLocation(id, fileNodeId, startLineNumber, startColNumber, endLineNumber, endColNumber, locationKind));
|
||||
sourceLocations.emplace_back(
|
||||
StorageSourceLocation(id, fileNodeId, startLineNumber, startColNumber, endLineNumber, endColNumber, locationKind));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
@@ -931,9 +863,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageOccurrence> DatabaseStorage::doGetAll<StorageOccurrence>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT element_id, source_location_id FROM occurrence " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT element_id, source_location_id FROM occurrence " + query + ";");
|
||||
|
||||
std::vector<StorageOccurrence> occurrences;
|
||||
|
||||
@@ -955,9 +885,7 @@ namespace sourcetrail
|
||||
template <>
|
||||
std::vector<StorageError> DatabaseStorage::doGetAll<StorageError>(const std::string& query) const
|
||||
{
|
||||
CppSQLite3Query q = executeQuery(
|
||||
"SELECT id, message, fatal, indexed, translation_unit FROM error " + query + ";"
|
||||
);
|
||||
CppSQLite3Query q = executeQuery("SELECT id, message, fatal, indexed, translation_unit FROM error " + query + ";");
|
||||
|
||||
std::vector<StorageError> errors;
|
||||
while (!q.eof())
|
||||
@@ -979,4 +907,4 @@ namespace sourcetrail
|
||||
return errors;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -37,4 +37,4 @@ namespace sourcetrail
|
||||
|
||||
return DefinitionKind::EXPLICIT;
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -38,8 +38,7 @@ namespace sourcetrail
|
||||
EdgeKind::TEMPLATE_SPECIALIZATION,
|
||||
EdgeKind::INCLUDE,
|
||||
EdgeKind::IMPORT,
|
||||
EdgeKind::MACRO_USAGE
|
||||
};
|
||||
EdgeKind::MACRO_USAGE};
|
||||
|
||||
for (EdgeKind kind: kinds)
|
||||
{
|
||||
@@ -51,4 +50,4 @@ namespace sourcetrail
|
||||
|
||||
return EdgeKind::UNKNOWN;
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -27,9 +27,7 @@ namespace sourcetrail
|
||||
|
||||
ElementComponentKind intToElementComponentKind(int i)
|
||||
{
|
||||
const ElementComponentKind kinds[] = {
|
||||
ElementComponentKind::IS_AMBIGUOUS
|
||||
};
|
||||
const ElementComponentKind kinds[] = {ElementComponentKind::IS_AMBIGUOUS};
|
||||
|
||||
for (ElementComponentKind kind: kinds)
|
||||
{
|
||||
@@ -41,4 +39,4 @@ namespace sourcetrail
|
||||
|
||||
throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to element component kind.");
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace sourcetrail
|
||||
LocationKind::INDEXER_ERROR,
|
||||
LocationKind::FULLTEXT_SEARCH,
|
||||
LocationKind::SCREEN_SEARCH,
|
||||
LocationKind::UNSOLVED
|
||||
};
|
||||
LocationKind::UNSOLVED};
|
||||
|
||||
for (LocationKind kind: kinds)
|
||||
{
|
||||
@@ -50,4 +49,4 @@ namespace sourcetrail
|
||||
|
||||
throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to location kind.");
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -30,12 +30,7 @@ namespace sourcetrail
|
||||
|
||||
for (const NameElement& nameElement: nameHierarchy.nameElements)
|
||||
{
|
||||
j["name_elements"].push_back(
|
||||
{
|
||||
{ "prefix", nameElement.prefix } ,
|
||||
{ "name", nameElement.name } ,
|
||||
{ "postfix", nameElement.postfix }
|
||||
});
|
||||
j["name_elements"].push_back({{"prefix", nameElement.prefix}, {"name", nameElement.name}, {"postfix", nameElement.postfix}});
|
||||
}
|
||||
|
||||
return j.dump(4);
|
||||
@@ -127,4 +122,4 @@ namespace sourcetrail
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -25,8 +25,7 @@ namespace sourcetrail
|
||||
|
||||
NodeKind intToNodeKind(int i)
|
||||
{
|
||||
const NodeKind kinds[] = {
|
||||
NodeKind::UNKNOWN,
|
||||
const NodeKind kinds[] = {NodeKind::UNKNOWN,
|
||||
NodeKind::TYPE,
|
||||
NodeKind::BUILTIN_TYPE,
|
||||
NodeKind::MODULE,
|
||||
@@ -46,8 +45,7 @@ namespace sourcetrail
|
||||
NodeKind::TYPE_PARAMETER,
|
||||
NodeKind::FILE,
|
||||
NodeKind::MACRO,
|
||||
NodeKind::UNION
|
||||
};
|
||||
NodeKind::UNION};
|
||||
|
||||
for (NodeKind kind: kinds)
|
||||
{
|
||||
@@ -59,4 +57,4 @@ namespace sourcetrail
|
||||
|
||||
return NodeKind::UNKNOWN;
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -49,4 +49,4 @@ namespace sourcetrail
|
||||
}
|
||||
return EdgeKind::UNKNOWN;
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -39,14 +39,9 @@ namespace sourcetrail
|
||||
{
|
||||
// --- Public Interface ---
|
||||
|
||||
SourcetrailDBWriter::SourcetrailDBWriter()
|
||||
: m_lastError("")
|
||||
{
|
||||
}
|
||||
SourcetrailDBWriter::SourcetrailDBWriter(): m_lastError("") {}
|
||||
|
||||
SourcetrailDBWriter::~SourcetrailDBWriter()
|
||||
{
|
||||
}
|
||||
SourcetrailDBWriter::~SourcetrailDBWriter() {}
|
||||
|
||||
std::string SourcetrailDBWriter::getVersionString() const
|
||||
{
|
||||
@@ -623,8 +618,7 @@ namespace sourcetrail
|
||||
sourceRange.startColumn,
|
||||
sourceRange.endLine,
|
||||
sourceRange.endColumn,
|
||||
locationKindToInt(LocationKind::ATOMIC_RANGE)
|
||||
));
|
||||
locationKindToInt(LocationKind::ATOMIC_RANGE)));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -713,8 +707,7 @@ namespace sourcetrail
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
|
||||
"<config>\n"
|
||||
" <version>0</version>\n"
|
||||
"</config>\n"
|
||||
);
|
||||
"</config>\n");
|
||||
fileStream.close();
|
||||
}
|
||||
catch (...)
|
||||
@@ -766,10 +759,8 @@ namespace sourcetrail
|
||||
{
|
||||
currentNameHierarchy.nameElements.push_back(nameHierarchy.nameElements[i]);
|
||||
|
||||
int nodeId = m_storage->addNode(StorageNodeData(
|
||||
nodeKindToInt(NodeKind::UNKNOWN),
|
||||
serializeNameHierarchyToDatabaseString(currentNameHierarchy)
|
||||
));
|
||||
int nodeId = m_storage->addNode(
|
||||
StorageNodeData(nodeKindToInt(NodeKind::UNKNOWN), serializeNameHierarchyToDatabaseString(currentNameHierarchy)));
|
||||
|
||||
if (parentNodeId != 0)
|
||||
{
|
||||
@@ -818,26 +809,13 @@ namespace sourcetrail
|
||||
void SourcetrailDBWriter::addSourceLocation(int elementId, const SourceRange& location, LocationKind kind)
|
||||
{
|
||||
const int sourceLocationId = m_storage->addSourceLocation(StorageSourceLocationData(
|
||||
location.fileId,
|
||||
location.startLine,
|
||||
location.startColumn,
|
||||
location.endLine,
|
||||
location.endColumn,
|
||||
locationKindToInt(kind)
|
||||
));
|
||||
location.fileId, location.startLine, location.startColumn, location.endLine, location.endColumn, locationKindToInt(kind)));
|
||||
|
||||
m_storage->addOccurrence(StorageOccurrence(
|
||||
elementId,
|
||||
sourceLocationId
|
||||
));
|
||||
m_storage->addOccurrence(StorageOccurrence(elementId, sourceLocationId));
|
||||
}
|
||||
|
||||
void SourcetrailDBWriter::addElementComponent(int elementId, ElementComponentKind kind, const std::string& data)
|
||||
{
|
||||
const int sourceLocationId = m_storage->addElementComponent(StorageElementComponentData(
|
||||
elementId,
|
||||
elementComponentKindToInt(kind),
|
||||
data
|
||||
));
|
||||
}
|
||||
const int sourceLocationId = m_storage->addElementComponent(StorageElementComponentData(elementId, elementComponentKindToInt(kind), data));
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -65,4 +65,4 @@ namespace sourcetrail
|
||||
}
|
||||
return NodeKind::UNKNOWN;
|
||||
}
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -66,5 +66,5 @@ namespace sourcetrail
|
||||
{
|
||||
return std::count(s.begin(), s.end(), '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace utility
|
||||
} // namespace sourcetrail
|
||||
|
||||
Reference in New Issue
Block a user