Compare commits
68
Commits
v4.db25.p0
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28813de072 | ||
|
|
93d28e93c2 | ||
|
|
939e078310 | ||
|
|
160af94df9 | ||
|
|
c6c3ce1aee | ||
|
|
fee3a9e9a5 | ||
|
|
4bf4b3b325 | ||
|
|
929669bc03 | ||
|
|
5845070707 | ||
|
|
bf4efefda3 | ||
|
|
e4c723462a | ||
|
|
9fc3382dff | ||
|
|
7fa90c75ec | ||
|
|
06e5347a79 | ||
|
|
aa5faac683 | ||
|
|
278c746b9e | ||
|
|
bf8ad0fc89 | ||
|
|
84dbbae243 | ||
|
|
07735d913b | ||
|
|
f08d448ac7 | ||
|
|
de6544b63b | ||
|
|
9b6e52b1e9 | ||
|
|
aa279dcf7d | ||
|
|
d2adf3e7b7 | ||
|
|
26e13ef053 | ||
|
|
1698eeef1c | ||
|
|
8b588fd6ab | ||
|
|
12c908c95c | ||
|
|
58497e8d04 | ||
|
|
2afb1a81bb | ||
|
|
69c0614a9d | ||
|
|
e2a127b8c0 | ||
|
|
6c20563188 | ||
|
|
9395051095 | ||
|
|
fb2daf3d30 | ||
|
|
ac212e70bf | ||
|
|
2a718377a5 | ||
|
|
eba449fea5 | ||
|
|
9bd4ae7724 | ||
|
|
9815bdd7df | ||
|
|
57c465c67a | ||
|
|
89b656bbca | ||
|
|
044535965c | ||
|
|
844ef8838c | ||
|
|
620f3d3633 | ||
|
|
25a0d82f9a | ||
|
|
6e291ea6dc | ||
|
|
3df948af32 | ||
|
|
a2b1f79fec | ||
|
|
08d04278cd | ||
|
|
32f7c21302 | ||
|
|
0251b6d8a7 | ||
|
|
c87af4a3b1 | ||
|
|
a09bfdce93 | ||
|
|
53d8d0c3fa | ||
|
|
62228e8fb9 | ||
|
|
0ef465c52e | ||
|
|
824e51ded7 | ||
|
|
e3e61dbd7c | ||
|
|
ee7ec51187 | ||
|
|
73ef1190c3 | ||
|
|
fb9115189a | ||
|
|
1e464ac338 | ||
|
|
5b4f4e521e | ||
|
|
9f7e77aa2b | ||
|
|
9cfb354c58 | ||
|
|
01d16568c2 | ||
|
|
af2638fec5 |
-177
@@ -1,177 +0,0 @@
|
||||
language: cpp
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- CC_COMPILER=gcc-5 CXX_COMPILER=g++-5
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- CC_COMPILER=gcc-5 CXX_COMPILER=g++-5 PERL_BINDING=1
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- CC_COMPILER=gcc-5 CXX_COMPILER=g++-5 PYTHON_BINDING=1 PYTHON=3.5
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- CC_COMPILER=gcc-5 CXX_COMPILER=g++-5 JAVA_BINDING=1
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env:
|
||||
- PERL_BINDING=1
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env:
|
||||
- PYTHON_BINDING=1 PYTHON=3.6
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode11.2
|
||||
env:
|
||||
- JAVA_BINDING=1
|
||||
|
||||
before_install:
|
||||
- |
|
||||
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install swig
|
||||
brew link --force swig
|
||||
|
||||
if [[ "$PERL_BINDING" == "1" ]]; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install perl
|
||||
perl --version
|
||||
fi
|
||||
|
||||
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qq swig
|
||||
|
||||
if [[ "$PERL_BINDING" == "1" ]]; then
|
||||
sudo apt-get install perl
|
||||
alias perl="/usr/bin/perl"
|
||||
perl --version
|
||||
fi
|
||||
|
||||
# this is only working for python3.5
|
||||
if [[ "$PYTHON_BINDING" == "1" ]]; then
|
||||
sudo apt-get install python$PYTHON
|
||||
sudo apt-get install python$PYTHON-dev
|
||||
alias python="/usr/bin/python$PYTHON"
|
||||
python --version
|
||||
fi
|
||||
|
||||
if [[ "$JAVA_BINDING" == "1" ]]; then
|
||||
sudo apt-get install openjdk-8-jdk
|
||||
javac -version
|
||||
fi
|
||||
fi
|
||||
|
||||
install:
|
||||
- if [[ "${CXX_COMPILER}" != "" ]]; then export CXX=${CXX_COMPILER}; export CXX_FOR_BUILD=${CXX_COMPILER}; fi
|
||||
- if [[ "${CC_COMPILER}" != "" ]]; then export CC=${CC_COMPILER}; export CC_FOR_BUILD=${CC_COMPILER}; fi
|
||||
|
||||
script:
|
||||
- |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBUILD_BINDINGS_PERL=$PERL_BINDING -DBUILD_BINDINGS_PYTHON=$PYTHON_BINDING -DPYTHON_VERSION=$PYTHON -DBUILD_BINDINGS_JAVA=$JAVA_BINDING ..
|
||||
make
|
||||
./core/test_core
|
||||
|
||||
before_deploy:
|
||||
- |
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
|
||||
VERSION=$(head -1 version.txt)
|
||||
VERSION=${VERSION//./_}
|
||||
|
||||
if [[ "$PERL_BINDING" == "1" ]]; then
|
||||
BUNDLE_NAME=sourcetraildb_perl_${VERSION}-${TRAVIS_OS_NAME}-64bit-${TRAVIS_COMPILER}
|
||||
|
||||
mkdir -p $BUNDLE_NAME
|
||||
cp build/bindings_perl/sourcetraildb.* $BUNDLE_NAME
|
||||
|
||||
elif [[ "$PYTHON_BINDING" == "1" ]]; then
|
||||
PYTHON_VERSION=${PYTHON//.}
|
||||
PYTHON_VERSION=${PYTHON_VERSION:0:2}
|
||||
BUNDLE_NAME=sourcetraildb_python${PYTHON_VERSION}_${VERSION}-${TRAVIS_OS_NAME}-64bit-${TRAVIS_COMPILER}
|
||||
|
||||
mkdir -p $BUNDLE_NAME
|
||||
cp build/bindings_python/sourcetraildb.py $BUNDLE_NAME
|
||||
cp build/bindings_python/_sourcetraildb* $BUNDLE_NAME/_sourcetraildb.so
|
||||
|
||||
elif [[ "$JAVA_BINDING" == "1" ]]; then
|
||||
BUNDLE_NAME=sourcetraildb_java_${VERSION}-${TRAVIS_OS_NAME}-64bit-${TRAVIS_COMPILER}
|
||||
|
||||
mkdir -p $BUNDLE_NAME
|
||||
cp build/bindings_java/SourcetrailDB.jar $BUNDLE_NAME
|
||||
cp build/bindings_java/lib_sourcetraildb* $BUNDLE_NAME
|
||||
|
||||
else
|
||||
BUNDLE_NAME=sourcetraildb_core_${VERSION}-${TRAVIS_OS_NAME}-64bit-${TRAVIS_COMPILER}
|
||||
|
||||
mkdir -p $BUNDLE_NAME/include
|
||||
mkdir -p $BUNDLE_NAME/lib
|
||||
cp build/core/*.a $BUNDLE_NAME/lib
|
||||
cp core/include/* $BUNDLE_NAME/include
|
||||
cp build/core/include/* $BUNDLE_NAME/include
|
||||
|
||||
fi
|
||||
|
||||
mkdir -p $BUNDLE_NAME/license
|
||||
cp LICENSE.txt $BUNDLE_NAME/license/license_sourcetraildb.txt
|
||||
cp external/catch/license_catch.txt $BUNDLE_NAME/license/
|
||||
cp external/cpp_sqlite/license_cpp_sqlite.txt $BUNDLE_NAME/license/
|
||||
cp external/json/license_json.txt $BUNDLE_NAME/license/
|
||||
|
||||
zip -r $BUNDLE_NAME $BUNDLE_NAME
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: UwuiE6SrjorpBr1CzTRadX1zq83hwbnur+MvzBueqEHM7Yyu5Y0xMkwchRlX41HzMuSkC0azM0S8GfqJT1E7pIrqgJGvFbXR3t9ZG8HtvrcM4PvTS8b0G0d8aWHfTP2Zv+PAK3MMnYtxmOFPs4IaqO1m+imjQWtpvCRG5tvc4DNIPAMh0S8LCjxUdz35BYAM4pwM7WB9Qt+YhbyP1h3oSQ7qtr1fZYCC0H4G1cjVBLeP9g66/tfg0MIQVf1wxU8KF3H6esilPhFDCnsBYcnYrKyJN9OkMXZvLoxsjqQvTlsSNO2wIQ32dW8fk+1VFebWjN3RnNUV2Zb3wdz2y6e6A08J8T/+QrJ003eUJAGassQEgsuQ85ldcbylbKCVdi+iA+W6pKSJoHIlyr2KQG77OZ+q3obvY09IMNX2qVnUJKG8g9vZHKk8TlvUtIDODUxqJ/XUVwG5aKiUPuE5UMeLnZlO7cWpABb28BjXGehLCDtqg2eu39n+N9hyEjmsJLcOuS03+C55YrjJHW09qZomorMyIa//4jxSAOU9Iah7cRzPGUl/eSwQ2kf0OGWfySd2PreOThWepH0ymvG9htlTUSMM4wRuKnNAmG7NY6TykttJY2KsTLpki+P4MFBlSvL0VvoHQintK69udSVeUrJaGx508w8V59AdZwJjMxhjOXw=
|
||||
file_glob: true
|
||||
file: $TRAVIS_BUILD_DIR/*.zip
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
repo: CoatiSoftware/SourcetrailDB
|
||||
@@ -7,5 +7,6 @@ Code Contributors
|
||||
=================
|
||||
|
||||
Andrew Pam (@xanni) <andrew@sericyb.com.au>
|
||||
Jørgen Lund (@strangebroadcasts) <jlund@strangebroadcasts.com>
|
||||
|
||||
Note: (@user) means a github user name.
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## v4.db25.p1
|
||||
|
||||
**2021-03-08**
|
||||
|
||||
* Added C# bindings for API
|
||||
* Fixed typo in package names of Windows build artifacts
|
||||
* Changed implementation of getFileContent() to match Sourcetrail code
|
||||
|
||||
|
||||
## v4.db25.p0
|
||||
|
||||
**2020-10-12**
|
||||
|
||||
@@ -5,6 +5,7 @@ cmake_minimum_required (VERSION 2.6)
|
||||
set(BUILD_BINDINGS_PERL OFF CACHE BOOL "Build the SourcetrailDB Perl bindings.")
|
||||
set(BUILD_BINDINGS_PYTHON OFF CACHE BOOL "Build the SourcetrailDB Python bindings.")
|
||||
set(BUILD_BINDINGS_JAVA OFF CACHE BOOL "Build the SourcetrailDB Java bindings.")
|
||||
set(BUILD_BINDINGS_CSHARP OFF CACHE BOOL "Build the SourcetrailDB C# bindings.")
|
||||
set(BUILD_EXAMPLES ON CACHE BOOL "Build the examples.")
|
||||
|
||||
set(PROJECT_NAME "SourcetrailDB")
|
||||
@@ -83,6 +84,16 @@ else()
|
||||
message(STATUS "Building the SourcetrailDB Java bindings will be skipped. You can enable building this target by setting 'BUILD_BINDINGS_JAVA' to 'ON'.")
|
||||
endif()
|
||||
|
||||
# --- C# Binding ---
|
||||
if (BUILD_BINDINGS_CSHARP)
|
||||
message(STATUS "The SourcetrailDB C# bindings will be built.")
|
||||
|
||||
set(CSHARP_BINDING_TARGET_NAME "bindings_csharp")
|
||||
set(CSHARP_BINDING_OUTPUT_DIR "")
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/bindings_csharp" "${CMAKE_BINARY_DIR}/bindings_csharp")
|
||||
else()
|
||||
message(STATUS "Building the SourcetrailDB C# bindings will be skipped. You can enable building this target by setting 'BUILD_BINDINGS_CSHARP' to 'ON'.")
|
||||
endif()
|
||||
|
||||
# --- Examples ---
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@ Library to export [Sourcetrail](https://www.sourcetrail.com/) compatible databas
|
||||
|
||||
## CI Pipelines
|
||||
|
||||
Windows: [](https://ci.appveyor.com/project/mlangkabel/sourcetraildb/branch/master)
|
||||
|
||||
Linux and macOS: [](https://travis-ci.org/CoatiSoftware/SourcetrailDB)
|
||||
[](https://ci.appveyor.com/project/mlangkabel/sourcetraildb/branch/master)
|
||||
|
||||
|
||||
## Introduction
|
||||
@@ -20,9 +18,12 @@ The SourcetrailDB project provides write access to [Sourcetrail](https://www.sou
|
||||
## Projects Using SourcetrailDB
|
||||
|
||||
The following list of projects already use SourcetrailDB API to extend the language support of Sourcetrail.
|
||||
* [SourcetrailPythonIndexer](https://github.com/CoatiSoftware/SourcetrailPythonIndexer) is a Sourcetrail language extension that brings Python support to Sourcetrail. This project is still in a prototype state, but you can already run it on your Python code.
|
||||
* [SourcetrailPythonIndexer](https://github.com/CoatiSoftware/SourcetrailPythonIndexer) is a Sourcetrail language extension that brings Python support to Sourcetrail. This project is in a stable state and it has a direct Sourcetrail integration via the Python Source Group.
|
||||
* [SourcetrailDotnetIndexer](https://github.com/packdat/SourcetrailDotnetIndexer) is a Sourcetrail language extension that allows to index all kinds of .NET assemblies, regardless of the language they are created from (e.g. C#, VB.NET, ...). Because it does not (need to) know the source code, it does not provide any code snippets for the indexed assemblies, but it already works well at generating graphs.
|
||||
* [SourcetrailPerlIndexer](https://github.com/xanni/SourcetrailPerlIndexer) is a Sourcetrail language extension that brings Perl support to Sourcetrail. This project is still in a prototype state, but you can already run it on your Perl code via the Custom Source Group.
|
||||
* [stacktraceflow_sourcetrail](https://github.com/Baranowski/stacktraceflow_sourcetrail) combines the power of Valgrind and Sourcetrail to quickly produce interactive callgraph of software written in any language, as long as it's compiled to ELF/DWARF format (e.g. Rust and Go).
|
||||
* [SourcetrailTypescriptIndexer](https://github.com/LouisStAmour/SourcetrailTypescriptIndexer) is a Typescript Indexer for Sourcetrail using the TypeScript compiler and node bindings contributed to SourcetrailDB (*prototype stage*).
|
||||
* [SourcetrailGolangIndexer](https://github.com/TOMATOFAQ/SourcetrailGolangIndexer) is a Golang Indexer for Sourcetrail (*prototype stage*).
|
||||
|
||||
## Adding new Language Support
|
||||
|
||||
@@ -38,10 +39,10 @@ Even though the core implementation is written in C++, this does not require you
|
||||
* Perl (via [SWIG](http://www.swig.org/))
|
||||
* Python (via [SWIG](http://www.swig.org/))
|
||||
* Java (via [SWIG](http://www.swig.org/))
|
||||
* C# (via [SWIG](http://www.swig.org/))
|
||||
|
||||
If the language of your choice is not covered by this list, feel free to [open an issue](https://github.com/CoatiSoftware/SourcetrailDB/issues) or provide a pull request.
|
||||
|
||||
|
||||
## Versioning
|
||||
|
||||
The SourcetrailDB version format consists of three numbers in the format `vXX.dbYY.pZZ`.
|
||||
@@ -149,6 +150,20 @@ $ make
|
||||
|
||||
Swig is configured to generate the Java binding code as a pre-build event, so you don't need to bother with updating manually.
|
||||
|
||||
### C# Bindings
|
||||
|
||||
Requirements:
|
||||
* [SWIG 3.0.12](http://www.swig.org/) is used to automatically generate C# binding code. Make sure that SWIG is added to your path environment variable.
|
||||
|
||||
If you want to build the C# bindings run:
|
||||
```
|
||||
$ cd path/to/SourcetrailDB
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake -DBUILD_BINDINGS_CSHARP=ON ..
|
||||
$ make
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
The examples help you to understand SourcetrailDB usage in practice. Please take a look at each examples README file for build and use instructions. Each example also provides a Sourcetrail project file `.srctrlprj` showing you how to use a custom indexer directly from Sourcetrail (see [Integrating with Sourcetrail](#integrating-with-sourcetrail)).
|
||||
|
||||
+149
-137
@@ -1,39 +1,44 @@
|
||||
version: 0.0.0.{build}
|
||||
image: Visual Studio 2017
|
||||
|
||||
|
||||
image:
|
||||
- Visual Studio 2017
|
||||
- Ubuntu
|
||||
- macos
|
||||
|
||||
|
||||
environment:
|
||||
PYTHON_BINDINGS: 1
|
||||
JAVA_BINDINGS: 1
|
||||
PERL_BINDINGS: 1
|
||||
|
||||
|
||||
platform: x64
|
||||
|
||||
|
||||
configuration: Release
|
||||
|
||||
|
||||
for:
|
||||
-
|
||||
matrix:
|
||||
- MBITS: 32
|
||||
PYTHON_VERSION: 37
|
||||
MSVC_VERSION: 15
|
||||
DEPLOY_CORE: 1
|
||||
DEPLOY_PYTHON_BINDINGS: 1
|
||||
DEPLOY_JAVA_BINDINGS: 1
|
||||
- MBITS: 64
|
||||
PYTHON_VERSION: 37
|
||||
MSVC_VERSION: 15
|
||||
DEPLOY_CORE: 1
|
||||
DEPLOY_PYTHON_BINDINGS: 1
|
||||
DEPLOY_JAVA_BINDINGS: 1
|
||||
|
||||
- MBITS: 32
|
||||
PYTHON_VERSION: 37
|
||||
MSVC_VERSION: 14
|
||||
DEPLOY_CORE: 1
|
||||
- MBITS: 64
|
||||
PYTHON_VERSION: 37
|
||||
MSVC_VERSION: 14
|
||||
DEPLOY_CORE: 1
|
||||
|
||||
|
||||
install:
|
||||
only:
|
||||
- image: Visual Studio 2017
|
||||
install:
|
||||
- cmd: |
|
||||
echo Building on Windows!
|
||||
echo Python: %PYTHON_BINDINGS%
|
||||
echo Java: %JAVA_BINDINGS%
|
||||
echo Perl: %PERL_BINDINGS%
|
||||
- ps: |
|
||||
if ($env:MBITS -eq "32") {
|
||||
$env:PYTHON_VERSION=37
|
||||
$env:MSVC_VERSION=15
|
||||
- ps: |
|
||||
if ($env:PLATFORM -eq "x86") {
|
||||
echo "Architecture set to 32 bit."
|
||||
$env:CMAKE_GENERATOR="Visual Studio $env:MSVC_VERSION"
|
||||
$env:PYTHON_PATH="C:/Python$env:PYTHON_VERSION"
|
||||
} elseif ($env:MBITS -eq "64") {
|
||||
} elseif ($env:PLATFORM -eq "x64") {
|
||||
echo "Architecture set to 64 bit."
|
||||
$env:CMAKE_GENERATOR="Visual Studio $env:MSVC_VERSION Win64"
|
||||
$env:PYTHON_PATH="C:/Python$env:PYTHON_VERSION-x64"
|
||||
@@ -43,120 +48,127 @@ install:
|
||||
# Install SWIG by Choco
|
||||
choco install -y --no-progress swig --version 4.0.1
|
||||
choco install -y --no-progress openjdk
|
||||
|
||||
|
||||
before_build:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -G "%CMAKE_GENERATOR%" ../ -DBUILD_BINDINGS_PYTHON=%DEPLOY_PYTHON_BINDINGS% -DPYTHON_LIBRARY="%PYTHON_PATH%/libs/python%PYTHON_VERSION%.lib" -DBUILD_BINDINGS_JAVA=%DEPLOY_JAVA_BINDINGS%
|
||||
- cd ../
|
||||
- ps: $env:CORE_VERSION = Get-Content -Path ./version.txt
|
||||
- ps: $env:UNDERSCORED_CORE_VERSION = $env:CORE_VERSION.Replace(".", "_")
|
||||
- ps: echo "Core version is $env:CORE_VERSION"
|
||||
# Install Strawberry Perl and put before any other Perls in %PATH%
|
||||
if ($env:PLATFORM -eq "x86") {
|
||||
choco install -y --no-progress --forcex86 strawberryperl
|
||||
} elseif ($env:PLATFORM -eq "x64") {
|
||||
choco install -y --no-progress strawberryperl
|
||||
} else {
|
||||
echo "No architecture set. Build will be canceled."
|
||||
}
|
||||
$env:PATH="C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;$env:PATH"
|
||||
$env:PERL_VERSION=$(perl -e 'print $^V')
|
||||
before_build:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -G "%CMAKE_GENERATOR%" ../ -DBUILD_BINDINGS_PYTHON=%DEPLOY_PYTHON_BINDINGS% -DPYTHON_LIBRARY="%PYTHON_PATH%/libs/python%PYTHON_VERSION%.lib" -DBUILD_BINDINGS_JAVA=%DEPLOY_JAVA_BINDINGS% -DBUILD_BINDINGS_CSHARP=%DEPLOY_CSHARP_BINDINGS%
|
||||
- cd ../
|
||||
- ps: |
|
||||
if ($Env:PERL_BINDINGS -eq "1") {
|
||||
mkdir build-perl
|
||||
cd build-perl
|
||||
# Need to use Unix Makefiles because Strawberry Perl is a MinGW environment
|
||||
cmake -G "Unix Makefiles" ../ -DBUILD_BINDINGS_PERL=$Env:PERL_BINDINGS
|
||||
if ($LastExitCode -ne 0) { throw "Perl bindings: cmake failed with exit code $LastExitCode" }
|
||||
cd ../
|
||||
}
|
||||
- ps: $env:CORE_VERSION = Get-Content -Path ./version.txt
|
||||
- ps: $env:UNDERSCORED_CORE_VERSION = $env:CORE_VERSION.Replace(".", "_")
|
||||
- ps: echo "Core version is $env:CORE_VERSION"
|
||||
# TODO: use the core version to update appveyor version here
|
||||
# - ps: $env:BUILD_VERSION = "0.0.1." + $env:APPVEYOR_BUILD_NUMBER
|
||||
# - ps: echo update build version to $env:BUILD_VERSION
|
||||
# - ps: Update-AppveyorBuild -Version $env:BUILD_VERSION
|
||||
build_script:
|
||||
- cd build
|
||||
- msbuild /p:configuration=Release /v:m ALL_BUILD.vcxproj
|
||||
- cd ../
|
||||
- ps: |
|
||||
if ($Env:PERL_BINDINGS -eq "1") {
|
||||
cd build-perl
|
||||
gmake
|
||||
if ($LastExitCode -ne 0) { throw "Perl bindings: gmake failed with exit code $LastExitCode" }
|
||||
cd ../
|
||||
}
|
||||
test_script:
|
||||
- "build\\core\\release\\test_core.exe"
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Ubuntu
|
||||
install:
|
||||
- sh: |
|
||||
echo Building on Ubuntu!
|
||||
echo Python: $PYTHON_BINDINGS
|
||||
echo Java: $JAVA_BINDINGS
|
||||
echo Perl: $PERL_BINDINGS
|
||||
- sh: |
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qq swig
|
||||
if [[ "$PYTHON_BINDINGS" == "1" ]]; then
|
||||
sudo apt-get -y install python3.5
|
||||
sudo apt-get -y install python3.5-dev
|
||||
alias python="/usr/bin/python3.5"
|
||||
python --version
|
||||
fi
|
||||
if [[ "$JAVA_BINDINGS" == "1" ]]; then
|
||||
#installing Java not required, as image already comes with Java 9
|
||||
#sudo apt-get install openjdk-8-jdk
|
||||
javac -version
|
||||
fi
|
||||
if [[ "$PERL_BINDINGS" == "1" ]]; then
|
||||
#installing Perl not required, as image already comes with Perl 5
|
||||
#sudo apt-get install perl
|
||||
#alias perl="/usr/bin/perl"
|
||||
perl --version
|
||||
fi
|
||||
build_script:
|
||||
- sh: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBUILD_BINDINGS_PERL=$PERL_BINDINGS -DBUILD_BINDINGS_PYTHON=$PYTHON_BINDINGS -DPYTHON_VERSION=3.5 -DBUILD_BINDINGS_JAVA=$JAVA_BINDINGS ..
|
||||
make
|
||||
test_script:
|
||||
- sh: |
|
||||
./core/test_core
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: macos
|
||||
install:
|
||||
- sh: |
|
||||
echo Building the Java bindings is currently disabled in CI because JNI cannot be found by CMake
|
||||
JAVA_BINDINGS=0
|
||||
- sh: |
|
||||
echo Building on Mac OS!
|
||||
echo Python: $PYTHON_BINDINGS
|
||||
echo Java: $JAVA_BINDINGS
|
||||
echo Perl: $PERL_BINDINGS
|
||||
- sh: |
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install swig
|
||||
brew link --force swig
|
||||
if [[ "$JAVA_BINDINGS" == "1" ]]; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install openjdk
|
||||
fi
|
||||
if [[ "$PERL_BINDINGS" == "1" ]]; then
|
||||
# installing Perl not required, as image already comes with Perl 5
|
||||
#HOMEBREW_NO_AUTO_UPDATE=1 brew install perl
|
||||
perl --version
|
||||
fi
|
||||
|
||||
build_script:
|
||||
- sh: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBUILD_BINDINGS_PERL=$PERL_BINDINGS -DBUILD_BINDINGS_PYTHON=$PYTHON_BINDINGS -DPYTHON_VERSION=3.6 -DBUILD_BINDINGS_JAVA=$JAVA_BINDINGS ..
|
||||
make
|
||||
test_script:
|
||||
- sh: |
|
||||
./core/test_core
|
||||
|
||||
|
||||
build_script:
|
||||
- cd build
|
||||
- msbuild /p:configuration=Release /v:m ALL_BUILD.vcxproj
|
||||
- cd ../
|
||||
|
||||
|
||||
after_build:
|
||||
- ps: $env:CORE_PACKAGE_NAME = 'sourcetraildb_core_' + $env:UNDERSCORED_CORE_VERSION + '-windows-' + $env:MBITS + 'bit-msvc' + $env:MSVC_VERSION
|
||||
- ps: $env:PYTHON_PACKAGE_NAME = 'sourcetrailbd_python' + $env:PYTHON_VERSION + '_' + $env:UNDERSCORED_CORE_VERSION + '-windows-' + $env:MBITS + 'bit'
|
||||
- ps: $env:JAVA_PACKAGE_NAME = 'sourcetrailbd_java_' + $env:UNDERSCORED_CORE_VERSION + '-windows-' + $env:MBITS + 'bit'
|
||||
- ps: echo $env:CORE_PACKAGE_NAME
|
||||
- ps: echo $env:PYTHON_PACKAGE_NAME
|
||||
- ps: echo $env:JAVA_PACKAGE_NAME
|
||||
|
||||
- ps: $env:ARTIFACTS_TO_DEPLOY = ""
|
||||
|
||||
- ps: |
|
||||
mkdir artifacts_core
|
||||
if ($env:DEPLOY_CORE -eq "1") {
|
||||
cd artifacts_core
|
||||
mkdir $env:CORE_PACKAGE_NAME
|
||||
cd $env:CORE_PACKAGE_NAME
|
||||
mkdir lib
|
||||
mkdir include
|
||||
mkdir license
|
||||
cd ../..
|
||||
|
||||
copy build/core/release/sourcetraildb.lib artifacts_core/$env:CORE_PACKAGE_NAME/lib/
|
||||
copy build/core/include/version.h artifacts_core/$env:CORE_PACKAGE_NAME/include/
|
||||
copy core/include/* artifacts_core/$env:CORE_PACKAGE_NAME/include/
|
||||
copy LICENSE.txt artifacts_core/$env:CORE_PACKAGE_NAME/license/license_sourcetraildb.txt
|
||||
copy external/catch/license_catch.txt artifacts_core/$env:CORE_PACKAGE_NAME/license/
|
||||
copy external/cpp_sqlite/license_cpp_sqlite.txt artifacts_core/$env:CORE_PACKAGE_NAME/license/
|
||||
copy external/json/license_json.txt artifacts_core/$env:CORE_PACKAGE_NAME/license/
|
||||
|
||||
$env:ARTIFACTS_TO_DEPLOY = $env:ARTIFACTS_TO_DEPLOY + "," + $env:CORE_PACKAGE_NAME
|
||||
}
|
||||
- ps: |
|
||||
mkdir artifacts_bindings_python
|
||||
if ($env:DEPLOY_PYTHON_BINDINGS -eq "1") {
|
||||
cd artifacts_bindings_python
|
||||
mkdir $env:PYTHON_PACKAGE_NAME
|
||||
cd $env:PYTHON_PACKAGE_NAME
|
||||
mkdir license
|
||||
cd ../..
|
||||
|
||||
copy build/bindings_python/release/_sourcetraildb.pyd artifacts_bindings_python/$env:PYTHON_PACKAGE_NAME/
|
||||
copy build/bindings_python/sourcetraildb.py artifacts_bindings_python/$env:PYTHON_PACKAGE_NAME/
|
||||
copy LICENSE.txt artifacts_bindings_python/$env:PYTHON_PACKAGE_NAME/license/license_sourcetraildb.txt
|
||||
copy external/catch/license_catch.txt artifacts_bindings_python/$env:PYTHON_PACKAGE_NAME/license/
|
||||
copy external/cpp_sqlite/license_cpp_sqlite.txt artifacts_bindings_python/$env:PYTHON_PACKAGE_NAME/license/
|
||||
copy external/json/license_json.txt artifacts_bindings_python/$env:PYTHON_PACKAGE_NAME/license/
|
||||
|
||||
$env:ARTIFACTS_TO_DEPLOY = $env:ARTIFACTS_TO_DEPLOY + "," + $env:PYTHON_PACKAGE_NAME
|
||||
}
|
||||
- ps: |
|
||||
mkdir artifacts_bindings_java
|
||||
if ($env:DEPLOY_JAVA_BINDINGS -eq "1") {
|
||||
cd artifacts_bindings_java
|
||||
mkdir $env:JAVA_PACKAGE_NAME
|
||||
cd $env:JAVA_PACKAGE_NAME
|
||||
mkdir license
|
||||
cd ../..
|
||||
|
||||
copy build/bindings_java/release/_sourcetraildb.dll artifacts_bindings_java/$env:JAVA_PACKAGE_NAME/
|
||||
copy build/bindings_java/SourcetrailDB.jar artifacts_bindings_java/$env:JAVA_PACKAGE_NAME/
|
||||
copy LICENSE.txt artifacts_bindings_java/$env:JAVA_PACKAGE_NAME/license/license_sourcetraildb.txt
|
||||
copy external/catch/license_catch.txt artifacts_bindings_java/$env:JAVA_PACKAGE_NAME/license/
|
||||
copy external/cpp_sqlite/license_cpp_sqlite.txt artifacts_bindings_java/$env:JAVA_PACKAGE_NAME/license/
|
||||
copy external/json/license_json.txt artifacts_bindings_java/$env:JAVA_PACKAGE_NAME/license/
|
||||
|
||||
$env:ARTIFACTS_TO_DEPLOY = $env:ARTIFACTS_TO_DEPLOY + "," + $env:JAVA_PACKAGE_NAME
|
||||
}
|
||||
- ps: |
|
||||
$env:ARTIFACTS_TO_DEPLOY = $env:ARTIFACTS_TO_DEPLOY.substring(1)
|
||||
echo $env:ARTIFACTS_TO_DEPLOY
|
||||
|
||||
|
||||
test_script:
|
||||
- "build\\core\\release\\test_core.exe"
|
||||
|
||||
|
||||
artifacts:
|
||||
- path: artifacts_core
|
||||
name: $(CORE_PACKAGE_NAME)
|
||||
type: Zip
|
||||
- path: artifacts_bindings_python
|
||||
name: $(PYTHON_PACKAGE_NAME)
|
||||
type: Zip
|
||||
- path: artifacts_bindings_java
|
||||
name: $(JAVA_PACKAGE_NAME)
|
||||
type: Zip
|
||||
|
||||
|
||||
deploy:
|
||||
provider: GitHub
|
||||
artifact: $(ARTIFACTS_TO_DEPLOY)
|
||||
auth_token:
|
||||
secure: 8UwbjFrtR19GxLgL3O3efUT0Su2mp3+X23YioThJITupEvexmQJPAf3Whmmb3eeL
|
||||
on:
|
||||
appveyor_repo_tag: true
|
||||
- echo ERROR - Empty default script was executed!
|
||||
- exit 1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
# --- Setup Paths ---
|
||||
|
||||
set(RESOURCES_SWIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../resources_swig")
|
||||
set(GENERATED_SRC_DIR "${CMAKE_CURRENT_BINARY_DIR}/src")
|
||||
set(CSHARP_BINDING_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
||||
|
||||
set(SWIG_INTERFACE_FILE "${RESOURCES_SWIG_DIR}/interface/sourcetraildb.i")
|
||||
set(CSHARP_BINDINGS_NAMESPACE "CoatiSoftware.SourcetrailDB")
|
||||
set(CSHARP_BINDING_TARGET_OUTPUT_NAME "SourcetrailDB")
|
||||
|
||||
# --- Find Swig ---
|
||||
|
||||
find_package(SWIG REQUIRED)
|
||||
include(${SWIG_USE_FILE})
|
||||
|
||||
# --- Configure Target ---
|
||||
|
||||
set_source_files_properties(${SWIG_INTERFACE_FILE} PROPERTIES CPLUSPLUS ON)
|
||||
set_property(SOURCE ${SWIG_INTERFACE_FILE} PROPERTY COMPILE_OPTIONS -namespace ${CSHARP_BINDINGS_NAMESPACE} -dllimport ${CSHARP_BINDING_TARGET_OUTPUT_NAME})
|
||||
|
||||
include_directories(
|
||||
"${RESOURCES_SWIG_DIR}/include"
|
||||
"${CORE_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
swig_add_library(
|
||||
${CSHARP_BINDING_TARGET_NAME}
|
||||
TYPE SHARED
|
||||
LANGUAGE csharp
|
||||
OUTPUT_DIR ${CSHARP_BINDING_OUTPUT_DIR}
|
||||
OUTFILE_DIR ${GENERATED_SRC_DIR}
|
||||
SOURCES ${SWIG_INTERFACE_FILE} ${RESOURCES_SWIG_DIR}/src/sourcetraildb.cpp
|
||||
)
|
||||
|
||||
set_target_properties(${CSHARP_BINDING_TARGET_NAME}
|
||||
PROPERTIES OUTPUT_NAME ${CSHARP_BINDING_TARGET_OUTPUT_NAME}
|
||||
SWIG_FLAGS ${CSHARP_BINDINGS_NAMESPACE})
|
||||
|
||||
swig_link_libraries(${CSHARP_BINDING_TARGET_NAME} ${CSHARP_LIBRARIES} ${LIB_CORE_TARGET_NAME})
|
||||
|
||||
configure_file("CoatiSoftware.SourcetrailDB.csproj" "CoatiSoftware.SourcetrailDB.csproj" COPYONLY)
|
||||
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
||||
<Content Include="$(ProjectDir)/SourcetrailDB.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>SourcetrailDB.dll</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<Content Include="$(ProjectDir)/SourcetrailDB.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>SourcetrailDB.so</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))'">
|
||||
<Content Include="$(ProjectDir)/SourcetrailDB.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>SourcetrailDB.dylib</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -19,6 +19,7 @@ find_package(PythonLibs ${PYTHON_VERSION} REQUIRED)
|
||||
find_package(SWIG REQUIRED)
|
||||
include(${SWIG_USE_FILE})
|
||||
|
||||
message("pppp: ${PYTHON_INCLUDE_DIRS}")
|
||||
|
||||
# --- Configure Target ---
|
||||
|
||||
@@ -26,7 +27,7 @@ set_source_files_properties(${SWIG_INTERFACE_FILE} PROPERTIES CPLUSPLUS ON)
|
||||
|
||||
include_directories(
|
||||
"${RESOURCES_SWIG_DIR}/include"
|
||||
"${CORE_SOURCE_DIR}/include"
|
||||
"../core/include"
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
+28
-15
@@ -10,9 +10,21 @@ configure_file(
|
||||
${GENERATED_VERSION_FILE}
|
||||
)
|
||||
|
||||
set(EXTERNAL_FILES
|
||||
../external/cpp_sqlite/src/CppSQLite3.cpp
|
||||
../external/json/include/json.hpp
|
||||
../external/cpp_sqlite/include/CppSQLite3.h
|
||||
)
|
||||
|
||||
set(EXTERNAL_C_FILES
|
||||
../external/cpp_sqlite/src/sqlite3.c
|
||||
../external/cpp_sqlite/include/sqlite3.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${EXTERNAL_FILES} PROPERTIES COMPILE_FLAGS "-w")
|
||||
set_source_files_properties(${EXTERNAL_C_FILES} PROPERTIES COMPILE_FLAGS "-std=gnu89 -w")
|
||||
|
||||
set(LIB_SRC_FILES
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/src/CppSQLite3.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/src/sqlite3.c"
|
||||
src/DatabaseStorage.cpp
|
||||
src/DefinitionKind.cpp
|
||||
src/EdgeKind.cpp
|
||||
@@ -27,9 +39,6 @@ set(LIB_SRC_FILES
|
||||
)
|
||||
|
||||
set(LIB_HDR_FILES
|
||||
"${CMAKE_SOURCE_DIR}/external/json/include/json.hpp"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include/CppSQLite3.h"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include/sqlite3.h"
|
||||
include/DatabaseStorage.h
|
||||
include/DefinitionKind.h
|
||||
include/EdgeKind.h
|
||||
@@ -55,17 +64,21 @@ set(LIB_HDR_FILES
|
||||
${GENERATED_VERSION_FILE}
|
||||
)
|
||||
|
||||
add_library(${LIB_CORE_TARGET_NAME} STATIC ${LIB_SRC_FILES} ${LIB_HDR_FILES})
|
||||
add_library(${LIB_CORE_TARGET_NAME} STATIC ${LIB_SRC_FILES} ${LIB_HDR_FILES} ${EXTERNAL_FILES} ${EXTERNAL_C_FILES})
|
||||
|
||||
set_target_properties(${LIB_CORE_TARGET_NAME} PROPERTIES OUTPUT_NAME "sourcetraildb")
|
||||
|
||||
target_include_directories(${LIB_CORE_TARGET_NAME} PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/json/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include"
|
||||
"${GENERATED_INCLUDE_DIRECTORY}"
|
||||
set_property(
|
||||
TARGET ${LIB_CORE_TARGET_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${GENERATED_INCLUDE_DIRECTORY}"
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_CORE_TARGET_NAME} SYSTEM
|
||||
PUBLIC ../external/json/include
|
||||
PUBLIC ../external/cpp_sqlite/include
|
||||
)
|
||||
|
||||
set(TEST_SRC_FILES
|
||||
test/test.cpp
|
||||
@@ -75,10 +88,10 @@ add_executable(${TEST_CORE_TARGET_NAME} ${TEST_SRC_FILES})
|
||||
|
||||
target_include_directories(${TEST_CORE_TARGET_NAME} PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/catch/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/json/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include"
|
||||
../external/catch/include
|
||||
../external/json/include
|
||||
../external/cpp_sqlite/include
|
||||
"${GENERATED_INCLUDE_DIRECTORY}"
|
||||
)
|
||||
|
||||
target_link_libraries(${TEST_CORE_TARGET_NAME} ${LIB_CORE_TARGET_NAME} "-ldl")
|
||||
target_link_libraries(${TEST_CORE_TARGET_NAME} ${LIB_CORE_TARGET_NAME} ${CMAKE_DL_LIBS})
|
||||
|
||||
+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
|
||||
|
||||
+126
-50
@@ -1,70 +1,146 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include "SourcetrailException.h"
|
||||
|
||||
namespace sourcetrail
|
||||
namespace
|
||||
{
|
||||
namespace utility
|
||||
std::istream& safeGetline(std::istream& is, std::string& t)
|
||||
{
|
||||
t.clear();
|
||||
|
||||
// The characters in the stream are read one-by-one using a std::streambuf.
|
||||
// That is faster than reading them one-by-one using the std::istream.
|
||||
// Code that uses streambuf this way must be guarded by a sentry object.
|
||||
// The sentry object performs various tasks,
|
||||
// such as thread synchronization and updating the stream state.
|
||||
|
||||
std::istream::sentry se(is, true);
|
||||
std::streambuf* sb = is.rdbuf();
|
||||
|
||||
while (true)
|
||||
{
|
||||
bool getFileExists(const std::string& filePath)
|
||||
int c = sb->sbumpc();
|
||||
switch (c)
|
||||
{
|
||||
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())
|
||||
case '\n':
|
||||
return is;
|
||||
case '\r':
|
||||
if (sb->sgetc() == '\n')
|
||||
{
|
||||
throw SourcetrailException("Could not open file " + filePath);
|
||||
sb->sbumpc();
|
||||
}
|
||||
|
||||
for (std::string line; std::getline(file, line); )
|
||||
return is;
|
||||
case std::streambuf::traits_type::eof():
|
||||
// Also handle the case when the last line has no line ending
|
||||
if (t.empty())
|
||||
{
|
||||
content += line + "\n";
|
||||
is.setstate(std::ios::eofbit);
|
||||
}
|
||||
|
||||
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');
|
||||
return is;
|
||||
default:
|
||||
t += (char)c;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
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::vector<std::string> lines;
|
||||
|
||||
try
|
||||
{
|
||||
std::ifstream srcFile;
|
||||
srcFile.open(filePath, std::ios::binary | std::ios::in);
|
||||
|
||||
if (srcFile.fail())
|
||||
{
|
||||
throw SourcetrailException("Could not open file " + filePath);
|
||||
}
|
||||
|
||||
while (!srcFile.eof())
|
||||
{
|
||||
std::string line;
|
||||
safeGetline(srcFile, line);
|
||||
lines.push_back(line + '\n');
|
||||
}
|
||||
|
||||
srcFile.close();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
throw SourcetrailException("Exception thrown while reading file \"" + filePath + "\": " + e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw SourcetrailException("Unknown exception thrown while reading file \"" + filePath + "\"");
|
||||
}
|
||||
|
||||
if (!lines.empty())
|
||||
{
|
||||
std::string last = lines.back().substr(0, lines.back().size() - 1);
|
||||
lines.pop_back();
|
||||
if (!last.empty())
|
||||
{
|
||||
lines.push_back(last);
|
||||
}
|
||||
}
|
||||
|
||||
std::string content;
|
||||
|
||||
for (const std::string& line: lines)
|
||||
{
|
||||
content += line;
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
std::string getDateTimeString(const time_t& time)
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
std::tm* ptm = std::localtime(&time);
|
||||
#pragma warning(pop)
|
||||
char buffer[32];
|
||||
std::strftime(buffer, 32, "%Y-%m-%d %H:%M:%S", ptm);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int getLineCount(const std::string s)
|
||||
{
|
||||
return static_cast<int>(std::count(s.begin(), s.end(), '\n'));
|
||||
}
|
||||
} // namespace utility
|
||||
} // namespace sourcetrail
|
||||
|
||||
@@ -17,7 +17,7 @@ target_include_directories(${EXAMPLE_NAME} PUBLIC
|
||||
"${CORE_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
target_link_libraries(${EXAMPLE_NAME} ${LIB_CORE_TARGET_NAME} "-ldl")
|
||||
target_link_libraries(${EXAMPLE_NAME} ${LIB_CORE_TARGET_NAME} ${CMAKE_DL_LIBS})
|
||||
|
||||
|
||||
# --- Configure Sourcetrail Project File ---
|
||||
|
||||
@@ -28,6 +28,7 @@ int main(int argc, const char *argv[])
|
||||
if (argc < 3 || argc > 4)
|
||||
{
|
||||
std::cout << "usage: cpp_api_example <database_path> <source_path> <optional:database_version>";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string dbPath = argv[1];
|
||||
|
||||
@@ -17,7 +17,7 @@ target_include_directories(${EXAMPLE_NAME} PUBLIC
|
||||
"${CORE_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
target_link_libraries(${EXAMPLE_NAME} ${LIB_CORE_TARGET_NAME} "-ldl")
|
||||
target_link_libraries(${EXAMPLE_NAME} ${LIB_CORE_TARGET_NAME} ${CMAKE_DL_LIBS})
|
||||
|
||||
|
||||
# --- Configure Sourcetrail Project File ---
|
||||
|
||||
@@ -33,6 +33,7 @@ int main(int argc, const char *argv[])
|
||||
if (argc < 3 || argc > 4)
|
||||
{
|
||||
std::cout << "usage: poetry_indexer <database_path> <source_path> <optional:database_version>";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string dbPath = argv[1];
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
v4.db25.p0
|
||||
v4.db25.p1
|
||||
|
||||
Reference in New Issue
Block a user