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
|
||||
+114
-114
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_DATABASE_STORAGE_H
|
||||
#define SOURCETRAIL_DATABASE_STORAGE_H
|
||||
@@ -35,112 +35,112 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Class wrapping the write and update interface of the Sourcetrail database.
|
||||
*
|
||||
* The DatabaseStorage provides the interface for writing and updating the Sourcetrail database. This interface only
|
||||
* knows about basic data types, more elaborate types like enums, structs and classes need to be converted to basic
|
||||
* types before using this interface.
|
||||
*/
|
||||
class DatabaseStorage
|
||||
/**
|
||||
* Class wrapping the write and update interface of the Sourcetrail database.
|
||||
*
|
||||
* The DatabaseStorage provides the interface for writing and updating the Sourcetrail database. This interface only
|
||||
* knows about basic data types, more elaborate types like enums, structs and classes need to be converted to basic
|
||||
* types before using this interface.
|
||||
*/
|
||||
class DatabaseStorage
|
||||
{
|
||||
public:
|
||||
static int getSupportedDatabaseVersion();
|
||||
static std::unique_ptr<DatabaseStorage> openDatabase(const std::string& dbFilePath);
|
||||
~DatabaseStorage();
|
||||
|
||||
void setupDatabase();
|
||||
void clearDatabase();
|
||||
|
||||
void setProjectSettingsText(const std::string& text);
|
||||
|
||||
bool isEmpty() const;
|
||||
bool isCompatible() const;
|
||||
int getLoadedDatabaseVersion() const;
|
||||
void beginTransaction();
|
||||
void commitTransaction();
|
||||
void rollbackTransaction();
|
||||
void optimizeDatabaseMemory();
|
||||
|
||||
int addElementComponent(const StorageElementComponentData& storageElementComponentData);
|
||||
int addNode(const StorageNodeData& storageNodeData);
|
||||
void addSymbol(const StorageSymbol& storageSymbol);
|
||||
void addFile(const StorageFile& storageFile);
|
||||
int addEdge(const StorageEdgeData& storageEdgeData);
|
||||
int addLocalSymbol(const StorageLocalSymbolData& storageLocalSymbolData);
|
||||
int addSourceLocation(const StorageSourceLocationData& storageSourceLocationData);
|
||||
void addOccurrence(const StorageOccurrence& storageOccurrence);
|
||||
int addError(const StorageErrorData& storageErrorData);
|
||||
|
||||
void setNodeType(int nodeId, int nodeKind);
|
||||
void setFileLanguage(int fileId, const std::string& languageIdentifier);
|
||||
|
||||
template <typename ResultType>
|
||||
std::vector<ResultType> getAll() const
|
||||
{
|
||||
public:
|
||||
static int getSupportedDatabaseVersion();
|
||||
static std::unique_ptr<DatabaseStorage> openDatabase(const std::string& dbFilePath);
|
||||
~DatabaseStorage();
|
||||
return doGetAll<ResultType>("");
|
||||
}
|
||||
|
||||
void setupDatabase();
|
||||
void clearDatabase();
|
||||
private:
|
||||
DatabaseStorage() = default;
|
||||
|
||||
void setProjectSettingsText(const std::string& text);
|
||||
void setupTables();
|
||||
void clearTables();
|
||||
void setupIndices();
|
||||
void setupPrecompiledStatements();
|
||||
void clearPrecompiledStatements();
|
||||
|
||||
bool isEmpty() const;
|
||||
bool isCompatible() const;
|
||||
int getLoadedDatabaseVersion() const;
|
||||
void beginTransaction();
|
||||
void commitTransaction();
|
||||
void rollbackTransaction();
|
||||
void optimizeDatabaseMemory();
|
||||
int insertElement();
|
||||
void insertOrUpdateMetaValue(const std::string& key, const std::string& value);
|
||||
CppSQLite3Statement compileStatement(const std::string& statement) const;
|
||||
void executeStatement(const std::string& statement) const;
|
||||
void executeStatement(CppSQLite3Statement& statement) const;
|
||||
CppSQLite3Query executeQuery(const std::string& query) const;
|
||||
CppSQLite3Query executeQuery(CppSQLite3Statement& statement) const;
|
||||
|
||||
int addElementComponent(const StorageElementComponentData& storageElementComponentData);
|
||||
int addNode(const StorageNodeData& storageNodeData);
|
||||
void addSymbol(const StorageSymbol& storageSymbol);
|
||||
void addFile(const StorageFile& storageFile);
|
||||
int addEdge(const StorageEdgeData& storageEdgeData);
|
||||
int addLocalSymbol(const StorageLocalSymbolData& storageLocalSymbolData);
|
||||
int addSourceLocation(const StorageSourceLocationData& storageSourceLocationData);
|
||||
void addOccurrence(const StorageOccurrence& storageOccurrence);
|
||||
int addError(const StorageErrorData& storageErrorData);
|
||||
template <typename ResultType>
|
||||
std::vector<ResultType> doGetAll(const std::string& query) const;
|
||||
|
||||
void setNodeType(int nodeId, int nodeKind);
|
||||
void setFileLanguage(int fileId, const std::string& languageIdentifier);
|
||||
mutable CppSQLite3DB m_database;
|
||||
|
||||
template <typename ResultType>
|
||||
std::vector<ResultType> getAll() const
|
||||
{
|
||||
return doGetAll<ResultType>("");
|
||||
}
|
||||
CppSQLite3Statement m_insertElementStatement;
|
||||
CppSQLite3Statement m_insertElementComponentStatement;
|
||||
CppSQLite3Statement m_findNodeStatement;
|
||||
CppSQLite3Statement m_insertNodeStatement;
|
||||
CppSQLite3Statement m_setNodeTypeStmt;
|
||||
CppSQLite3Statement m_insertSymbolStatement;
|
||||
CppSQLite3Statement m_findFileStatement;
|
||||
CppSQLite3Statement m_insertFileStatement;
|
||||
CppSQLite3Statement m_setFileLanguageStmt;
|
||||
CppSQLite3Statement m_insertFileContentStatement;
|
||||
CppSQLite3Statement m_findEdgeStatement;
|
||||
CppSQLite3Statement m_insertEdgeStatement;
|
||||
CppSQLite3Statement m_findLocalSymbolStmt;
|
||||
CppSQLite3Statement m_insertLocalSymbolStmt;
|
||||
CppSQLite3Statement m_findSourceLocationStmt;
|
||||
CppSQLite3Statement m_insertSourceLocationStmt;
|
||||
CppSQLite3Statement m_insertOccurenceStmt;
|
||||
CppSQLite3Statement m_findErrorStatement;
|
||||
CppSQLite3Statement m_insertErrorStatement;
|
||||
CppSQLite3Statement m_insertOrUpdateMetaValueStmt;
|
||||
};
|
||||
|
||||
private:
|
||||
DatabaseStorage() = default;
|
||||
template <>
|
||||
std::vector<StorageEdge> DatabaseStorage::doGetAll<StorageEdge>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageNode> DatabaseStorage::doGetAll<StorageNode>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageSymbol> DatabaseStorage::doGetAll<StorageSymbol>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageFile> DatabaseStorage::doGetAll<StorageFile>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageLocalSymbol> DatabaseStorage::doGetAll<StorageLocalSymbol>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageSourceLocation> DatabaseStorage::doGetAll<StorageSourceLocation>(const std::string& query) const;
|
||||
template <>
|
||||
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
|
||||
|
||||
void setupTables();
|
||||
void clearTables();
|
||||
void setupIndices();
|
||||
void setupPrecompiledStatements();
|
||||
void clearPrecompiledStatements();
|
||||
|
||||
int insertElement();
|
||||
void insertOrUpdateMetaValue(const std::string& key, const std::string& value);
|
||||
CppSQLite3Statement compileStatement(const std::string& statement) const;
|
||||
void executeStatement(const std::string& statement) const;
|
||||
void executeStatement(CppSQLite3Statement& statement) const;
|
||||
CppSQLite3Query executeQuery(const std::string& query) const;
|
||||
CppSQLite3Query executeQuery(CppSQLite3Statement& statement) const;
|
||||
|
||||
template <typename ResultType>
|
||||
std::vector<ResultType> doGetAll(const std::string& query) const;
|
||||
|
||||
mutable CppSQLite3DB m_database;
|
||||
|
||||
CppSQLite3Statement m_insertElementStatement;
|
||||
CppSQLite3Statement m_insertElementComponentStatement;
|
||||
CppSQLite3Statement m_findNodeStatement;
|
||||
CppSQLite3Statement m_insertNodeStatement;
|
||||
CppSQLite3Statement m_setNodeTypeStmt;
|
||||
CppSQLite3Statement m_insertSymbolStatement;
|
||||
CppSQLite3Statement m_findFileStatement;
|
||||
CppSQLite3Statement m_insertFileStatement;
|
||||
CppSQLite3Statement m_setFileLanguageStmt;
|
||||
CppSQLite3Statement m_insertFileContentStatement;
|
||||
CppSQLite3Statement m_findEdgeStatement;
|
||||
CppSQLite3Statement m_insertEdgeStatement;
|
||||
CppSQLite3Statement m_findLocalSymbolStmt;
|
||||
CppSQLite3Statement m_insertLocalSymbolStmt;
|
||||
CppSQLite3Statement m_findSourceLocationStmt;
|
||||
CppSQLite3Statement m_insertSourceLocationStmt;
|
||||
CppSQLite3Statement m_insertOccurenceStmt;
|
||||
CppSQLite3Statement m_findErrorStatement;
|
||||
CppSQLite3Statement m_insertErrorStatement;
|
||||
CppSQLite3Statement m_insertOrUpdateMetaValueStmt;
|
||||
};
|
||||
|
||||
template <>
|
||||
std::vector<StorageEdge> DatabaseStorage::doGetAll<StorageEdge>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageNode> DatabaseStorage::doGetAll<StorageNode>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageSymbol> DatabaseStorage::doGetAll<StorageSymbol>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageFile> DatabaseStorage::doGetAll<StorageFile>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageLocalSymbol> DatabaseStorage::doGetAll<StorageLocalSymbol>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageSourceLocation> DatabaseStorage::doGetAll<StorageSourceLocation>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageOccurrence> DatabaseStorage::doGetAll<StorageOccurrence>(const std::string& query) const;
|
||||
template <>
|
||||
std::vector<StorageError> DatabaseStorage::doGetAll<StorageError>(const std::string& query) const;
|
||||
}
|
||||
|
||||
#endif // SOURCETRAIL_DATABASE_STORAGE_H
|
||||
#endif // SOURCETRAIL_DATABASE_STORAGE_H
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_DEFINITION_KIND_H
|
||||
#define SOURCETRAIL_DEFINITION_KIND_H
|
||||
|
||||
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".
|
||||
*/
|
||||
enum class DefinitionKind : int
|
||||
{
|
||||
IMPLICIT = 1,
|
||||
EXPLICIT = 2
|
||||
};
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
enum class DefinitionKind : int
|
||||
{
|
||||
IMPLICIT = 1,
|
||||
EXPLICIT = 2
|
||||
};
|
||||
|
||||
int definitionKindToInt(DefinitionKind kind);
|
||||
DefinitionKind intToDefinitionKind(int i);
|
||||
}
|
||||
int definitionKindToInt(DefinitionKind kind);
|
||||
DefinitionKind intToDefinitionKind(int i);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_DEFINITION_KIND_H
|
||||
#endif // SOURCETRAIL_DEFINITION_KIND_H
|
||||
|
||||
+43
-43
@@ -1,52 +1,52 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_EDGE_KIND_H
|
||||
#define SOURCETRAIL_EDGE_KIND_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Enum providing all possible values for kinds of edges that can be stored to the Sourcetrail database.
|
||||
*
|
||||
* The DatabaseStorage provides the interface for writing and updating the Sourcetrail database. This interface only
|
||||
* The EdgeKind enum should only be used internally and contains a complete list of values that may be written to
|
||||
* the Sourcetrail database file. This enum contains kinds for edges that can be recorded explicitly, but also kinds
|
||||
* 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 class EdgeKind : int
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MEMBER = 1 << 0,
|
||||
TYPE_USAGE = 1 << 1,
|
||||
USAGE = 1 << 2,
|
||||
CALL = 1 << 3,
|
||||
INHERITANCE = 1 << 4,
|
||||
OVERRIDE = 1 << 5,
|
||||
TYPE_ARGUMENT = 1 << 6,
|
||||
TEMPLATE_SPECIALIZATION = 1 << 7,
|
||||
INCLUDE = 1 << 8,
|
||||
IMPORT = 1 << 9,
|
||||
MACRO_USAGE = 1 << 11, // needs new db version if decremented
|
||||
ANNOTATION_USAGE = 1 << 12
|
||||
};
|
||||
/**
|
||||
* Enum providing all possible values for kinds of edges that can be stored to the Sourcetrail database.
|
||||
*
|
||||
* The DatabaseStorage provides the interface for writing and updating the Sourcetrail database. This interface only
|
||||
* The EdgeKind enum should only be used internally and contains a complete list of values that may be written to
|
||||
* the Sourcetrail database file. This enum contains kinds for edges that can be recorded explicitly, but also kinds
|
||||
* 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 class EdgeKind : int
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MEMBER = 1 << 0,
|
||||
TYPE_USAGE = 1 << 1,
|
||||
USAGE = 1 << 2,
|
||||
CALL = 1 << 3,
|
||||
INHERITANCE = 1 << 4,
|
||||
OVERRIDE = 1 << 5,
|
||||
TYPE_ARGUMENT = 1 << 6,
|
||||
TEMPLATE_SPECIALIZATION = 1 << 7,
|
||||
INCLUDE = 1 << 8,
|
||||
IMPORT = 1 << 9,
|
||||
MACRO_USAGE = 1 << 11, // needs new db version if decremented
|
||||
ANNOTATION_USAGE = 1 << 12
|
||||
};
|
||||
|
||||
int edgeKindToInt(EdgeKind kind);
|
||||
EdgeKind intToEdgeKind(int i);
|
||||
}
|
||||
int edgeKindToInt(EdgeKind kind);
|
||||
EdgeKind intToEdgeKind(int i);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_EDGE_KIND_H
|
||||
#endif // SOURCETRAIL_EDGE_KIND_H
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_ELEMENT_COMPONENT_KIND_H
|
||||
#define SOURCETRAIL_ELEMENT_COMPONENT_KIND_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Enum providing all possible values for kinds of node and edge components that can be stored to the Sourcetrail database.
|
||||
*/
|
||||
enum class ElementComponentKind : int
|
||||
{
|
||||
IS_AMBIGUOUS = 1 << 0
|
||||
};
|
||||
/**
|
||||
* Enum providing all possible values for kinds of node and edge components that can be stored to the Sourcetrail database.
|
||||
*/
|
||||
enum class ElementComponentKind : int
|
||||
{
|
||||
IS_AMBIGUOUS = 1 << 0
|
||||
};
|
||||
|
||||
int elementComponentKindToInt(ElementComponentKind kind);
|
||||
ElementComponentKind intToElementComponentKind(int i);
|
||||
}
|
||||
int elementComponentKindToInt(ElementComponentKind kind);
|
||||
ElementComponentKind intToElementComponentKind(int i);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_ELEMENT_COMPONENT_KIND_H
|
||||
#endif // SOURCETRAIL_ELEMENT_COMPONENT_KIND_H
|
||||
|
||||
+34
-34
@@ -1,43 +1,43 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_LOCATION_KIND_H
|
||||
#define SOURCETRAIL_LOCATION_KIND_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Enum providing all possible values for kinds of locations that can be stored to the Sourcetrail database.
|
||||
*/
|
||||
enum class LocationKind : int
|
||||
{
|
||||
TOKEN = 0,
|
||||
SCOPE = 1,
|
||||
QUALIFIER = 2,
|
||||
LOCAL_SYMBOL = 3,
|
||||
SIGNATURE = 4,
|
||||
ATOMIC_RANGE = 5,
|
||||
INDEXER_ERROR = 6,
|
||||
FULLTEXT_SEARCH = 7,
|
||||
SCREEN_SEARCH = 8,
|
||||
UNSOLVED = 9
|
||||
};
|
||||
/**
|
||||
* Enum providing all possible values for kinds of locations that can be stored to the Sourcetrail database.
|
||||
*/
|
||||
enum class LocationKind : int
|
||||
{
|
||||
TOKEN = 0,
|
||||
SCOPE = 1,
|
||||
QUALIFIER = 2,
|
||||
LOCAL_SYMBOL = 3,
|
||||
SIGNATURE = 4,
|
||||
ATOMIC_RANGE = 5,
|
||||
INDEXER_ERROR = 6,
|
||||
FULLTEXT_SEARCH = 7,
|
||||
SCREEN_SEARCH = 8,
|
||||
UNSOLVED = 9
|
||||
};
|
||||
|
||||
int locationKindToInt(LocationKind kind);
|
||||
LocationKind intToLocationKind(int i);
|
||||
}
|
||||
int locationKindToInt(LocationKind kind);
|
||||
LocationKind intToLocationKind(int i);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_LOCATION_KIND_H
|
||||
#endif // SOURCETRAIL_LOCATION_KIND_H
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_NAME_HIERARCHY_H
|
||||
#define SOURCETRAIL_NAME_HIERARCHY_H
|
||||
@@ -22,77 +22,77 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Struct that represents a single hierarchical element that is part of a symbol's name.
|
||||
*
|
||||
* prefix: optional prefix used for unique identification and shown in tooltips
|
||||
* name: name represented by this element
|
||||
* postfix: optional prefix used for unique identification and shown in tooltips
|
||||
*/
|
||||
struct NameElement
|
||||
{
|
||||
std::string prefix;
|
||||
std::string name;
|
||||
std::string postfix;
|
||||
};
|
||||
/**
|
||||
* Struct that represents a single hierarchical element that is part of a symbol's name.
|
||||
*
|
||||
* prefix: optional prefix used for unique identification and shown in tooltips
|
||||
* name: name represented by this element
|
||||
* postfix: optional prefix used for unique identification and shown in tooltips
|
||||
*/
|
||||
struct NameElement
|
||||
{
|
||||
std::string prefix;
|
||||
std::string name;
|
||||
std::string postfix;
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct that represents an entire name of a symbol.
|
||||
*
|
||||
* nameDelimiter: delimiter added between name elements
|
||||
* nameElements: all name elements that make up the hierarchy
|
||||
*/
|
||||
struct NameHierarchy
|
||||
{
|
||||
std::string nameDelimiter;
|
||||
std::vector<NameElement> nameElements;
|
||||
};
|
||||
/**
|
||||
* Struct that represents an entire name of a symbol.
|
||||
*
|
||||
* nameDelimiter: delimiter added between name elements
|
||||
* nameElements: all name elements that make up the hierarchy
|
||||
*/
|
||||
struct NameHierarchy
|
||||
{
|
||||
std::string nameDelimiter;
|
||||
std::vector<NameElement> nameElements;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a NameHierarchy to a JSON string
|
||||
*
|
||||
* param: nameHierarchy - the name hierarchy to convert to JSON string
|
||||
*
|
||||
* return: a JSON object of the form:
|
||||
* {
|
||||
* "name_delimiter" : "."
|
||||
* "name_elements" : [
|
||||
* {
|
||||
* "prefix" : "",
|
||||
* "name" : "",
|
||||
* "postfix" : ""
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
std::string serializeNameHierarchyToJson(const NameHierarchy& nameHierarchy);
|
||||
/**
|
||||
* Converts a NameHierarchy to a JSON string
|
||||
*
|
||||
* param: nameHierarchy - the name hierarchy to convert to JSON string
|
||||
*
|
||||
* return: a JSON object of the form:
|
||||
* {
|
||||
* "name_delimiter" : "."
|
||||
* "name_elements" : [
|
||||
* {
|
||||
* "prefix" : "",
|
||||
* "name" : "",
|
||||
* "postfix" : ""
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
std::string serializeNameHierarchyToJson(const NameHierarchy& nameHierarchy);
|
||||
|
||||
/**
|
||||
* Converts a JSON string to a NameHierarchy
|
||||
*
|
||||
* param: serializedNameHierarchy - JSON object string of the form:
|
||||
* {
|
||||
* "name_delimiter" : "."
|
||||
* "name_elements" : [
|
||||
* {
|
||||
* "prefix" : "",
|
||||
* "name" : "",
|
||||
* "postfix" : ""
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
* }
|
||||
* param: error - optional pointer to a string, where an error message will be set
|
||||
*
|
||||
* return: NameHierarchy object. Empty on failure.
|
||||
*/
|
||||
NameHierarchy deserializeNameHierarchyFromJson(const std::string& serializedNameHierarchy, std::string* error = nullptr);
|
||||
/**
|
||||
* Converts a JSON string to a NameHierarchy
|
||||
*
|
||||
* param: serializedNameHierarchy - JSON object string of the form:
|
||||
* {
|
||||
* "name_delimiter" : "."
|
||||
* "name_elements" : [
|
||||
* {
|
||||
* "prefix" : "",
|
||||
* "name" : "",
|
||||
* "postfix" : ""
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
* }
|
||||
* param: error - optional pointer to a string, where an error message will be set
|
||||
*
|
||||
* return: NameHierarchy object. Empty on failure.
|
||||
*/
|
||||
NameHierarchy deserializeNameHierarchyFromJson(const std::string& serializedNameHierarchy, std::string* error = nullptr);
|
||||
|
||||
/**
|
||||
* INTERNAL: Converts a NameHierarchy to a string in Sourcetrail database format
|
||||
*/
|
||||
std::string serializeNameHierarchyToDatabaseString(const NameHierarchy& nameHierarchy);
|
||||
}
|
||||
/**
|
||||
* INTERNAL: Converts a NameHierarchy to a string in Sourcetrail database format
|
||||
*/
|
||||
std::string serializeNameHierarchyToDatabaseString(const NameHierarchy& nameHierarchy);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_NAME_HIERARCHY_H
|
||||
#endif // SOURCETRAIL_NAME_HIERARCHY_H
|
||||
|
||||
+45
-45
@@ -1,54 +1,54 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_NODE_KIND_H
|
||||
#define SOURCETRAIL_NODE_KIND_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Enum providing all possible values for kinds of nodes that can be stored to the Sourcetrail database.
|
||||
*/
|
||||
enum class NodeKind : int
|
||||
{
|
||||
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,
|
||||
TYPE_PARAMETER = 1 << 17,
|
||||
FILE = 1 << 18,
|
||||
MACRO = 1 << 19,
|
||||
UNION = 1 << 20
|
||||
};
|
||||
/**
|
||||
* Enum providing all possible values for kinds of nodes that can be stored to the Sourcetrail database.
|
||||
*/
|
||||
enum class NodeKind : int
|
||||
{
|
||||
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,
|
||||
TYPE_PARAMETER = 1 << 17,
|
||||
FILE = 1 << 18,
|
||||
MACRO = 1 << 19,
|
||||
UNION = 1 << 20
|
||||
};
|
||||
|
||||
int nodeKindToInt(NodeKind kind);
|
||||
NodeKind intToNodeKind(int i);
|
||||
}
|
||||
int nodeKindToInt(NodeKind kind);
|
||||
NodeKind intToNodeKind(int i);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_NODE_KIND_H
|
||||
#endif // SOURCETRAIL_NODE_KIND_H
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_REFERENCE_KIND_H
|
||||
#define SOURCETRAIL_REFERENCE_KIND_H
|
||||
@@ -21,25 +21,25 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Enum providing all possible values for kinds of references that can be recorded using the SourcetrailDBWriter interface.
|
||||
*/
|
||||
enum class ReferenceKind
|
||||
{
|
||||
TYPE_USAGE,
|
||||
USAGE,
|
||||
CALL,
|
||||
INHERITANCE,
|
||||
OVERRIDE,
|
||||
TYPE_ARGUMENT,
|
||||
TEMPLATE_SPECIALIZATION,
|
||||
INCLUDE,
|
||||
IMPORT,
|
||||
MACRO_USAGE,
|
||||
ANNOTATION_USAGE
|
||||
};
|
||||
/**
|
||||
* Enum providing all possible values for kinds of references that can be recorded using the SourcetrailDBWriter interface.
|
||||
*/
|
||||
enum class ReferenceKind
|
||||
{
|
||||
TYPE_USAGE,
|
||||
USAGE,
|
||||
CALL,
|
||||
INHERITANCE,
|
||||
OVERRIDE,
|
||||
TYPE_ARGUMENT,
|
||||
TEMPLATE_SPECIALIZATION,
|
||||
INCLUDE,
|
||||
IMPORT,
|
||||
MACRO_USAGE,
|
||||
ANNOTATION_USAGE
|
||||
};
|
||||
|
||||
EdgeKind referenceKindToEdgeKind(ReferenceKind kind);
|
||||
}
|
||||
EdgeKind referenceKindToEdgeKind(ReferenceKind kind);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_REFERENCE_KIND_H
|
||||
#endif // SOURCETRAIL_REFERENCE_KIND_H
|
||||
|
||||
+30
-30
@@ -1,38 +1,38 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_SOURCE_RANGE_H
|
||||
#define SOURCETRAIL_SOURCE_RANGE_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Struct that represents the location of a range of characters in a source file.
|
||||
*
|
||||
* note: Line and column numbers start at 1 instead of 0!
|
||||
* note: The SourceRange includes both, the start and the end column number.
|
||||
*/
|
||||
struct SourceRange
|
||||
{
|
||||
int fileId;
|
||||
int startLine;
|
||||
int startColumn;
|
||||
int endLine;
|
||||
int endColumn;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Struct that represents the location of a range of characters in a source file.
|
||||
*
|
||||
* note: Line and column numbers start at 1 instead of 0!
|
||||
* note: The SourceRange includes both, the start and the end column number.
|
||||
*/
|
||||
struct SourceRange
|
||||
{
|
||||
int fileId;
|
||||
int startLine;
|
||||
int startColumn;
|
||||
int endLine;
|
||||
int endColumn;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SOURCE_RANGE_H
|
||||
#endif // SOURCETRAIL_SOURCE_RANGE_H
|
||||
|
||||
+466
-466
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_SRCTRLDB_WRITER_H
|
||||
#define SOURCETRAIL_SRCTRLDB_WRITER_H
|
||||
@@ -31,494 +31,494 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
class DatabaseStorage;
|
||||
class DatabaseStorage;
|
||||
|
||||
/**
|
||||
* SourcetrailDBWriter
|
||||
*
|
||||
* This class is the main interface for writing data to a Sourcetrail project database.
|
||||
* It be used to manage a Sourcetrail database file and to write information to it.
|
||||
*
|
||||
* The following code snippet illustrates a very basic usage of the SourcetrailDBWriter class:
|
||||
*
|
||||
* sourcetrail::SourcetrailDBWriter writer;
|
||||
* writer.open("MyProject.srctrldb");
|
||||
* writer.recordSymbol({ "::",{ { "void", "foo", "()" } } });
|
||||
* writer.close();
|
||||
*/
|
||||
class SourcetrailDBWriter
|
||||
{
|
||||
public:
|
||||
SourcetrailDBWriter();
|
||||
~SourcetrailDBWriter();
|
||||
|
||||
/**
|
||||
* SourcetrailDBWriter
|
||||
* Provides the version of the SourcetrailDB Core as string with format "vXX.dbYY.pZZ"
|
||||
*
|
||||
* This class is the main interface for writing data to a Sourcetrail project database.
|
||||
* It be used to manage a Sourcetrail database file and to write information to it.
|
||||
* - XX: interface version. This version increases on every change that breaks backwards
|
||||
* compatibility.
|
||||
* - YY: Sourcetrail database version. This version needs to match the database version
|
||||
* of the used Sourcetrail instance. You can find the database version of Sourcetrail
|
||||
* in its About dialog.
|
||||
* - ZZ: patch number of the build. It will increase with every release that publishes
|
||||
* bugfixes and features that don't break any compatibility.
|
||||
*
|
||||
* The following code snippet illustrates a very basic usage of the SourcetrailDBWriter class:
|
||||
*
|
||||
* sourcetrail::SourcetrailDBWriter writer;
|
||||
* writer.open("MyProject.srctrldb");
|
||||
* writer.recordSymbol({ "::",{ { "void", "foo", "()" } } });
|
||||
* writer.close();
|
||||
* return: version string
|
||||
*/
|
||||
class SourcetrailDBWriter
|
||||
{
|
||||
public:
|
||||
SourcetrailDBWriter();
|
||||
~SourcetrailDBWriter();
|
||||
std::string getVersionString() const;
|
||||
|
||||
/**
|
||||
* Provides the version of the SourcetrailDB Core as string with format "vXX.dbYY.pZZ"
|
||||
*
|
||||
* - XX: interface version. This version increases on every change that breaks backwards
|
||||
* compatibility.
|
||||
* - YY: Sourcetrail database version. This version needs to match the database version
|
||||
* of the used Sourcetrail instance. You can find the database version of Sourcetrail
|
||||
* in its About dialog.
|
||||
* - ZZ: patch number of the build. It will increase with every release that publishes
|
||||
* bugfixes and features that don't break any compatibility.
|
||||
*
|
||||
* return: version string
|
||||
*/
|
||||
std::string getVersionString() const;
|
||||
/**
|
||||
* Provides the supported database version as integer
|
||||
*
|
||||
* return: supported database version
|
||||
*
|
||||
* see: getVersionString() for details
|
||||
*/
|
||||
int getSupportedDatabaseVersion() const;
|
||||
|
||||
/**
|
||||
* Provides the supported database version as integer
|
||||
*
|
||||
* return: supported database version
|
||||
*
|
||||
* see: getVersionString() for details
|
||||
*/
|
||||
int getSupportedDatabaseVersion() const;
|
||||
/**
|
||||
* Provides the last error that occurred while using the SourcetrailDBWriter
|
||||
*
|
||||
* The last error is empty if no error occurred since instantiation of the class or since the
|
||||
* error has last been cleared.
|
||||
*
|
||||
* return: error message of last error that occured
|
||||
*
|
||||
* see: clearLastError()
|
||||
*/
|
||||
const std::string& getLastError() const;
|
||||
|
||||
/**
|
||||
* Provides the last error that occurred while using the SourcetrailDBWriter
|
||||
*
|
||||
* The last error is empty if no error occurred since instantiation of the class or since the
|
||||
* error has last been cleared.
|
||||
*
|
||||
* return: error message of last error that occured
|
||||
*
|
||||
* see: clearLastError()
|
||||
*/
|
||||
const std::string& getLastError() const;
|
||||
/**
|
||||
* Modifies the stored error message
|
||||
*
|
||||
* param: error - the new error message
|
||||
*
|
||||
* see: getLastError()
|
||||
*/
|
||||
void setLastError(const std::string& error) const;
|
||||
|
||||
/**
|
||||
* Modifies the stored error message
|
||||
*
|
||||
* param: error - the new error message
|
||||
*
|
||||
* see: getLastError()
|
||||
*/
|
||||
void setLastError(const std::string& error) const;
|
||||
/**
|
||||
* Clears the stored error message
|
||||
*
|
||||
* see: getLastError()
|
||||
*/
|
||||
void clearLastError();
|
||||
|
||||
/**
|
||||
* Clears the stored error message
|
||||
*
|
||||
* see: getLastError()
|
||||
*/
|
||||
void clearLastError();
|
||||
/**
|
||||
* Opens a Sourcetrail database
|
||||
*
|
||||
* Call this method to open a Sourcetrail database file. If the database does not have any
|
||||
* related .srctrlprj project file, a minimal project file will be created that allows for
|
||||
* opening the database with Sourcetrail.
|
||||
*
|
||||
* param: databaseFilePath - absolute file path of the database file, including file extension
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool open(const std::string& databaseFilePath);
|
||||
|
||||
/**
|
||||
* Opens a Sourcetrail database
|
||||
*
|
||||
* Call this method to open a Sourcetrail database file. If the database does not have any
|
||||
* related .srctrlprj project file, a minimal project file will be created that allows for
|
||||
* opening the database with Sourcetrail.
|
||||
*
|
||||
* param: databaseFilePath - absolute file path of the database file, including file extension
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool open(const std::string& databaseFilePath);
|
||||
/**
|
||||
* Closes the currently open Sourcetrail database
|
||||
*
|
||||
* return: Returns true if the operation was successful. Otherwise false is returned and getLastError()
|
||||
* can be checked for more detailed information.
|
||||
*
|
||||
* see: open(const std::string& databaseFilePath)
|
||||
*/
|
||||
bool close();
|
||||
|
||||
/**
|
||||
* Closes the currently open Sourcetrail database
|
||||
*
|
||||
* return: Returns true if the operation was successful. Otherwise false is returned and getLastError()
|
||||
* can be checked for more detailed information.
|
||||
*
|
||||
* see: open(const std::string& databaseFilePath)
|
||||
*/
|
||||
bool close();
|
||||
/**
|
||||
* Clears the currently open Sourcetrail database
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: open(const std::string& databaseFilePath)
|
||||
*/
|
||||
bool clear();
|
||||
|
||||
/**
|
||||
* Clears the currently open Sourcetrail database
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: open(const std::string& databaseFilePath)
|
||||
*/
|
||||
bool clear();
|
||||
/**
|
||||
* Checks if the currently open database file contains any data
|
||||
*
|
||||
* return: true after opening a non-existing database file or clearing the open database
|
||||
*/
|
||||
bool isEmpty() const;
|
||||
|
||||
/**
|
||||
* Checks if the currently open database file contains any data
|
||||
*
|
||||
* return: true after opening a non-existing database file or clearing the open database
|
||||
*/
|
||||
bool isEmpty() const;
|
||||
/**
|
||||
* Checks if the currently open database is compatible with the SourcetrailDBWriter version.
|
||||
*
|
||||
* return: true for an empty database or a database that has been created with the same
|
||||
* database version.
|
||||
*
|
||||
* see: getSupportedDatabaseVersion()
|
||||
* see: getLoadedDatabaseVersion()
|
||||
*/
|
||||
bool isCompatible() const;
|
||||
|
||||
/**
|
||||
* Checks if the currently open database is compatible with the SourcetrailDBWriter version.
|
||||
*
|
||||
* return: true for an empty database or a database that has been created with the same
|
||||
* database version.
|
||||
*
|
||||
* see: getSupportedDatabaseVersion()
|
||||
* see: getLoadedDatabaseVersion()
|
||||
*/
|
||||
bool isCompatible() const;
|
||||
/**
|
||||
* Provides the database version of the loaded database file as an integer
|
||||
*
|
||||
* return: database version of loaded database
|
||||
*/
|
||||
int getLoadedDatabaseVersion() const;
|
||||
|
||||
/**
|
||||
* Provides the database version of the loaded database file as an integer
|
||||
*
|
||||
* return: database version of loaded database
|
||||
*/
|
||||
int getLoadedDatabaseVersion() const;
|
||||
/**
|
||||
* Starts a database transaction on the currently open database
|
||||
*
|
||||
* Apart from allowing to restore the database to the state it was in before this method has
|
||||
* been called, wrapping multiple calls that record data with one transaction significantly
|
||||
* increases the performance of these database operations.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: commitTransaction()
|
||||
* see: rollbackTransaction()
|
||||
*/
|
||||
bool beginTransaction();
|
||||
|
||||
/**
|
||||
* Starts a database transaction on the currently open database
|
||||
*
|
||||
* Apart from allowing to restore the database to the state it was in before this method has
|
||||
* been called, wrapping multiple calls that record data with one transaction significantly
|
||||
* increases the performance of these database operations.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: commitTransaction()
|
||||
* see: rollbackTransaction()
|
||||
*/
|
||||
bool beginTransaction();
|
||||
/**
|
||||
* Ends the current transaction and writes all of its changes persistently to the database
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool commitTransaction();
|
||||
|
||||
/**
|
||||
* Ends the current transaction and writes all of its changes persistently to the database
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool commitTransaction();
|
||||
/**
|
||||
* Reverts the database to the state it was in before the current transaction was started
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool rollbackTransaction();
|
||||
|
||||
/**
|
||||
* Reverts the database to the state it was in before the current transaction was started
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool rollbackTransaction();
|
||||
/**
|
||||
* Reduces the on disk memory consumption of the open database to a minimum
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool optimizeDatabaseMemory();
|
||||
|
||||
/**
|
||||
* Reduces the on disk memory consumption of the open database to a minimum
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool optimizeDatabaseMemory();
|
||||
/**
|
||||
* Stores a symbol to the database
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail
|
||||
* database will always return the same id.
|
||||
*
|
||||
* param: nameHierarchy - the name of the symbol to store.
|
||||
*
|
||||
* return: symbolId - integer id of the stored symbol. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*
|
||||
* see: NameHierarchy
|
||||
*/
|
||||
int recordSymbol(const NameHierarchy& nameHierarchy);
|
||||
|
||||
/**
|
||||
* Stores a symbol to the database
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail
|
||||
* database will always return the same id.
|
||||
*
|
||||
* param: nameHierarchy - the name of the symbol to store.
|
||||
*
|
||||
* return: symbolId - integer id of the stored symbol. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*
|
||||
* see: NameHierarchy
|
||||
*/
|
||||
int recordSymbol(const NameHierarchy& nameHierarchy);
|
||||
/**
|
||||
* Stores a definition kind for a specific symbol to the database
|
||||
*
|
||||
* Calling this method allows to store a DefinitionKind (e.g. explicitly defined, implicitly
|
||||
* defined) for a symbol referenced by id to the database. Calling this method with the same
|
||||
* symbolId multiple times overwrites the symbol's previously recorded DefinitionKind. If no
|
||||
* DefinitionKind is recorded for a symbol, Sourcetrail treats this symbol as "non-indexed".
|
||||
* This may be desired while recording a reference to a symbol with a definition that is located
|
||||
* outside of the indexed source files.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a DefinitionKind shall be recorded.
|
||||
* param: definitionKind - the DefinitionKind that shall be recorded for the respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: DefinitionKind
|
||||
*/
|
||||
bool recordSymbolDefinitionKind(int symbolId, DefinitionKind definitionKind);
|
||||
|
||||
/**
|
||||
* Stores a definition kind for a specific symbol to the database
|
||||
*
|
||||
* Calling this method allows to store a DefinitionKind (e.g. explicitly defined, implicitly
|
||||
* defined) for a symbol referenced by id to the database. Calling this method with the same
|
||||
* symbolId multiple times overwrites the symbol's previously recorded DefinitionKind. If no
|
||||
* DefinitionKind is recorded for a symbol, Sourcetrail treats this symbol as "non-indexed".
|
||||
* This may be desired while recording a reference to a symbol with a definition that is located
|
||||
* outside of the indexed source files.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a DefinitionKind shall be recorded.
|
||||
* param: definitionKind - the DefinitionKind that shall be recorded for the respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: DefinitionKind
|
||||
*/
|
||||
bool recordSymbolDefinitionKind(int symbolId, DefinitionKind definitionKind);
|
||||
/**
|
||||
* Stores a symbol kind for a specific symbol to the database
|
||||
*
|
||||
* Calling this method allows to store a SymbolKind (e.g. "class", "function", etc.) for a
|
||||
* symbol referenced by id to the database. Calling this method with the same symbolId multiple
|
||||
* times overwrites the symbol's previously recorded SymbolKind. If no SymbolKind is recorded
|
||||
* for a symbol, Sourcetrail displays the type of this symbol as "symbol".
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a SymbolKind shall be recorded.
|
||||
* param: symbolKind - the SymbolKind that shall be recorded for the respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SymbolKind
|
||||
*/
|
||||
bool recordSymbolKind(int symbolId, SymbolKind symbolKind);
|
||||
|
||||
/**
|
||||
* Stores a symbol kind for a specific symbol to the database
|
||||
*
|
||||
* Calling this method allows to store a SymbolKind (e.g. "class", "function", etc.) for a
|
||||
* symbol referenced by id to the database. Calling this method with the same symbolId multiple
|
||||
* times overwrites the symbol's previously recorded SymbolKind. If no SymbolKind is recorded
|
||||
* for a symbol, Sourcetrail displays the type of this symbol as "symbol".
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a SymbolKind shall be recorded.
|
||||
* param: symbolKind - the SymbolKind that shall be recorded for the respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SymbolKind
|
||||
*/
|
||||
bool recordSymbolKind(int symbolId, SymbolKind symbolKind);
|
||||
/**
|
||||
* Stores a location for a specific symbol to the database
|
||||
*
|
||||
* This method allows to store a location for a symbol referenced by id to the database.
|
||||
* Calling this method with the same symbolId multiple times adds multiple locations for the
|
||||
* respective symbol. The stored location will be clickable and displayable. When clicked
|
||||
* Sourcetrail will activate the symbol with the specified id. When the symbol with the specified
|
||||
* id is activated, this location will be displayed and highlighted by Sourcetrail.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordSymbolLocation(int symbolId, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a location for a specific symbol to the database
|
||||
*
|
||||
* This method allows to store a location for a symbol referenced by id to the database.
|
||||
* Calling this method with the same symbolId multiple times adds multiple locations for the
|
||||
* respective symbol. The stored location will be clickable and displayable. When clicked
|
||||
* Sourcetrail will activate the symbol with the specified id. When the symbol with the specified
|
||||
* id is activated, this location will be displayed and highlighted by Sourcetrail.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordSymbolLocation(int symbolId, const SourceRange& location);
|
||||
/**
|
||||
* Stores a scope location for a specific symbol to the database
|
||||
*
|
||||
* This method allows to store a scope location for a symbol referenced by id to the database.
|
||||
* Calling this method with the same symbolId multiple times adds multiple scope locations for the
|
||||
* respective symbol. The stored location will only be displayable and not clickable. When the
|
||||
* symbol with the specified id is activated, this location will be fully displayed but not
|
||||
* highlighted by Sourcetrail.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a scope location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as scope location for the respective
|
||||
* symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordSymbolScopeLocation(int symbolId, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a scope location for a specific symbol to the database
|
||||
*
|
||||
* This method allows to store a scope location for a symbol referenced by id to the database.
|
||||
* Calling this method with the same symbolId multiple times adds multiple scope locations for the
|
||||
* respective symbol. The stored location will only be displayable and not clickable. When the
|
||||
* symbol with the specified id is activated, this location will be fully displayed but not
|
||||
* highlighted by Sourcetrail.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a scope location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as scope location for the respective
|
||||
* symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordSymbolScopeLocation(int symbolId, const SourceRange& location);
|
||||
/**
|
||||
* Stores a signature location for a specific symbol to the database
|
||||
*
|
||||
* This method allows to store a signature location for a symbol referenced by id to the
|
||||
* database. If a signature location is recorded for a symbol, Sourcetrail will display the
|
||||
* respective source code in a tooltip whenever the symbol with the referenced id or any of
|
||||
* that symbol's locations gets hovered.
|
||||
* If no signature location is recorded for a symbol, Sourcetrail will show its name hierarchy.
|
||||
*
|
||||
* note: Calling this method with the same symbolId multiple times adds multiple signature
|
||||
* locations for the respective symbol. It is not guaranteed which one will be used, so it is
|
||||
* advised to call it only once per symbol.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a signature location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as signature location for the
|
||||
* respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordSymbolSignatureLocation(int symbolId, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a signature location for a specific symbol to the database
|
||||
*
|
||||
* This method allows to store a signature location for a symbol referenced by id to the
|
||||
* database. If a signature location is recorded for a symbol, Sourcetrail will display the
|
||||
* respective source code in a tooltip whenever the symbol with the referenced id or any of
|
||||
* that symbol's locations gets hovered.
|
||||
* If no signature location is recorded for a symbol, Sourcetrail will show its name hierarchy.
|
||||
*
|
||||
* note: Calling this method with the same symbolId multiple times adds multiple signature
|
||||
* locations for the respective symbol. It is not guaranteed which one will be used, so it is
|
||||
* advised to call it only once per symbol.
|
||||
*
|
||||
* param: symbolId - the id of the symbol for which a signature location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as signature location for the
|
||||
* respective symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordSymbolSignatureLocation(int symbolId, const SourceRange& location);
|
||||
/**
|
||||
* Stores a reference between two symbols to the database
|
||||
*
|
||||
* This method allows to store the information of symbols referencing one another to the database.
|
||||
* For each recorded reference Sourcetrail's graph view will display an edge that originates at
|
||||
* the reference's recorded context symbol and points to the recorded referenced symbol. The
|
||||
* recorded ReferenceKind is used to determine the type of the displayed edge and to generate a
|
||||
* description in the hover tooltip of the edge.
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail database
|
||||
* will always return the same id.
|
||||
*
|
||||
* param: contextSymbolId - the id of the source of the recorded reference edge
|
||||
* param: referencedSymbolId - the id of the target of the recorded reference edge
|
||||
* param: referenceKind - kind of the recorded reference edge
|
||||
*
|
||||
* return: referenceId - integer id of the stored reference. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*
|
||||
* see: ReferenceKind
|
||||
*/
|
||||
int recordReference(int contextSymbolId, int referencedSymbolId, ReferenceKind referenceKind);
|
||||
|
||||
/**
|
||||
* Stores a reference between two symbols to the database
|
||||
*
|
||||
* This method allows to store the information of symbols referencing one another to the database.
|
||||
* For each recorded reference Sourcetrail's graph view will display an edge that originates at
|
||||
* the reference's recorded context symbol and points to the recorded referenced symbol. The
|
||||
* recorded ReferenceKind is used to determine the type of the displayed edge and to generate a
|
||||
* description in the hover tooltip of the edge.
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail database
|
||||
* will always return the same id.
|
||||
*
|
||||
* param: contextSymbolId - the id of the source of the recorded reference edge
|
||||
* param: referencedSymbolId - the id of the target of the recorded reference edge
|
||||
* param: referenceKind - kind of the recorded reference edge
|
||||
*
|
||||
* return: referenceId - integer id of the stored reference. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*
|
||||
* see: ReferenceKind
|
||||
*/
|
||||
int recordReference(int contextSymbolId, int referencedSymbolId, ReferenceKind referenceKind);
|
||||
/**
|
||||
* Stores a location for a specific reference to the database
|
||||
*
|
||||
* This method allows to store a location for a reference to the database.
|
||||
* Calling this method with the same referenceId multiple times adds multiple locations for the
|
||||
* respective reference. The stored location will be clickable and displayable. When the reference
|
||||
* location is clicked Sourcetrail will activate the symbol referenced by the respective reference.
|
||||
* When the reference with the specified id is activated, this location will be displayed and
|
||||
* highlighted by Sourcetrail.
|
||||
*
|
||||
* param: referenceId - the id of the reference for which a location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective
|
||||
* reference.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordReferenceLocation(int referenceId, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a location for a specific reference to the database
|
||||
*
|
||||
* This method allows to store a location for a reference to the database.
|
||||
* Calling this method with the same referenceId multiple times adds multiple locations for the
|
||||
* respective reference. The stored location will be clickable and displayable. When the reference
|
||||
* location is clicked Sourcetrail will activate the symbol referenced by the respective reference.
|
||||
* When the reference with the specified id is activated, this location will be displayed and
|
||||
* highlighted by Sourcetrail.
|
||||
*
|
||||
* param: referenceId - the id of the reference for which a location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective
|
||||
* reference.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordReferenceLocation(int referenceId, const SourceRange& location);
|
||||
/**
|
||||
* Marks a reference that is stored in the database as "ambiguous"
|
||||
*
|
||||
* This method allows to additional information for a reference to the database. Sourcetrail will
|
||||
* display an "ambiguous" reference with a special style to emphasize that the existance of the
|
||||
* reference is questionable. This method is intended to be called in situations when an indexed
|
||||
* token may have meanings, all of which shall be recorded.
|
||||
*
|
||||
* param: referenceId - the id of the reference that shall be marked as ambiguous.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool recordReferenceIsAmbiguous(int referenceId);
|
||||
|
||||
/**
|
||||
* Marks a reference that is stored in the database as "ambiguous"
|
||||
*
|
||||
* This method allows to additional information for a reference to the database. Sourcetrail will
|
||||
* display an "ambiguous" reference with a special style to emphasize that the existance of the
|
||||
* reference is questionable. This method is intended to be called in situations when an indexed
|
||||
* token may have meanings, all of which shall be recorded.
|
||||
*
|
||||
* param: referenceId - the id of the reference that shall be marked as ambiguous.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool recordReferenceIsAmbiguous(int referenceId);
|
||||
/**
|
||||
* Stores a location between a specific context and an "unsolved" symbol to the database
|
||||
*
|
||||
* This method allows to store all available information to the database in the case that a symbol
|
||||
* is referenced in a certain context but the referenced symbol could not be resolved to a concrete
|
||||
* name. For each reference recorded by this method, Sourcetrail's graph view will display an edge
|
||||
* that originates at the recorded context symbol and points to a node called "unsolved symbol".
|
||||
* Furthermore Sourcetrail's code view will use a different highlight when the provided source range
|
||||
* gets hovered.
|
||||
*
|
||||
* param: contextSymbolId - the id of the source of the recorded reference edge
|
||||
* param: referenceKind - kind of the recorded reference edge
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective
|
||||
* reference.
|
||||
*
|
||||
* return: referenceId - integer id of the stored reference. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
int recordReferenceToUnsolvedSymhol(int contextSymbolId, ReferenceKind referenceKind, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a location between a specific context and an "unsolved" symbol to the database
|
||||
*
|
||||
* This method allows to store all available information to the database in the case that a symbol
|
||||
* is referenced in a certain context but the referenced symbol could not be resolved to a concrete
|
||||
* name. For each reference recorded by this method, Sourcetrail's graph view will display an edge
|
||||
* that originates at the recorded context symbol and points to a node called "unsolved symbol".
|
||||
* Furthermore Sourcetrail's code view will use a different highlight when the provided source range
|
||||
* gets hovered.
|
||||
*
|
||||
* param: contextSymbolId - the id of the source of the recorded reference edge
|
||||
* param: referenceKind - kind of the recorded reference edge
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective
|
||||
* reference.
|
||||
*
|
||||
* return: referenceId - integer id of the stored reference. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
int recordReferenceToUnsolvedSymhol(int contextSymbolId, ReferenceKind referenceKind, const SourceRange& location);
|
||||
/**
|
||||
* Stores a location for the usage of a symbol's name as qualifier to the database
|
||||
*
|
||||
* This method allows to store a location where a specific symbol is used as a qualifier to the
|
||||
* database. Calling this method with the same referencedSymbolId multiple times adds multiple locations
|
||||
* for the respective reference. The stored location will be clickable but not displayable: When the
|
||||
* reference location is clicked Sourcetrail will activate the symbol referenced by the respective
|
||||
* reference. When the symbol with the specified id is activated, this location will NOT be displayed and
|
||||
* highlighted by Sourcetrail.
|
||||
*
|
||||
* param: referencedSymbolId - the id of the symbol that is used as qualifier at the current location.
|
||||
* param: location - the SourceRange that shall be recorded as location for the symbol's occurrence as
|
||||
* qualifier
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordQualifierLocation(int referencedSymbolId, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a location for the usage of a symbol's name as qualifier to the database
|
||||
*
|
||||
* This method allows to store a location where a specific symbol is used as a qualifier to the
|
||||
* database. Calling this method with the same referencedSymbolId multiple times adds multiple locations
|
||||
* for the respective reference. The stored location will be clickable but not displayable: When the
|
||||
* reference location is clicked Sourcetrail will activate the symbol referenced by the respective
|
||||
* reference. When the symbol with the specified id is activated, this location will NOT be displayed and
|
||||
* highlighted by Sourcetrail.
|
||||
*
|
||||
* param: referencedSymbolId - the id of the symbol that is used as qualifier at the current location.
|
||||
* param: location - the SourceRange that shall be recorded as location for the symbol's occurrence as
|
||||
* qualifier
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordQualifierLocation(int referencedSymbolId, const SourceRange& location);
|
||||
/**
|
||||
* Stores a file to the database
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail database
|
||||
* will always return the same id.
|
||||
*
|
||||
* param: filePath - the absolute path to the file to store.
|
||||
*
|
||||
* return: fileId - integer id of the stored file. 0 on failure. getLastError() provides the
|
||||
* error message.
|
||||
*/
|
||||
int recordFile(const std::string& filePath);
|
||||
|
||||
/**
|
||||
* Stores a file to the database
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail database
|
||||
* will always return the same id.
|
||||
*
|
||||
* param: filePath - the absolute path to the file to store.
|
||||
*
|
||||
* return: fileId - integer id of the stored file. 0 on failure. getLastError() provides the
|
||||
* error message.
|
||||
*/
|
||||
int recordFile(const std::string& filePath);
|
||||
/**
|
||||
* Stores language information for a specific file to the database
|
||||
*
|
||||
* This method allows to store language information for a file to the database. Language information
|
||||
* is passed and stored as string (e.g. "cpp", "java", etc.) and allows Sourcetrail to pick the
|
||||
* correct syntax highlighting rules when displaying the respective source file.
|
||||
*
|
||||
* param: fileId - the id of the file for which language information shall be recorded.
|
||||
* param: languageIdentifier - a string that denotes the programming language the respective file
|
||||
* is written in.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool recordFileLanguage(int fileId, const std::string& languageIdentifier);
|
||||
|
||||
/**
|
||||
* Stores language information for a specific file to the database
|
||||
*
|
||||
* This method allows to store language information for a file to the database. Language information
|
||||
* is passed and stored as string (e.g. "cpp", "java", etc.) and allows Sourcetrail to pick the
|
||||
* correct syntax highlighting rules when displaying the respective source file.
|
||||
*
|
||||
* param: fileId - the id of the file for which language information shall be recorded.
|
||||
* param: languageIdentifier - a string that denotes the programming language the respective file
|
||||
* is written in.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*/
|
||||
bool recordFileLanguage(int fileId, const std::string& languageIdentifier);
|
||||
/**
|
||||
* Stores a local symbol to the database
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail database
|
||||
* will always return the same id.
|
||||
*
|
||||
* param: name - a name that is unique for this local symbol (e.g. the string encoded location
|
||||
* of the local symbol's definition).
|
||||
*
|
||||
* return: localSymbolId - integer id of the stored local symbol. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*/
|
||||
int recordLocalSymbol(const std::string& name);
|
||||
|
||||
/**
|
||||
* Stores a local symbol to the database
|
||||
*
|
||||
* note: Calling this method multiple times with the same input on the same Sourcetrail database
|
||||
* will always return the same id.
|
||||
*
|
||||
* param: name - a name that is unique for this local symbol (e.g. the string encoded location
|
||||
* of the local symbol's definition).
|
||||
*
|
||||
* return: localSymbolId - integer id of the stored local symbol. 0 on failure. getLastError()
|
||||
* provides the error message.
|
||||
*/
|
||||
int recordLocalSymbol(const std::string& name);
|
||||
/**
|
||||
* Stores a location for a specific local symbol to the database
|
||||
*
|
||||
* This method allows to store a location for a local symbol symbol referenced by id to the database.
|
||||
* Calling this method with the same symbolId multiple times adds multiple locations for the
|
||||
* respective local symbol. The stored location will be clickable and displayable. When clicked
|
||||
* Sourcetrail will activate this and all other local symbol locations that share the same local
|
||||
* symbol id.
|
||||
*
|
||||
* param: localSymbolId - the id of the local symbol for which a location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective
|
||||
* local symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordLocalSymbolLocation(int localSymbolId, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores a location for a specific local symbol to the database
|
||||
*
|
||||
* This method allows to store a location for a local symbol symbol referenced by id to the database.
|
||||
* Calling this method with the same symbolId multiple times adds multiple locations for the
|
||||
* respective local symbol. The stored location will be clickable and displayable. When clicked
|
||||
* Sourcetrail will activate this and all other local symbol locations that share the same local
|
||||
* symbol id.
|
||||
*
|
||||
* param: localSymbolId - the id of the local symbol for which a location shall be recorded.
|
||||
* param: location - the SourceRange that shall be recorded as location for the respective
|
||||
* local symbol.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordLocalSymbolLocation(int localSymbolId, const SourceRange& location);
|
||||
/**
|
||||
* Stores an atomic SourceRange to the database
|
||||
*
|
||||
* This method allows to store an atomic SourceRange to the database. These ranges will
|
||||
* be used by Sourcetrail to prevent the code view from displaying only a part of the range. Thus,
|
||||
* if any line that lies within one of the project's atomic ranges is dispayed, the remaining
|
||||
* lines will be displayed as well. This may be useful for dealing with multi-line comments or
|
||||
* multi-line strings.
|
||||
*
|
||||
* param: sourceRange - the SourceRange to record.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordAtomicSourceRange(const SourceRange& sourceRange);
|
||||
|
||||
/**
|
||||
* Stores an atomic SourceRange to the database
|
||||
*
|
||||
* This method allows to store an atomic SourceRange to the database. These ranges will
|
||||
* be used by Sourcetrail to prevent the code view from displaying only a part of the range. Thus,
|
||||
* if any line that lies within one of the project's atomic ranges is dispayed, the remaining
|
||||
* lines will be displayed as well. This may be useful for dealing with multi-line comments or
|
||||
* multi-line strings.
|
||||
*
|
||||
* param: sourceRange - the SourceRange to record.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordAtomicSourceRange(const SourceRange& sourceRange);
|
||||
/**
|
||||
* Stores an indexing error to the database
|
||||
*
|
||||
* This method allows to store an indexing error to the database. Errors will be shown by
|
||||
* Sourcetrail's error view. When clicking the error in Sourcetrail's error list, the code view
|
||||
* will display this location.
|
||||
*
|
||||
* param: message - an error message that will be displayed in Sourcetrail's error list.
|
||||
* param: fatal - boolean fatal indicates whether parsing/indexing was aborted at this point.
|
||||
* param: location - the SourceRange of the error encountered.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordError(const std::string& message, bool fatal, const SourceRange& location);
|
||||
|
||||
/**
|
||||
* Stores an indexing error to the database
|
||||
*
|
||||
* This method allows to store an indexing error to the database. Errors will be shown by
|
||||
* Sourcetrail's error view. When clicking the error in Sourcetrail's error list, the code view
|
||||
* will display this location.
|
||||
*
|
||||
* param: message - an error message that will be displayed in Sourcetrail's error list.
|
||||
* param: fatal - boolean fatal indicates whether parsing/indexing was aborted at this point.
|
||||
* param: location - the SourceRange of the error encountered.
|
||||
*
|
||||
* return: true if successful. false on failure. getLastError() provides the error message.
|
||||
*
|
||||
* see: SourceRange
|
||||
*/
|
||||
bool recordError(const std::string& message, bool fatal, const SourceRange& location);
|
||||
private:
|
||||
void openDatabase();
|
||||
void closeDatabase();
|
||||
void setupDatabaseTables();
|
||||
void clearDatabaseTables();
|
||||
void createOrResetProjectFile();
|
||||
void updateProjectSettingsText();
|
||||
int addNodeHierarchy(const NameHierarchy& nameHierarchy);
|
||||
int addFile(const std::string& filePath);
|
||||
int addEdge(int sourceId, int targetId, EdgeKind edgeKind);
|
||||
void addSourceLocation(int elementId, const SourceRange& location, LocationKind kind);
|
||||
void addElementComponent(int elementId, ElementComponentKind kind, const std::string& data);
|
||||
|
||||
private:
|
||||
void openDatabase();
|
||||
void closeDatabase();
|
||||
void setupDatabaseTables();
|
||||
void clearDatabaseTables();
|
||||
void createOrResetProjectFile();
|
||||
void updateProjectSettingsText();
|
||||
int addNodeHierarchy(const NameHierarchy& nameHierarchy);
|
||||
int addFile(const std::string& filePath);
|
||||
int addEdge(int sourceId, int targetId, EdgeKind edgeKind);
|
||||
void addSourceLocation(int elementId, const SourceRange& location, LocationKind kind);
|
||||
void addElementComponent(int elementId, ElementComponentKind kind, const std::string& data);
|
||||
std::string m_projectFilePath;
|
||||
std::string m_databaseFilePath;
|
||||
std::unique_ptr<DatabaseStorage> m_storage;
|
||||
mutable std::string m_lastError;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
std::string m_projectFilePath;
|
||||
std::string m_databaseFilePath;
|
||||
std::unique_ptr<DatabaseStorage> m_storage;
|
||||
mutable std::string m_lastError;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SOURCETRAIL_SRCTRLDB_WRITER_H
|
||||
#endif // SOURCETRAIL_SRCTRLDB_WRITER_H
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_SOURCETRAIL_EXCEPTION_H
|
||||
#define SOURCETRAIL_SOURCETRAIL_EXCEPTION_H
|
||||
@@ -21,19 +21,22 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Exception type that is thrown by the SourcetrailDBWriter API.
|
||||
*/
|
||||
class SourcetrailException
|
||||
/**
|
||||
* Exception type that is thrown by the SourcetrailDBWriter API.
|
||||
*/
|
||||
class SourcetrailException
|
||||
{
|
||||
public:
|
||||
SourcetrailException(std::string message): m_message(message) {}
|
||||
virtual ~SourcetrailException() = default;
|
||||
std::string getMessage() const
|
||||
{
|
||||
public:
|
||||
SourcetrailException(std::string message) : m_message(message) {}
|
||||
virtual ~SourcetrailException() = default;
|
||||
std::string getMessage() const { return m_message; }
|
||||
return m_message;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_message;
|
||||
};
|
||||
}
|
||||
private:
|
||||
std::string m_message;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SOURCETRAIL_EXCEPTION_H
|
||||
#endif // SOURCETRAIL_SOURCETRAIL_EXCEPTION_H
|
||||
|
||||
+34
-48
@@ -1,62 +1,48 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_EDGE_H
|
||||
#define SOURCETRAIL_STORAGE_EDGE_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageEdgeData
|
||||
struct StorageEdgeData
|
||||
{
|
||||
StorageEdgeData(): sourceNodeId(0), targetNodeId(0), edgeKind(0) {}
|
||||
|
||||
StorageEdgeData(int sourceNodeId, int targetNodeId, int edgeKind)
|
||||
: sourceNodeId(sourceNodeId), targetNodeId(targetNodeId), edgeKind(edgeKind)
|
||||
{
|
||||
StorageEdgeData()
|
||||
: sourceNodeId(0)
|
||||
, targetNodeId(0)
|
||||
, edgeKind(0)
|
||||
{}
|
||||
}
|
||||
|
||||
StorageEdgeData(int sourceNodeId, int targetNodeId, int edgeKind)
|
||||
: sourceNodeId(sourceNodeId)
|
||||
, targetNodeId(targetNodeId)
|
||||
, edgeKind(edgeKind)
|
||||
{}
|
||||
int sourceNodeId;
|
||||
int targetNodeId;
|
||||
int edgeKind;
|
||||
};
|
||||
|
||||
int sourceNodeId;
|
||||
int targetNodeId;
|
||||
int edgeKind;
|
||||
};
|
||||
struct StorageEdge: public StorageEdgeData
|
||||
{
|
||||
StorageEdge(): StorageEdgeData(), id(0) {}
|
||||
|
||||
struct StorageEdge : public StorageEdgeData
|
||||
{
|
||||
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
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_EDGE_H
|
||||
#endif // SOURCETRAIL_STORAGE_EDGE_H
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_ELEMENT_COMPONENT_H
|
||||
#define SOURCETRAIL_STORAGE_ELEMENT_COMPONENT_H
|
||||
@@ -21,44 +21,33 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageElementComponentData
|
||||
struct StorageElementComponentData
|
||||
{
|
||||
StorageElementComponentData(): elementId(0), componentKind(0), data("") {}
|
||||
|
||||
StorageElementComponentData(int elementId, int componentKind, std::string data)
|
||||
: elementId(elementId), componentKind(componentKind), data(std::move(data))
|
||||
{
|
||||
StorageElementComponentData()
|
||||
: elementId(0)
|
||||
, componentKind(0)
|
||||
, data("")
|
||||
{}
|
||||
}
|
||||
|
||||
StorageElementComponentData(int elementId, int componentKind, std::string data)
|
||||
: elementId(elementId)
|
||||
, componentKind(componentKind)
|
||||
, data(std::move(data))
|
||||
{}
|
||||
int elementId;
|
||||
int componentKind;
|
||||
std::string data;
|
||||
};
|
||||
|
||||
int elementId;
|
||||
int componentKind;
|
||||
std::string data;
|
||||
};
|
||||
struct StorageElementComponent: public StorageElementComponentData
|
||||
{
|
||||
StorageElementComponent(): StorageElementComponentData(), id(0) {}
|
||||
|
||||
struct StorageElementComponent : public StorageElementComponentData
|
||||
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)
|
||||
{
|
||||
StorageElementComponent()
|
||||
: StorageElementComponentData()
|
||||
, id(0)
|
||||
{}
|
||||
}
|
||||
|
||||
StorageElementComponent(int id, const StorageElementComponentData& data)
|
||||
: StorageElementComponentData(data)
|
||||
, id(id)
|
||||
{}
|
||||
int id;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
StorageElementComponent(int id, int elementId, int componentKind, std::string data)
|
||||
: StorageElementComponentData(elementId, componentKind, data)
|
||||
, id(id)
|
||||
{}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_ELEMENT_COMPONENT_H
|
||||
#endif // SOURCETRAIL_STORAGE_ELEMENT_COMPONENT_H
|
||||
|
||||
+37
-67
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_ERROR_H
|
||||
#define SOURCETRAIL_STORAGE_ERROR_H
|
||||
@@ -21,64 +21,34 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageErrorData
|
||||
struct StorageErrorData
|
||||
{
|
||||
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()
|
||||
: message("")
|
||||
, translationUnit("")
|
||||
, fatal(0)
|
||||
, indexed(0)
|
||||
}
|
||||
|
||||
{}
|
||||
std::string message;
|
||||
std::string translationUnit;
|
||||
bool fatal;
|
||||
bool indexed;
|
||||
};
|
||||
|
||||
StorageErrorData(
|
||||
std::string message,
|
||||
std::string translationUnit,
|
||||
bool fatal,
|
||||
bool indexed
|
||||
)
|
||||
: message(std::move(message))
|
||||
, translationUnit(std::move(translationUnit))
|
||||
, fatal(fatal)
|
||||
, indexed(indexed)
|
||||
{}
|
||||
struct StorageError: public StorageErrorData
|
||||
{
|
||||
StorageError(): StorageErrorData(), id(0) {}
|
||||
|
||||
std::string message;
|
||||
std::string translationUnit;
|
||||
bool fatal;
|
||||
bool indexed;
|
||||
};
|
||||
StorageError(int id, const StorageErrorData& data): StorageErrorData(data), id(id) {}
|
||||
|
||||
struct StorageError : public StorageErrorData
|
||||
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()
|
||||
: StorageErrorData()
|
||||
, id(0)
|
||||
{}
|
||||
}
|
||||
|
||||
StorageError(int id, const StorageErrorData& data)
|
||||
: StorageErrorData(data)
|
||||
, id(id)
|
||||
{}
|
||||
int id;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_ERROR_H
|
||||
#endif // SOURCETRAIL_STORAGE_ERROR_H
|
||||
|
||||
+35
-41
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_FILE_H
|
||||
#define SOURCETRAIL_STORAGE_FILE_H
|
||||
@@ -21,33 +21,27 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageFile
|
||||
struct StorageFile
|
||||
{
|
||||
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)
|
||||
, filePath(std::move(filePath))
|
||||
, languageIdentifier(std::move(languageIdentifier))
|
||||
, modificationTime(std::move(modificationTime))
|
||||
, indexed(indexed)
|
||||
, complete(complete)
|
||||
{
|
||||
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)
|
||||
, filePath(std::move(filePath))
|
||||
, languageIdentifier(std::move(languageIdentifier))
|
||||
, modificationTime(std::move(modificationTime))
|
||||
, indexed(indexed)
|
||||
, complete(complete)
|
||||
{}
|
||||
int id;
|
||||
std::string filePath;
|
||||
std::string languageIdentifier;
|
||||
std::string modificationTime;
|
||||
bool indexed;
|
||||
bool complete;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
int id;
|
||||
std::string filePath;
|
||||
std::string languageIdentifier;
|
||||
std::string modificationTime;
|
||||
bool indexed;
|
||||
bool complete;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_FILE_H
|
||||
#endif // SOURCETRAIL_STORAGE_FILE_H
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_LOCAL_SYMBOL_H
|
||||
#define SOURCETRAIL_STORAGE_LOCAL_SYMBOL_H
|
||||
@@ -21,38 +21,25 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageLocalSymbolData
|
||||
{
|
||||
StorageLocalSymbolData()
|
||||
: name("")
|
||||
{}
|
||||
struct StorageLocalSymbolData
|
||||
{
|
||||
StorageLocalSymbolData(): name("") {}
|
||||
|
||||
StorageLocalSymbolData(std::string name)
|
||||
: name(std::move(name))
|
||||
{}
|
||||
StorageLocalSymbolData(std::string name): name(std::move(name)) {}
|
||||
|
||||
std::string name;
|
||||
};
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct StorageLocalSymbol : public StorageLocalSymbolData
|
||||
{
|
||||
StorageLocalSymbol()
|
||||
: StorageLocalSymbolData()
|
||||
, id(0)
|
||||
{}
|
||||
struct StorageLocalSymbol: public StorageLocalSymbolData
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
int id;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_LOCAL_SYMBOL_H
|
||||
#endif // SOURCETRAIL_STORAGE_LOCAL_SYMBOL_H
|
||||
|
||||
+30
-45
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_NODE_H
|
||||
#define SOURCETRAIL_STORAGE_NODE_H
|
||||
@@ -21,41 +21,26 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageNodeData
|
||||
{
|
||||
StorageNodeData()
|
||||
: nodeKind(0)
|
||||
, serializedName("")
|
||||
{}
|
||||
struct StorageNodeData
|
||||
{
|
||||
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;
|
||||
};
|
||||
int nodeKind;
|
||||
std::string serializedName;
|
||||
};
|
||||
|
||||
struct StorageNode : public StorageNodeData
|
||||
{
|
||||
StorageNode()
|
||||
: StorageNodeData()
|
||||
, id(0)
|
||||
{}
|
||||
struct StorageNode: public StorageNodeData
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
int id;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_NODE_H
|
||||
#endif // SOURCETRAIL_STORAGE_NODE_H
|
||||
|
||||
@@ -1,39 +1,33 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_OCCURRENCE_H
|
||||
#define SOURCETRAIL_STORAGE_OCCURRENCE_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageOccurrence
|
||||
{
|
||||
StorageOccurrence()
|
||||
: elementId(0)
|
||||
, sourceLocationId(0)
|
||||
{}
|
||||
struct StorageOccurrence
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
int elementId;
|
||||
int sourceLocationId;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_OCCURRENCE_H
|
||||
#endif // SOURCETRAIL_STORAGE_OCCURRENCE_H
|
||||
|
||||
@@ -1,71 +1,63 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_SOURCE_LOCATION_H
|
||||
#define SOURCETRAIL_STORAGE_SOURCE_LOCATION_H
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageSourceLocationData
|
||||
struct StorageSourceLocationData
|
||||
{
|
||||
StorageSourceLocationData()
|
||||
: fileNodeId(0), startLineNumber(-1), startColumnNumber(-1), endLineNumber(-1), endColumnNumber(-1), locationKind(0)
|
||||
{
|
||||
StorageSourceLocationData()
|
||||
: 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)
|
||||
, startLineNumber(startLineNumber)
|
||||
, startColumnNumber(startColumnNumber)
|
||||
, endLineNumber(endLineNumber)
|
||||
, endColumnNumber(endColumnNumber)
|
||||
, locationKind(locationKind)
|
||||
{}
|
||||
|
||||
int fileNodeId;
|
||||
int startLineNumber;
|
||||
int startColumnNumber;
|
||||
int endLineNumber;
|
||||
int endColumnNumber;
|
||||
int locationKind;
|
||||
};
|
||||
|
||||
struct StorageSourceLocation : public StorageSourceLocationData
|
||||
StorageSourceLocationData(int fileNodeId, int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber, int locationKind)
|
||||
: fileNodeId(fileNodeId)
|
||||
, startLineNumber(startLineNumber)
|
||||
, startColumnNumber(startColumnNumber)
|
||||
, endLineNumber(endLineNumber)
|
||||
, endColumnNumber(endColumnNumber)
|
||||
, locationKind(locationKind)
|
||||
{
|
||||
StorageSourceLocation()
|
||||
: StorageSourceLocationData()
|
||||
, id(0)
|
||||
{}
|
||||
}
|
||||
|
||||
StorageSourceLocation(int id, const StorageSourceLocationData& data)
|
||||
: StorageSourceLocationData(data)
|
||||
, id(id)
|
||||
{}
|
||||
int fileNodeId;
|
||||
int startLineNumber;
|
||||
int startColumnNumber;
|
||||
int endLineNumber;
|
||||
int endColumnNumber;
|
||||
int locationKind;
|
||||
};
|
||||
|
||||
StorageSourceLocation(int id, int fileNodeId, int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber, int locationKind)
|
||||
: StorageSourceLocationData(fileNodeId, startLineNumber, startColumnNumber, endLineNumber, endColumnNumber, locationKind)
|
||||
, id(id)
|
||||
{}
|
||||
struct StorageSourceLocation: public StorageSourceLocationData
|
||||
{
|
||||
StorageSourceLocation(): StorageSourceLocationData(), id(0) {}
|
||||
|
||||
int id;
|
||||
};
|
||||
}
|
||||
StorageSourceLocation(int id, const StorageSourceLocationData& data): StorageSourceLocationData(data), id(id) {}
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_SOURCE_LOCATION_H
|
||||
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
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_STORAGE_SYMBOL_H
|
||||
#define SOURCETRAIL_STORAGE_SYMBOL_H
|
||||
@@ -21,21 +21,15 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
struct StorageSymbol
|
||||
{
|
||||
StorageSymbol()
|
||||
: id(0)
|
||||
, definitionKind(definitionKindToInt(DefinitionKind::EXPLICIT))
|
||||
{}
|
||||
struct StorageSymbol
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
int id;
|
||||
int definitionKind;
|
||||
};
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_STORAGE_SYMBOL_H
|
||||
#endif // SOURCETRAIL_STORAGE_SYMBOL_H
|
||||
|
||||
+42
-42
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_SYMBOL_KIND_H
|
||||
#define SOURCETRAIL_SYMBOL_KIND_H
|
||||
@@ -21,33 +21,33 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
/**
|
||||
* Enum providing all possible values for kinds of symbols that can be recorded using the SourcetrailDBWriter interface.
|
||||
*/
|
||||
enum class SymbolKind
|
||||
{
|
||||
TYPE,
|
||||
BUILTIN_TYPE,
|
||||
MODULE,
|
||||
NAMESPACE,
|
||||
PACKAGE,
|
||||
STRUCT,
|
||||
CLASS,
|
||||
INTERFACE,
|
||||
ANNOTATION,
|
||||
GLOBAL_VARIABLE,
|
||||
FIELD,
|
||||
FUNCTION,
|
||||
METHOD,
|
||||
ENUM,
|
||||
ENUM_CONSTANT,
|
||||
TYPEDEF,
|
||||
TYPE_PARAMETER,
|
||||
MACRO,
|
||||
UNION
|
||||
};
|
||||
/**
|
||||
* Enum providing all possible values for kinds of symbols that can be recorded using the SourcetrailDBWriter interface.
|
||||
*/
|
||||
enum class SymbolKind
|
||||
{
|
||||
TYPE,
|
||||
BUILTIN_TYPE,
|
||||
MODULE,
|
||||
NAMESPACE,
|
||||
PACKAGE,
|
||||
STRUCT,
|
||||
CLASS,
|
||||
INTERFACE,
|
||||
ANNOTATION,
|
||||
GLOBAL_VARIABLE,
|
||||
FIELD,
|
||||
FUNCTION,
|
||||
METHOD,
|
||||
ENUM,
|
||||
ENUM_CONSTANT,
|
||||
TYPEDEF,
|
||||
TYPE_PARAMETER,
|
||||
MACRO,
|
||||
UNION
|
||||
};
|
||||
|
||||
NodeKind symbolKindToNodeKind(SymbolKind kind);
|
||||
}
|
||||
NodeKind symbolKindToNodeKind(SymbolKind kind);
|
||||
} // namespace sourcetrail
|
||||
|
||||
#endif // SOURCETRAIL_SYMBOL_KIND_H
|
||||
#endif // SOURCETRAIL_SYMBOL_KIND_H
|
||||
|
||||
+23
-23
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETRAIL_UTILITY_H
|
||||
#define SOURCETRAIL_UTILITY_H
|
||||
@@ -22,13 +22,13 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
namespace utility
|
||||
{
|
||||
bool getFileExists(const std::string& filePath);
|
||||
std::string getFileContent(const std::string& filePath);
|
||||
std::string getDateTimeString(const time_t& time);
|
||||
int getLineCount(const std::string s);
|
||||
}
|
||||
}
|
||||
namespace utility
|
||||
{
|
||||
bool getFileExists(const std::string& filePath);
|
||||
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
|
||||
#endif // SOURCETRAIL_UTILITY_H
|
||||
|
||||
+871
-943
File diff suppressed because it is too large
Load Diff
+33
-33
@@ -1,40 +1,40 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "DefinitionKind.h"
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int definitionKindToInt(DefinitionKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
DefinitionKind intToDefinitionKind(int i)
|
||||
{
|
||||
const DefinitionKind kinds[] = { DefinitionKind::IMPLICIT, DefinitionKind::EXPLICIT };
|
||||
|
||||
for (DefinitionKind kind : kinds)
|
||||
{
|
||||
if (i == definitionKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return DefinitionKind::EXPLICIT;
|
||||
}
|
||||
int definitionKindToInt(DefinitionKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
DefinitionKind intToDefinitionKind(int i)
|
||||
{
|
||||
const DefinitionKind kinds[] = {DefinitionKind::IMPLICIT, DefinitionKind::EXPLICIT};
|
||||
|
||||
for (DefinitionKind kind: kinds)
|
||||
{
|
||||
if (i == definitionKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return DefinitionKind::EXPLICIT;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+44
-45
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "EdgeKind.h"
|
||||
|
||||
@@ -20,35 +20,34 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int edgeKindToInt(EdgeKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
EdgeKind intToEdgeKind(int i)
|
||||
{
|
||||
const EdgeKind kinds[] = {
|
||||
EdgeKind::MEMBER,
|
||||
EdgeKind::TYPE_USAGE,
|
||||
EdgeKind::USAGE,
|
||||
EdgeKind::CALL,
|
||||
EdgeKind::INHERITANCE,
|
||||
EdgeKind::OVERRIDE,
|
||||
EdgeKind::TYPE_ARGUMENT,
|
||||
EdgeKind::TEMPLATE_SPECIALIZATION,
|
||||
EdgeKind::INCLUDE,
|
||||
EdgeKind::IMPORT,
|
||||
EdgeKind::MACRO_USAGE
|
||||
};
|
||||
|
||||
for (EdgeKind kind : kinds)
|
||||
{
|
||||
if (i == edgeKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return EdgeKind::UNKNOWN;
|
||||
}
|
||||
int edgeKindToInt(EdgeKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
EdgeKind intToEdgeKind(int i)
|
||||
{
|
||||
const EdgeKind kinds[] = {
|
||||
EdgeKind::MEMBER,
|
||||
EdgeKind::TYPE_USAGE,
|
||||
EdgeKind::USAGE,
|
||||
EdgeKind::CALL,
|
||||
EdgeKind::INHERITANCE,
|
||||
EdgeKind::OVERRIDE,
|
||||
EdgeKind::TYPE_ARGUMENT,
|
||||
EdgeKind::TEMPLATE_SPECIALIZATION,
|
||||
EdgeKind::INCLUDE,
|
||||
EdgeKind::IMPORT,
|
||||
EdgeKind::MACRO_USAGE};
|
||||
|
||||
for (EdgeKind kind: kinds)
|
||||
{
|
||||
if (i == edgeKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return EdgeKind::UNKNOWN;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ElementComponentKind.h"
|
||||
|
||||
@@ -20,25 +20,23 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int elementComponentKindToInt(ElementComponentKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
ElementComponentKind intToElementComponentKind(int i)
|
||||
{
|
||||
const ElementComponentKind kinds[] = {
|
||||
ElementComponentKind::IS_AMBIGUOUS
|
||||
};
|
||||
|
||||
for (ElementComponentKind kind : kinds)
|
||||
{
|
||||
if (i == elementComponentKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to element component kind.");
|
||||
}
|
||||
int elementComponentKindToInt(ElementComponentKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
ElementComponentKind intToElementComponentKind(int i)
|
||||
{
|
||||
const ElementComponentKind kinds[] = {ElementComponentKind::IS_AMBIGUOUS};
|
||||
|
||||
for (ElementComponentKind kind: kinds)
|
||||
{
|
||||
if (i == elementComponentKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to element component kind.");
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+43
-44
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "LocationKind.h"
|
||||
|
||||
@@ -20,34 +20,33 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int locationKindToInt(LocationKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
LocationKind intToLocationKind(int i)
|
||||
{
|
||||
const LocationKind kinds[] = {
|
||||
LocationKind::TOKEN,
|
||||
LocationKind::SCOPE,
|
||||
LocationKind::QUALIFIER,
|
||||
LocationKind::LOCAL_SYMBOL,
|
||||
LocationKind::SIGNATURE,
|
||||
LocationKind::ATOMIC_RANGE,
|
||||
LocationKind::INDEXER_ERROR,
|
||||
LocationKind::FULLTEXT_SEARCH,
|
||||
LocationKind::SCREEN_SEARCH,
|
||||
LocationKind::UNSOLVED
|
||||
};
|
||||
|
||||
for (LocationKind kind : kinds)
|
||||
{
|
||||
if (i == locationKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to location kind.");
|
||||
}
|
||||
int locationKindToInt(LocationKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
LocationKind intToLocationKind(int i)
|
||||
{
|
||||
const LocationKind kinds[] = {
|
||||
LocationKind::TOKEN,
|
||||
LocationKind::SCOPE,
|
||||
LocationKind::QUALIFIER,
|
||||
LocationKind::LOCAL_SYMBOL,
|
||||
LocationKind::SIGNATURE,
|
||||
LocationKind::ATOMIC_RANGE,
|
||||
LocationKind::INDEXER_ERROR,
|
||||
LocationKind::FULLTEXT_SEARCH,
|
||||
LocationKind::SCREEN_SEARCH,
|
||||
LocationKind::UNSOLVED};
|
||||
|
||||
for (LocationKind kind: kinds)
|
||||
{
|
||||
if (i == locationKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
throw SourcetrailException("Unable to convert integer \"" + std::to_string(i) + "\" to location kind.");
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+113
-118
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "NameHierarchy.h"
|
||||
|
||||
@@ -20,111 +20,106 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
std::string serializeNameHierarchyToJson(const NameHierarchy& nameHierarchy)
|
||||
std::string serializeNameHierarchyToJson(const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
typedef nlohmann::json json;
|
||||
|
||||
nlohmann::json j;
|
||||
|
||||
j["name_delimiter"] = nameHierarchy.nameDelimiter;
|
||||
|
||||
for (const NameElement& nameElement: nameHierarchy.nameElements)
|
||||
{
|
||||
typedef nlohmann::json json;
|
||||
|
||||
nlohmann::json j;
|
||||
|
||||
j["name_delimiter"] = nameHierarchy.nameDelimiter;
|
||||
|
||||
for (const NameElement& nameElement : nameHierarchy.nameElements)
|
||||
{
|
||||
j["name_elements"].push_back(
|
||||
{
|
||||
{ "prefix", nameElement.prefix } ,
|
||||
{ "name", nameElement.name } ,
|
||||
{ "postfix", nameElement.postfix }
|
||||
});
|
||||
}
|
||||
|
||||
return j.dump(4);
|
||||
j["name_elements"].push_back({{"prefix", nameElement.prefix}, {"name", nameElement.name}, {"postfix", nameElement.postfix}});
|
||||
}
|
||||
|
||||
NameHierarchy deserializeNameHierarchyFromJson(const std::string& serializedNameHierarchy, std::string* error)
|
||||
{
|
||||
typedef nlohmann::json json;
|
||||
|
||||
NameHierarchy nameHierarchy;
|
||||
try
|
||||
{
|
||||
json j = nlohmann::json::parse(serializedNameHierarchy);
|
||||
{
|
||||
json jDelimiter = j["name_delimiter"];
|
||||
if (jDelimiter.is_string())
|
||||
{
|
||||
nameHierarchy.nameDelimiter = jDelimiter.get<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
json jNameElements = j["name_elements"];
|
||||
if (jNameElements.is_array())
|
||||
{
|
||||
for (json::iterator it = jNameElements.begin(); it != jNameElements.end(); ++it)
|
||||
{
|
||||
NameElement nameElement;
|
||||
{
|
||||
json jPrefix = it.value()["prefix"];
|
||||
if (jPrefix.is_string())
|
||||
{
|
||||
nameElement.prefix = jPrefix.get<std::string>();
|
||||
}
|
||||
}
|
||||
{
|
||||
json jName = it.value()["name"];
|
||||
if (jName.is_string())
|
||||
{
|
||||
nameElement.name = jName.get<std::string>();
|
||||
}
|
||||
}
|
||||
{
|
||||
json jPostfix = it.value()["postfix"];
|
||||
if (jPostfix.is_string())
|
||||
{
|
||||
nameElement.postfix = jPostfix.get<std::string>();
|
||||
}
|
||||
}
|
||||
nameHierarchy.nameElements.push_back(nameElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (json::exception& e)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
*error = e.what();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
*error = "Exception thrown during NameHierarchy deserialization";
|
||||
}
|
||||
}
|
||||
|
||||
return nameHierarchy;
|
||||
}
|
||||
|
||||
std::string serializeNameHierarchyToDatabaseString(const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
static std::string META_DELIMITER = "\tm";
|
||||
static std::string NAME_DELIMITER = "\tn";
|
||||
static std::string PARTS_DELIMITER = "\ts";
|
||||
static std::string SIGNATURE_DELIMITER = "\tp";
|
||||
|
||||
std::string serialized = nameHierarchy.nameDelimiter + META_DELIMITER;
|
||||
for (size_t i = 0; i < nameHierarchy.nameElements.size(); i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
serialized += NAME_DELIMITER;
|
||||
}
|
||||
const NameElement& nameElement = nameHierarchy.nameElements[i];
|
||||
serialized += nameElement.name + PARTS_DELIMITER + nameElement.prefix + SIGNATURE_DELIMITER + nameElement.postfix;
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
return j.dump(4);
|
||||
}
|
||||
|
||||
NameHierarchy deserializeNameHierarchyFromJson(const std::string& serializedNameHierarchy, std::string* error)
|
||||
{
|
||||
typedef nlohmann::json json;
|
||||
|
||||
NameHierarchy nameHierarchy;
|
||||
try
|
||||
{
|
||||
json j = nlohmann::json::parse(serializedNameHierarchy);
|
||||
{
|
||||
json jDelimiter = j["name_delimiter"];
|
||||
if (jDelimiter.is_string())
|
||||
{
|
||||
nameHierarchy.nameDelimiter = jDelimiter.get<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
json jNameElements = j["name_elements"];
|
||||
if (jNameElements.is_array())
|
||||
{
|
||||
for (json::iterator it = jNameElements.begin(); it != jNameElements.end(); ++it)
|
||||
{
|
||||
NameElement nameElement;
|
||||
{
|
||||
json jPrefix = it.value()["prefix"];
|
||||
if (jPrefix.is_string())
|
||||
{
|
||||
nameElement.prefix = jPrefix.get<std::string>();
|
||||
}
|
||||
}
|
||||
{
|
||||
json jName = it.value()["name"];
|
||||
if (jName.is_string())
|
||||
{
|
||||
nameElement.name = jName.get<std::string>();
|
||||
}
|
||||
}
|
||||
{
|
||||
json jPostfix = it.value()["postfix"];
|
||||
if (jPostfix.is_string())
|
||||
{
|
||||
nameElement.postfix = jPostfix.get<std::string>();
|
||||
}
|
||||
}
|
||||
nameHierarchy.nameElements.push_back(nameElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (json::exception& e)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
*error = e.what();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
*error = "Exception thrown during NameHierarchy deserialization";
|
||||
}
|
||||
}
|
||||
|
||||
return nameHierarchy;
|
||||
}
|
||||
|
||||
std::string serializeNameHierarchyToDatabaseString(const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
static std::string META_DELIMITER = "\tm";
|
||||
static std::string NAME_DELIMITER = "\tn";
|
||||
static std::string PARTS_DELIMITER = "\ts";
|
||||
static std::string SIGNATURE_DELIMITER = "\tp";
|
||||
|
||||
std::string serialized = nameHierarchy.nameDelimiter + META_DELIMITER;
|
||||
for (size_t i = 0; i < nameHierarchy.nameElements.size(); i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
serialized += NAME_DELIMITER;
|
||||
}
|
||||
const NameElement& nameElement = nameHierarchy.nameElements[i];
|
||||
serialized += nameElement.name + PARTS_DELIMITER + nameElement.prefix + SIGNATURE_DELIMITER + nameElement.postfix;
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+53
-55
@@ -1,62 +1,60 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "NodeKind.h"
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
int nodeKindToInt(NodeKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
NodeKind intToNodeKind(int i)
|
||||
{
|
||||
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::TYPE_PARAMETER,
|
||||
NodeKind::FILE,
|
||||
NodeKind::MACRO,
|
||||
NodeKind::UNION
|
||||
};
|
||||
|
||||
for (NodeKind kind : kinds)
|
||||
{
|
||||
if (i == nodeKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return NodeKind::UNKNOWN;
|
||||
}
|
||||
int nodeKindToInt(NodeKind kind)
|
||||
{
|
||||
return static_cast<int>(kind);
|
||||
}
|
||||
|
||||
NodeKind intToNodeKind(int i)
|
||||
{
|
||||
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::TYPE_PARAMETER,
|
||||
NodeKind::FILE,
|
||||
NodeKind::MACRO,
|
||||
NodeKind::UNION};
|
||||
|
||||
for (NodeKind kind: kinds)
|
||||
{
|
||||
if (i == nodeKindToInt(kind))
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return NodeKind::UNKNOWN;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+41
-41
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ReferenceKind.h"
|
||||
|
||||
@@ -20,33 +20,33 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
EdgeKind referenceKindToEdgeKind(ReferenceKind kind)
|
||||
EdgeKind referenceKindToEdgeKind(ReferenceKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
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::TYPE_ARGUMENT:
|
||||
return EdgeKind::TYPE_ARGUMENT;
|
||||
case ReferenceKind::TEMPLATE_SPECIALIZATION:
|
||||
return EdgeKind::TEMPLATE_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 EdgeKind::UNKNOWN;
|
||||
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::TYPE_ARGUMENT:
|
||||
return EdgeKind::TYPE_ARGUMENT;
|
||||
case ReferenceKind::TEMPLATE_SPECIALIZATION:
|
||||
return EdgeKind::TEMPLATE_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 EdgeKind::UNKNOWN;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+767
-789
File diff suppressed because it is too large
Load Diff
+57
-57
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "SymbolKind.h"
|
||||
|
||||
@@ -20,49 +20,49 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
NodeKind symbolKindToNodeKind(SymbolKind kind)
|
||||
NodeKind symbolKindToNodeKind(SymbolKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
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::TYPE_PARAMETER:
|
||||
return NodeKind::TYPE_PARAMETER;
|
||||
case SymbolKind::MACRO:
|
||||
return NodeKind::MACRO;
|
||||
case SymbolKind::UNION:
|
||||
return NodeKind::UNION;
|
||||
}
|
||||
return NodeKind::UNKNOWN;
|
||||
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::TYPE_PARAMETER:
|
||||
return NodeKind::TYPE_PARAMETER;
|
||||
case SymbolKind::MACRO:
|
||||
return NodeKind::MACRO;
|
||||
case SymbolKind::UNION:
|
||||
return NodeKind::UNION;
|
||||
}
|
||||
return NodeKind::UNKNOWN;
|
||||
}
|
||||
} // namespace sourcetrail
|
||||
|
||||
+57
-57
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2018 Coati Software KG
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
@@ -24,47 +24,47 @@
|
||||
|
||||
namespace sourcetrail
|
||||
{
|
||||
namespace utility
|
||||
{
|
||||
bool getFileExists(const std::string& filePath)
|
||||
{
|
||||
std::ifstream file(filePath);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
std::string getFileContent(const std::string& filePath)
|
||||
{
|
||||
std::string content;
|
||||
|
||||
std::ifstream file;
|
||||
file.open(filePath);
|
||||
|
||||
if (file.fail())
|
||||
{
|
||||
throw SourcetrailException("Could not open file " + filePath);
|
||||
}
|
||||
|
||||
for (std::string line; std::getline(file, line); )
|
||||
{
|
||||
content += line + "\n";
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
std::string getDateTimeString(const time_t& time)
|
||||
{
|
||||
std::tm* ptm = std::localtime(&time);
|
||||
char buffer[32];
|
||||
std::strftime(buffer, 32, "%Y-%m-%d %H:%M:%S", ptm);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int getLineCount(const std::string s)
|
||||
{
|
||||
return std::count(s.begin(), s.end(), '\n');
|
||||
}
|
||||
}
|
||||
namespace utility
|
||||
{
|
||||
bool getFileExists(const std::string& filePath)
|
||||
{
|
||||
std::ifstream file(filePath);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
std::string getFileContent(const std::string& filePath)
|
||||
{
|
||||
std::string content;
|
||||
|
||||
std::ifstream file;
|
||||
file.open(filePath);
|
||||
|
||||
if (file.fail())
|
||||
{
|
||||
throw SourcetrailException("Could not open file " + filePath);
|
||||
}
|
||||
|
||||
for (std::string line; std::getline(file, line);)
|
||||
{
|
||||
content += line + "\n";
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
std::string getDateTimeString(const time_t& time)
|
||||
{
|
||||
std::tm* ptm = std::localtime(&time);
|
||||
char buffer[32];
|
||||
std::strftime(buffer, 32, "%Y-%m-%d %H:%M:%S", ptm);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int getLineCount(const std::string s)
|
||||
{
|
||||
return std::count(s.begin(), s.end(), '\n');
|
||||
}
|
||||
} // namespace utility
|
||||
} // namespace sourcetrail
|
||||
|
||||
Reference in New Issue
Block a user