Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7271e30434 | ||
|
|
a014f9f7a6 | ||
|
|
ef24f528c3 | ||
|
|
464ed518d8 | ||
|
|
850be396aa | ||
|
|
2e9422a8cf | ||
|
|
bb5372efce | ||
|
|
251eab6e9e | ||
|
|
d2de395ed5 | ||
|
|
eb621eea33 | ||
|
|
ad719aeaa8 | ||
|
|
ebdc2d3382 | ||
|
|
d4131ce92c | ||
|
|
0143268f90 | ||
|
|
d9c9e4b3eb | ||
|
|
9701332fd0 | ||
|
|
4bac37096a | ||
|
|
d3b10bc5fd | ||
|
|
00980f73af | ||
|
|
892df2abac | ||
|
|
ca0a1ffb89 | ||
|
|
401c23f572 | ||
|
|
55ae17af29 | ||
|
|
f719212678 | ||
|
|
d25bba4b59 | ||
|
|
0268e924aa | ||
|
|
520a1b2d48 | ||
|
|
a15dccb219 | ||
|
|
2fa75f46cd | ||
|
|
bff9430fa2 | ||
|
|
03bbce45c9 | ||
|
|
cc8ea7c8fb | ||
|
|
8dfc1ea9d9 | ||
|
|
01f740276b | ||
|
|
994a749b80 | ||
|
|
2c90b75a9f | ||
|
|
377f0ef34f | ||
|
|
0ad7585811 | ||
|
|
a1277a92f4 | ||
|
|
c3355f3c1a | ||
|
|
274eca0e5d | ||
|
|
858364b385 | ||
|
|
98eb3f124d | ||
|
|
c43e074c9e | ||
|
|
e508741c9a | ||
|
|
9255d45b94 | ||
|
|
c269493942 | ||
|
|
3d40f4ed4e | ||
|
|
a3001b2b72 | ||
|
|
566cface6c | ||
|
|
783e0ac060 | ||
|
|
77848a3d67 | ||
|
|
ae5a6a5d46 | ||
|
|
5c0ed7f7f2 | ||
|
|
279fc7ae82 | ||
|
|
8776a8e285 | ||
|
|
c6a6e6d028 | ||
|
|
c847fba568 | ||
|
|
6b51c7cfe4 | ||
|
|
2800c072ff | ||
|
|
d0cf500c8e | ||
|
|
9cda1e773d | ||
|
|
b9f518feed | ||
|
|
d0a063a3b6 | ||
|
|
210c5b1245 | ||
|
|
d36a0fc07a | ||
|
|
17fece804b | ||
|
|
fae418897c | ||
|
|
7616e07eeb | ||
|
|
3c88998c10 | ||
|
|
f7de8d017a | ||
|
|
19d6ca3079 | ||
|
|
b072972b50 | ||
|
|
05c06a6102 | ||
|
|
66e48d5608 | ||
|
|
b32836c58f | ||
|
|
f88cc16a36 | ||
|
|
d5e9cecef3 | ||
|
|
acaf58c3f8 | ||
|
|
2672299a58 | ||
|
|
f4677a902d | ||
|
|
b2cb95de1b | ||
|
|
6e9a6f9a8d | ||
|
|
cb869c2465 | ||
|
|
eb8808b624 | ||
|
|
f93b31a942 | ||
|
|
46be24ab26 | ||
|
|
11a1ccc822 | ||
|
|
ca31eda54e | ||
|
|
5813e3dcf8 | ||
|
|
255cb252d6 | ||
|
|
8b770b0c71 | ||
|
|
06255286ae | ||
|
|
8a13aebc3f | ||
|
|
5bfd0ecbbe | ||
|
|
e604c3b025 | ||
|
|
b683d7b2d6 | ||
|
|
dbcb8f449c | ||
|
|
592cc99cee | ||
|
|
4e18389d38 | ||
|
|
32f894422d | ||
|
|
b5d9d20bc9 | ||
|
|
cba0cfad65 | ||
|
|
ba3316008a | ||
|
|
8ca54f2091 | ||
|
|
2cf033d43a | ||
|
|
3430ed2a1b | ||
|
|
140d4a406a | ||
|
|
44cee3d130 | ||
|
|
5161455355 | ||
|
|
e7efff8843 | ||
|
|
7f867bf889 | ||
|
|
36c504d8a0 | ||
|
|
9560cc4ea6 | ||
|
|
6b31a43f75 | ||
|
|
b4c094e784 | ||
|
|
7227a47b49 | ||
|
|
0aa97adb17 | ||
|
|
247be13650 | ||
|
|
2b93bdc283 | ||
|
|
98b13ef24d | ||
|
|
b7ba10e119 | ||
|
|
253af27067 | ||
|
|
83e4bcd049 | ||
|
|
2125396665 | ||
|
|
1c0c2e78df | ||
|
|
b9c0f9ed3e | ||
|
|
72a48f997f | ||
|
|
986f67df8e | ||
|
|
208f2b1158 | ||
|
|
b07d03692d | ||
|
|
aae388d8ee | ||
|
|
b57171552f | ||
|
|
be3ba0ba23 | ||
|
|
19e26268cf | ||
|
|
77080464d7 | ||
|
|
594bb41a6f | ||
|
|
c5af4ed4e5 | ||
|
|
6821fd1c9a | ||
|
|
7e3b2622ec | ||
|
|
5173400b8d | ||
|
|
c6fa1f0969 | ||
|
|
b10c55e7f9 | ||
|
|
6edcd77eb2 | ||
|
|
53120cf270 | ||
|
|
468e55f078 | ||
|
|
ab43d309cb | ||
|
|
da01855b68 | ||
|
|
2660465b31 | ||
|
|
dfcb9214f4 | ||
|
|
d6e2c46420 | ||
|
|
8222729bb9 | ||
|
|
3f032ea822 | ||
|
|
5a6e042c8f | ||
|
|
5bb6902cdf | ||
|
|
71cf6bb5f4 | ||
|
|
f02169b08e | ||
|
|
4b734a05f9 | ||
|
|
6165d2fffa | ||
|
|
4e08d86602 | ||
|
|
d80a123a5a | ||
|
|
badad741b0 | ||
|
|
5d2a476813 | ||
|
|
4a6f8cf420 | ||
|
|
946be38fa2 | ||
|
|
86d1ff2905 | ||
|
|
5295267513 | ||
|
|
2f25279662 | ||
|
|
e943ef149e | ||
|
|
e40459e71d | ||
|
|
cb9dde6641 | ||
|
|
4097493181 | ||
|
|
9f80bcbcb7 | ||
|
|
79f788db2e | ||
|
|
67e4d84631 | ||
|
|
7bb40f2630 | ||
|
|
c61efbbcde | ||
|
|
245cafdc7b | ||
|
|
6a576bccc9 | ||
|
|
2a73c42a18 | ||
|
|
9148a4fafb | ||
|
|
c4ef18fb6d | ||
|
|
e775ae1ecd | ||
|
|
30faa7e52f | ||
|
|
75ced4b775 | ||
|
|
8ef6d77c50 | ||
|
|
bdf713f078 | ||
|
|
999522ca20 | ||
|
|
000938cf8c | ||
|
|
3ef9db3a84 | ||
|
|
3d2d434125 | ||
|
|
9a92422984 | ||
|
|
32dc545a60 | ||
|
|
bfb6b458b3 | ||
|
|
fd905f76e5 | ||
|
|
279f7410d3 | ||
|
|
4063afb3b0 | ||
|
|
038991ce39 | ||
|
|
c3a148833b | ||
|
|
f9aed67776 | ||
|
|
e17c42b2ef | ||
|
|
932ef67fc7 | ||
|
|
e86479be20 | ||
|
|
4b4d2157eb | ||
|
|
69925917bc | ||
|
|
55660563c8 | ||
|
|
6bca5d2964 | ||
|
|
6be207a68a | ||
|
|
a6e57a6564 | ||
|
|
73973cb4a3 | ||
|
|
3e90b62c82 | ||
|
|
1b23a44f20 | ||
|
|
780530ba3c | ||
|
|
96ec7e9fa3 | ||
|
|
013d528c6b | ||
|
|
526f966356 | ||
|
|
b5bcabb494 | ||
|
|
3fe3bcb25d | ||
|
|
2417d27069 | ||
|
|
5c52bc6060 | ||
|
|
19d91da108 | ||
|
|
4ec89e71ca | ||
|
|
36d17123f3 | ||
|
|
40144bbcb9 | ||
|
|
03675e1658 | ||
|
|
1bf721588b | ||
|
|
c380854b34 | ||
|
|
3ee5f261d6 | ||
|
|
1a843db3b7 | ||
|
|
ea4acef2de | ||
|
|
ce5c3e8626 | ||
|
|
f19cdc3bb9 | ||
|
|
6069dfedc1 | ||
|
|
661dbd844c | ||
|
|
deccf2734c | ||
|
|
5cb06c9bb0 | ||
|
|
29ef349f61 | ||
|
|
5d71536bb1 | ||
|
|
7cd38f8e56 | ||
|
|
a57f24b2b2 | ||
|
|
c7940eb34f | ||
|
|
325bc6ac83 | ||
|
|
985be86da0 | ||
|
|
298fd6cf3e | ||
|
|
530e20ede6 | ||
|
|
3cb15f1754 | ||
|
|
e68177b634 | ||
|
|
637cbf88ac | ||
|
|
73ee3a27d9 | ||
|
|
a2cba0b94f | ||
|
|
9534ccb454 | ||
|
|
23fbe6c384 | ||
|
|
bee3961040 | ||
|
|
8d2709a2ad | ||
|
|
ad8abd9182 | ||
|
|
fcc39f4a77 | ||
|
|
4eef42d15c | ||
|
|
b088ca6adf | ||
|
|
b9c4bd05cd | ||
|
|
a448485b35 | ||
|
|
9307d6d855 | ||
|
|
e8e6b909a8 | ||
|
|
78287dd694 | ||
|
|
ae6cd6e02c | ||
|
|
7a0cd0c8d7 | ||
|
|
7bc2f2b548 | ||
|
|
73e77a1baa | ||
|
|
5e6714d95a | ||
|
|
93f21283f6 | ||
|
|
2ffec90c19 | ||
|
|
f3dc12b0ed | ||
|
|
ffc00829f0 | ||
|
|
e5bf177241 | ||
|
|
31f366ab8f | ||
|
|
2be3b541a6 | ||
|
|
03901e8173 | ||
|
|
fe74dfb7cc | ||
|
|
b75dd2abe1 | ||
|
|
cec370cfff | ||
|
|
a662424e2b | ||
|
|
ac506622b4 | ||
|
|
880a199540 | ||
|
|
82db193c78 | ||
|
|
bac394381c | ||
|
|
fee1d97604 | ||
|
|
d1a4bc7b08 | ||
|
|
6743336f03 |
@@ -5,6 +5,7 @@
|
||||
/bin/app/Debug/
|
||||
/bin/app/Release/
|
||||
/bin/app/data/projects/ignored/
|
||||
/bin/app/data/java/
|
||||
/bin/app/user/log/
|
||||
/bin/app/user/ApplicationSettings.xml
|
||||
/bin/app/user/window_settings.ini
|
||||
@@ -23,7 +24,10 @@
|
||||
/bin/test/data/temp.xml
|
||||
/bin/test/data/TestSettings.xml
|
||||
|
||||
/setup/Linux/lib/*
|
||||
/java_indexer/bin/
|
||||
/java_indexer/lib/
|
||||
|
||||
/setup/Linux/lib/
|
||||
|
||||
.DS_Store
|
||||
.idea
|
||||
@@ -40,7 +44,10 @@
|
||||
.clang_complete
|
||||
.ycm_extra_conf.py
|
||||
.ycm_extra_conf.pyc
|
||||
coati.coatiproject
|
||||
compile_commands.json
|
||||
Makefile
|
||||
/__pycache__/
|
||||
|
||||
/deployment/windows/CoatiAppSetup/CoatiSetup/Debug
|
||||
/deployment/windows/CoatiAppSetup/CoatiSetup/Release
|
||||
@@ -64,3 +71,4 @@ compile_commands.json
|
||||
/deployment/windows/CoatiTrialSetup/SetupRemoveCacheFiles/bin/
|
||||
/deployment/windows/CoatiTrialSetup/SetupRemoveCacheFiles/obj/
|
||||
|
||||
/deployment/windows/wixSetup/
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
|
||||
# to get CMP0043 warnings, upgrade to version 3 and change the line above to VERSION 3.0 and remove the line below
|
||||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0043 OLD)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
include(cmake/add_files.cmake)
|
||||
include(cmake/create_source_groups.cmake)
|
||||
@@ -11,8 +6,6 @@ include(cmake/version.cmake)
|
||||
include(cmake/version_setup.cmake)
|
||||
include(cmake/licenses.cmake)
|
||||
|
||||
# set Standerd build type to Release
|
||||
set(CMAKE_BUILD_TYPE_INIT "Release")
|
||||
|
||||
# Variables --------------------------------------------------------------------
|
||||
|
||||
@@ -36,26 +29,35 @@ else ()
|
||||
set(PLATFORM_INCLUDE "includesLinux.h")
|
||||
endif ()
|
||||
|
||||
# Settings ---------------------------------------------------------------------
|
||||
|
||||
if (UNIX)
|
||||
add_definitions(-std=c++11 -Wno-unknown-warning-option -fcolor-diagnostics -DQT_COMPILING_QSTRING_COMPAT_CPP )
|
||||
endif ()
|
||||
|
||||
# Project ----------------------------------------------------------------------
|
||||
|
||||
project(${PROJECT_NAME})
|
||||
|
||||
# set Standard build type to Release
|
||||
set(CMAKE_BUILD_TYPE_INIT "Release")
|
||||
|
||||
#RPATH
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib/:$$ORIGIN/lib/")
|
||||
include(cmake/external.cmake)
|
||||
include(cmake/external.cmake)
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
# Settings ---------------------------------------------------------------------
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -fcolor-diagnostics")
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
#add_definitions(-std=c++11 -Wno-unknown-warning-option -fcolor-diagnostics -DQT_COMPILING_QSTRING_COMPAT_CPP )
|
||||
add_definitions(-fno-omit-frame-pointer -DQT_COMPILING_QSTRING_COMPAT_CPP )
|
||||
endif ()
|
||||
|
||||
# Clang ------------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +68,7 @@ if (UNIX AND APPLE)
|
||||
find_package(LLVM REQUIRED PATHS "$ENV{CLANG_DIR}/build_debug/share/llvm/cmake" NO_DEFAULT_PATH)
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
find_package(LLVM REQUIRED PATHS "${EXTERNAL_BUILD}/llvm/share/llvm/cmake" NO_DEFAULT_PATH)
|
||||
find_package(LLVM REQUIRED PATHS "${EXTERNAL_BUILD}/llvm/share/llvm/cmake" NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_package(LLVM REQUIRED PATHS "$ENV{CLANG_DIR}/build/share/llvm/cmake")
|
||||
endif()
|
||||
@@ -78,9 +80,9 @@ add_definitions(${CLANG_DEFINITIONS})
|
||||
# Boost ------------------------------------------------------------------------
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(BOOST_ROOT ${EXTERNAL_BUILD}/boost)
|
||||
set(BOOST_ROOT ${EXTERNAL_BUILD}/boost)
|
||||
else()
|
||||
set(BOOST_ROOT $ENV{BOOST_159_DIR})
|
||||
set(BOOST_ROOT $ENV{BOOST_159_DIR})
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREAD ON)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
@@ -94,9 +96,9 @@ find_package(Boost 1.59 COMPONENTS system program_options filesystem date_time R
|
||||
|
||||
add_definitions(-DEIGEN_MPL2_ONLY)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(EIGEN_ROOT ${EXTERNAL_SRC}/eigen)
|
||||
set(EIGEN_ROOT ${EXTERNAL_SRC}/eigen)
|
||||
else()
|
||||
set(EIGEN_ROOT $ENV{EIGEN_DIR})
|
||||
set(EIGEN_ROOT $ENV{EIGEN_DIR})
|
||||
endif()
|
||||
|
||||
# Botan -------------------------------------------------------------------------
|
||||
@@ -104,104 +106,25 @@ endif()
|
||||
set(BOTAN_VERSION "botan-1.11")
|
||||
|
||||
if(UNIX AND APPLE)
|
||||
find_library(BOTAN ${BOTAN_VERSION} $ENV{BOTAN_DIR}/release NO_DEFAULT_PATH)
|
||||
find_library(BOTAN_D ${BOTAN_VERSION} $ENV{BOTAN_DIR}/debug NO_DEFAULT_PATH)
|
||||
find_library(BOTAN ${BOTAN_VERSION} $ENV{BOTAN_DIR}/release NO_DEFAULT_PATH)
|
||||
find_library(BOTAN_D ${BOTAN_VERSION} $ENV{BOTAN_DIR}/debug NO_DEFAULT_PATH)
|
||||
elseif(UNIX)
|
||||
find_library(BOTAN ${BOTAN_VERSION} "${EXTERNAL_BUILD}/botan" NO_DEFAULT_PATH)
|
||||
find_library(BOTAN ${BOTAN_VERSION} "${EXTERNAL_BUILD}/botan" NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(BOTAN botan "$ENV{BOTAN_DIR}/release")
|
||||
find_library(BOTAN botan "$ENV{BOTAN_DIR}/release")
|
||||
find_library(BOTAN_D botan "$ENV{BOTAN_DIR}/debug")
|
||||
endif()
|
||||
if(${BOTAN} STREQUAL "BOTAN-NOTFOUND")
|
||||
message(FATAL_ERROR "Botan not found")
|
||||
message(FATAL_ERROR "Botan not found")
|
||||
else()
|
||||
message(STATUS "Botan found")
|
||||
message(STATUS "Botan found")
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(BOTAN_INCLUDE_DIR "${EXTERNAL_BUILD}/botan")
|
||||
set(BOTAN_INCLUDE_DIR "${EXTERNAL_BUILD}/botan")
|
||||
else()
|
||||
set(BOTAN_INCLUDE_DIR "$ENV{BOTAN_DIR}")
|
||||
set(BOTAN_INCLUDE_DIR "$ENV{BOTAN_DIR}")
|
||||
endif()
|
||||
|
||||
# Lib --------------------------------------------------------------------------
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib)
|
||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib)
|
||||
|
||||
add_subdirectory(src/lib)
|
||||
add_subdirectory(src/external)
|
||||
|
||||
set_source_files_properties(${EXTERNAL_FILES} PROPERTIES COMPILE_FLAGS "-w")
|
||||
set_source_files_properties(${EXTERNAL_C_FILES} PROPERTIES COMPILE_FLAGS "-std=gnu89 -w")
|
||||
|
||||
add_library(${LIB_PROJECT_NAME} ${LIB_FILES} ${EXTERNAL_FILES} ${EXTERNAL_C_FILES})
|
||||
|
||||
create_source_groups(${LIB_FILES})
|
||||
create_source_groups(${EXTERNAL_FILES})
|
||||
create_source_groups(${EXTERNAL_C_FILES})
|
||||
|
||||
set_target_properties(
|
||||
${LIB_PROJECT_NAME}
|
||||
PROPERTIES
|
||||
DEBUG_OUTPUT_NAME ${PROJECT_NAME}_d
|
||||
RELEASE_OUTPUT_NAME ${PROJECT_NAME}
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET ${LIB_PROJECT_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_PROJECT_NAME} SYSTEM
|
||||
PUBLIC ${LLVM_INCLUDE_DIRS}
|
||||
${CLANG_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${EIGEN_ROOT}
|
||||
"${CMAKE_SOURCE_DIR}/src/external"
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_PROJECT_NAME} ${Boost_LIBRARIES})
|
||||
|
||||
# Lib Parser -------------------------------------------------------------------
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser)
|
||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser)
|
||||
|
||||
add_subdirectory(src/lib_parser)
|
||||
|
||||
set_source_files_properties(${CLANG_FILES} PROPERTIES COMPILE_FLAGS "-fno-rtti")
|
||||
|
||||
add_library(${LIB_PARSER_PROJECT_NAME} ${CLANG_FILES})
|
||||
|
||||
create_source_groups(${CLANG_FILES})
|
||||
|
||||
set_property(
|
||||
TARGET ${LIB_PARSER_PROJECT_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_parser"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
${LIB_PARSER_PROJECT_NAME}
|
||||
PROPERTIES
|
||||
DEBUG_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}_d
|
||||
RELEASE_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_PARSER_PROJECT_NAME} SYSTEM
|
||||
PUBLIC ${LLVM_INCLUDE_DIRS}
|
||||
${CLANG_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
|
||||
llvm_map_components_to_libnames(REQ_LLVM_LIBS support core libdriver)
|
||||
|
||||
#target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${LLVM_AVAILABLE_LIBS})
|
||||
target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${REQ_LLVM_LIBS})
|
||||
|
||||
# Lib License -------------------------------------------------------------------
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_license)
|
||||
@@ -230,7 +153,7 @@ target_include_directories(${LIB_LICENSE_PROJECT_NAME} SYSTEM
|
||||
PUBLIC
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${LIB_LICENSE_PROJECT_NAME}
|
||||
${BOTAN_INCLUDE_DIR}
|
||||
${BOTAN_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# target_include_directories(${LIB_LICENSE_PROJECT_NAME} optimized "$ENV{BOTAN_DIR}/release")
|
||||
@@ -246,6 +169,91 @@ else()
|
||||
target_link_libraries(${LIB_LICENSE_PROJECT_NAME} optimized ${BOTAN})
|
||||
endif()
|
||||
|
||||
# Lib --------------------------------------------------------------------------
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib)
|
||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib)
|
||||
|
||||
find_package(JNI)
|
||||
|
||||
add_subdirectory(src/lib)
|
||||
add_subdirectory(src/external)
|
||||
|
||||
set_source_files_properties(${EXTERNAL_FILES} PROPERTIES COMPILE_FLAGS "-w")
|
||||
set_source_files_properties(${EXTERNAL_C_FILES} PROPERTIES COMPILE_FLAGS "-std=gnu89 -w")
|
||||
|
||||
add_library(${LIB_PROJECT_NAME} ${LIB_FILES} ${EXTERNAL_FILES} ${EXTERNAL_C_FILES})
|
||||
|
||||
create_source_groups(${LIB_FILES})
|
||||
create_source_groups(${EXTERNAL_FILES})
|
||||
create_source_groups(${EXTERNAL_C_FILES})
|
||||
|
||||
set_target_properties(
|
||||
${LIB_PROJECT_NAME}
|
||||
PROPERTIES
|
||||
DEBUG_OUTPUT_NAME ${PROJECT_NAME}_d
|
||||
RELEASE_OUTPUT_NAME ${PROJECT_NAME}
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET ${LIB_PROJECT_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_license"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/lib_license"
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_PROJECT_NAME} SYSTEM
|
||||
PUBLIC ${LLVM_INCLUDE_DIRS}
|
||||
${CLANG_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${EIGEN_ROOT}
|
||||
${JNI_INCLUDE_DIRS}
|
||||
"${CMAKE_SOURCE_DIR}/src/external"
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_PROJECT_NAME} ${Boost_LIBRARIES} ${LIB_LICENSE_PROJECT_NAME})
|
||||
|
||||
|
||||
# Lib Parser -------------------------------------------------------------------
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser)
|
||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser)
|
||||
|
||||
add_subdirectory(src/lib_parser)
|
||||
|
||||
set_source_files_properties(${CLANG_FILES} PROPERTIES COMPILE_FLAGS "-fno-rtti")
|
||||
|
||||
add_library(${LIB_PARSER_PROJECT_NAME} ${CLANG_FILES})
|
||||
|
||||
create_source_groups(${CLANG_FILES})
|
||||
|
||||
set_property(
|
||||
TARGET ${LIB_PARSER_PROJECT_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_parser"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
${LIB_PARSER_PROJECT_NAME}
|
||||
PROPERTIES
|
||||
DEBUG_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}_d
|
||||
RELEASE_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_PARSER_PROJECT_NAME} SYSTEM
|
||||
PUBLIC ${LLVM_INCLUDE_DIRS}
|
||||
${CLANG_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${JNI_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
|
||||
llvm_map_components_to_libnames(REQ_LLVM_LIBS support core libdriver)
|
||||
|
||||
target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${REQ_LLVM_LIBS})
|
||||
|
||||
# Lib Gui ----------------------------------------------------------------------
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_gui)
|
||||
@@ -260,14 +268,14 @@ set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# Find the QtWidgets library
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CMAKE_PREFIX_PATH ${EXTERNAL_BUILD}/qt)
|
||||
set(CMAKE_PREFIX_PATH ${EXTERNAL_BUILD}/qt)
|
||||
else()
|
||||
set(CMAKE_PREFIX_PATH "$ENV{QT_DIR}/")
|
||||
set(CMAKE_PREFIX_PATH "$ENV{QT_DIR}/")
|
||||
endif()
|
||||
|
||||
if(UNIX AND APPLE)
|
||||
set(Qt5Widgets_DIR "$ENV{QT_DIR}/cmake/Qt5Widgets/")
|
||||
set(Qt5PrintSupport_DIR "$ENV{QT_DIR}/cmake/Qt5PrintSupport/")
|
||||
set(Qt5Widgets_DIR "$ENV{QT_DIR}/cmake/Qt5Widgets/")
|
||||
set(Qt5PrintSupport_DIR "$ENV{QT_DIR}/cmake/Qt5PrintSupport/")
|
||||
endif()
|
||||
|
||||
find_package(Qt5Widgets)
|
||||
@@ -275,11 +283,11 @@ find_package(Qt5PrintSupport)
|
||||
find_package(Qt5Network)
|
||||
|
||||
if(Qt5Widgets_FOUND)
|
||||
MESSAGE(STATUS "Found Qt ${Qt5Widgets_VERSION_STRING}")
|
||||
# FIX: Qt was built with -reduce-relocations
|
||||
if (Qt5_POSITION_INDEPENDENT_CODE)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
MESSAGE(STATUS "Found Qt ${Qt5Widgets_VERSION_STRING}")
|
||||
# FIX: Qt was built with -reduce-relocations
|
||||
if (Qt5_POSITION_INDEPENDENT_CODE)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# target for running versionnumber script
|
||||
@@ -297,7 +305,7 @@ add_custom_command(
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/version.cmake
|
||||
BYPRODUCTS ${PROJECT_SOURCE_DIR}/build/src/lib_gui/version.h
|
||||
DEPENDS ${LIB_GUI_PROJECT_NAME}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "check/update version number"
|
||||
)
|
||||
add_dependencies(${LIB_GUI_PROJECT_NAME} versionnumber)
|
||||
@@ -311,6 +319,7 @@ set_property(
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_gui"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_license"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/lib_license"
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
@@ -339,8 +348,8 @@ configure_file(
|
||||
|
||||
#configure the versioning file
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/version.h.in
|
||||
${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h
|
||||
${CMAKE_SOURCE_DIR}/cmake/version.h.in
|
||||
${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h
|
||||
)
|
||||
|
||||
# configure public key for the coati version
|
||||
@@ -368,7 +377,7 @@ if (WIN32)
|
||||
"IDI_ICON1 ICON \"${CMAKE_SOURCE_DIR}/build/coati.ico\"\n"
|
||||
)
|
||||
|
||||
add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${CLANG_FILES} ${GEN_FILES} ${CMAKE_SOURCE_DIR}/build/Coati.rc ${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h)
|
||||
add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${CLANG_FILES} ${GEN_FILES} ${CMAKE_SOURCE_DIR}/build/Coati.rc)
|
||||
|
||||
# hide the console when running a release build.
|
||||
set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
||||
@@ -378,13 +387,14 @@ if (WIN32)
|
||||
set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "/ENTRY:\"mainCRTStartup\" /SUBSYSTEM:WINDOWS")
|
||||
set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
||||
else ()
|
||||
add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${GEN_FILES} ${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h)
|
||||
add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${GEN_FILES})
|
||||
endif ()
|
||||
|
||||
create_source_groups(${APP_FILES})
|
||||
|
||||
target_link_libraries(${APP_PROJECT_NAME} ${LIB_GUI_PROJECT_NAME} ${LIB_PARSER_PROJECT_NAME} ${LIB_PROJECT_NAME} ${LIB_LICENSE_PROJECT_NAME})
|
||||
|
||||
|
||||
set_property(
|
||||
TARGET ${APP_PROJECT_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
@@ -394,6 +404,7 @@ set_property(
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_license"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_parser"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/lib_gui"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/lib_license"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/app"
|
||||
)
|
||||
|
||||
@@ -449,6 +460,7 @@ create_source_groups(${TRIAL_FILES})
|
||||
|
||||
target_link_libraries(${TRIAL_PROJECT_NAME} ${LIB_GUI_PROJECT_NAME} ${LIB_PROJECT_NAME} ${LIB_LICENSE_PROJECT_NAME} )
|
||||
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(${TRIAL_PROJECT_NAME} pthread dl rt)
|
||||
endif()
|
||||
@@ -460,6 +472,7 @@ set_property(
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_gui"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/lib_gui"
|
||||
"${CMAKE_SOURCE_DIR}/build/src/lib_license"
|
||||
)
|
||||
|
||||
target_include_directories(${TRIAL_PROJECT_NAME} SYSTEM
|
||||
@@ -568,9 +581,9 @@ endif ()
|
||||
add_subdirectory(src/test)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CXXTEST_INCLUDE_DIR ${EXTERNAL_SRC}/cxxtest)
|
||||
set(CXXTEST_INCLUDE_DIR ${EXTERNAL_SRC}/cxxtest)
|
||||
else()
|
||||
set(CXXTEST_INCLUDE_DIR $ENV{CXX_TEST_DIR})
|
||||
set(CXXTEST_INCLUDE_DIR $ENV{CXX_TEST_DIR})
|
||||
endif()
|
||||
set(CXXTEST_PYTHON_TESTGEN_EXECUTABLE ${CXXTEST_INCLUDE_DIR}/bin/cxxtestgen)
|
||||
set(TESTGEN_FILE ${CMAKE_CURRENT_BINARY_DIR}/test_main.cpp)
|
||||
@@ -618,6 +631,7 @@ elseif (UNIX)
|
||||
add_custom_command(
|
||||
OUTPUT ${TESTGEN_FILE}
|
||||
PRE_BUILD
|
||||
COMMAND rm -f ${TESTGEN_FILE}
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR} && ${PYTHON_EXECUTABLE} ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --runner=ParenPrinter -o ${TESTGEN_FILE} ${TEST_FILES}
|
||||
COMMENT "Generating unittest code with cxxtestgen"
|
||||
)
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
### Masterproject
|
||||
## Coati
|
||||
|
||||
#### Setup
|
||||
### Setup
|
||||
|
||||
##### External Software
|
||||
#### External Software
|
||||
|
||||
* QT 5.5
|
||||
* QT 5.6
|
||||
* CxxTest 4.3
|
||||
* Valgrind 3.9.0 (linux)
|
||||
* Clang & LLVM (doesnt quite work for windows, use unix setup below and skip all the ninja stuff)(installation guide http://clang.llvm.org/docs/LibASTMatchersTutorial.html)
|
||||
* Clang & LLVM 3.8 (doesnt quite work for windows, use unix setup below and skip all the ninja stuff)(installation guide http://clang.llvm.org/docs/LibASTMatchersTutorial.html)
|
||||
* Boost 1.59
|
||||
* Eigen 3.2.6
|
||||
* Botan 1.11.24
|
||||
|
||||
##### Environment Variables
|
||||
#### Environment Variables
|
||||
|
||||
* QT_DIR - ...\Qt\Qt5.2.1\5.2.1\<IDE>\
|
||||
* CXX_TEST_DIR - .../cxxtest-4.3/
|
||||
* CLANG_DIR - .../clang-llvm/
|
||||
* QT_DIR - .../Qt/Qt5.6.0/5.6/<IDE>
|
||||
* CXX_TEST_DIR - .../cxxtest-4.3
|
||||
* CLANG_DIR - .../clang-llvm
|
||||
* BOOST_159_DIR - .../boost_1_59_0
|
||||
* EIGEN_DIR - .../eigen
|
||||
* BOTAN_DIR - .../Botan-1.11.24
|
||||
@@ -25,7 +25,7 @@ For Win32:
|
||||
* VLD_DIR - .../Visual Leak Detector
|
||||
* path - apped path to git.exe
|
||||
|
||||
###### Botan setup
|
||||
##### Botan setup
|
||||
|
||||
Build release lib in ${BOTAN_DIR}/release
|
||||
Build debug lib in ${BOTAN_DIR}/debug
|
||||
@@ -39,30 +39,30 @@ python configure.py --cc=msvc --cpu=x86_32 --via-amalgamation --disable-shared -
|
||||
for other:
|
||||
$ python configure.py --via-amalgamation --disable-shared
|
||||
|
||||
##### Settings
|
||||
#### Settings
|
||||
|
||||
Run setup script:
|
||||
$ ./script/setup.sh
|
||||
|
||||
#### Release
|
||||
### Release
|
||||
|
||||
##### App
|
||||
#### App
|
||||
* create release build
|
||||
* make sure it uses the Coati icon
|
||||
* obfuscate the executable using upx
|
||||
|
||||
##### Data folder
|
||||
#### Data folder
|
||||
* put data folder in working directory
|
||||
* add empty log folder
|
||||
* add working tictactoe.xml project to /projects/tictactoe with sources in /projects/tictactoe/src
|
||||
* add empty app settings with one recent project tictactoe.xml
|
||||
* leave window_settings.ini with correct Coati start layout
|
||||
|
||||
##### Package
|
||||
#### Package
|
||||
* add app
|
||||
* add web/coati_manual.pdf to package
|
||||
|
||||
##### Updating Clang on UNIX
|
||||
#### Updating Clang on UNIX
|
||||
|
||||
$ cd .../clang_llvm
|
||||
|
||||
@@ -83,130 +83,301 @@ $ cd ../release_build
|
||||
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ../llvm
|
||||
$ ninja -j4 check-all
|
||||
|
||||
##### Remarks
|
||||
#### Remarks
|
||||
|
||||
* Boost lib dir: rename library directory for your system (e.g.: 'lib32-msvc-12.0') to 'lib'
|
||||
|
||||
#### Tagging
|
||||
### Tagging
|
||||
|
||||
$ git tag -a VERSION_NUMBER -m "DESCRIPTION"
|
||||
$ git push --tags
|
||||
|
||||
#### Changelog
|
||||
### Loader gif creation from png sequence
|
||||
|
||||
##### 0.3.0
|
||||
// from png sequence
|
||||
convert -delay 3 -loop 0 coati_*.png coati.gif
|
||||
|
||||
* Added Tutorial project
|
||||
* Added communication interface from and to Coati via TCP sockets
|
||||
* Added plugin for Visual Studio (2012, 2013, 2015)
|
||||
* Added plugin for Sublime Text (2 & 3)
|
||||
* Increased autocompletion performance by caching and limiting results to 100
|
||||
* Save Coati version to sqlite and reparse project whenever the version changes
|
||||
* Improved source locations of template scopes
|
||||
* Fixed horizontal scroll in code view not activated while scrolling vertically
|
||||
* Save errors to storage and reactivate them via button in the status bar
|
||||
* Save macro scopes
|
||||
* Fixed old data was still in new project window when creating another project
|
||||
* Save comment locations and display them when right next to active symbol
|
||||
* Reworked code view highlighting
|
||||
* Fixed cursor was jumping at end of query when editing a search query
|
||||
* Fixed search query disappeared when not token was found for it
|
||||
* Improved code view auto scroll to center the first active line in the middle
|
||||
* Focus all overlapping source locations in the code view
|
||||
* Added recent projects menu option
|
||||
* Saving all template arguments type uses
|
||||
// less colors
|
||||
gifsicle --colors 255 coati.gif > color.gif
|
||||
|
||||
##### 0.4.0
|
||||
// crop size
|
||||
gifsicle --crop 0,5+0x-5 color.gif > crop.gif
|
||||
|
||||
* Network ports for IDE communication can be defined in the ApplicationSettings.xml
|
||||
* Coati can now handle inclass initialization of members
|
||||
* Improved handling of template arguments in analysis
|
||||
* Coati now handles anonymous symbols when parsing files
|
||||
* Extended color schemes to allow more extensive use in the graph
|
||||
* Added new color scheme called "bad_rainbow"
|
||||
* Coati shows a template's general definition when an implicit specialization is activated
|
||||
* Fixed source locations of many declarations
|
||||
* Fixed syntax highlighting to correctly identify strings, comments and block comments
|
||||
* Added analysis for template parameter packs
|
||||
* Show function and method signature in tooltip when hovering the graph node
|
||||
* Fixed graph font size was too small for Windows and Linux
|
||||
* Removed Coati directory from Linux package
|
||||
* Introduced file endings .coatiproject and .coatidb for Coati's project files
|
||||
* Added installer for Windows
|
||||
* Installing prerequisits in Windows Installer
|
||||
* Redesigned the about window
|
||||
* Parse errors will be displayed as they appear during analysis
|
||||
* Fixed constructors and destructors using return type 'void' withou source location
|
||||
* Removed 'close window' action from menu
|
||||
* Added help texts to project setup and preferences window
|
||||
* Improved lambda handling in analysis
|
||||
* Fixed style of function or method nodes with children
|
||||
* Fixed tooltip colors in dark color scheme
|
||||
* renamed undo&redo to back&forward
|
||||
* navigate back&forward via mouse buttons
|
||||
* navigate back via backspace key
|
||||
// add transparency
|
||||
gifsicle --unoptimize --disposal=previous --transparent="#FFFFFF" crop.gif > trans.gif
|
||||
|
||||
##### 0.5.0.4
|
||||
// resize
|
||||
gifsicle --resize-height 18 trans.gif > loader.gif
|
||||
|
||||
* Added option to hide widget window title bars to View menu
|
||||
* Added C support
|
||||
* Added shortcuts for font size resetting to View menu
|
||||
* Fixed number postions in graph
|
||||
* Improved performance of token name saving
|
||||
* Added commandline option for project file
|
||||
* Fixed cursor changing for resize and text interactions
|
||||
* Added C and C++ standard setting to project
|
||||
* Refresh project editing settings
|
||||
* Added license key window and license checker
|
||||
* Added trial target without analysis
|
||||
* Added web documentation
|
||||
* Improved code view annotation painting performance
|
||||
* Update error count while analysis
|
||||
* Improved back & forward in code view
|
||||
* Return to last scroll position when going back in code view
|
||||
* Added .coatiproject file associations with icon for Mac and Windows
|
||||
* Display scope name at bottom of code snippet
|
||||
* Improved graph view node bundeling to bundle more
|
||||
* Improved log file names to be sorted chronologically
|
||||
* Added application move protection to reenter license key
|
||||
* Show overview on project open with node bundles per type
|
||||
* Added overview and error keywords to search view
|
||||
* Added project setup wizard for step-by-step project setup
|
||||
* Added Visual Studio solution parsing via project wizard or VS plugin
|
||||
* Improved style of ui windows
|
||||
* Save user data in ~/Library/Application Support/Coati on Mac
|
||||
* Improved analysis performance to take only 66% of the time
|
||||
* Improved logging to alternate between 2 files of 1000 lines to decrease logfile sizes
|
||||
* Improved painting of icons in graph to be smoother
|
||||
* Added link to documentation to Help menu
|
||||
* Fixed preferences not saved
|
||||
### Changelog
|
||||
|
||||
##### 0.5.1.21
|
||||
|
||||
* Added project setup for Compilation Databases
|
||||
* Improved analysis performance for large projects (10x as fast for 1.000.000 LoC)
|
||||
* Improved project load and code view performance
|
||||
* Added graph panning with WASD
|
||||
* Added graph zooming with Shift + mouse wheel or Shift + WS
|
||||
* Added file extension UI to advanced settings in project setup summary
|
||||
* Added compiler flags UI to advanced settings in project setup summary
|
||||
* Show fatal errors in UI that stopped analysis
|
||||
* Fixed linux package creating ~/.config if not there
|
||||
* Fixed project setup window sizes to adapt to content size
|
||||
* Fixed project paths are now saved relative if defined relative
|
||||
* Fixed crash when opening newer project with older version of Coati
|
||||
* Removed high traffic log messages
|
||||
* Show loader animation when loading project
|
||||
* Fixed expanding file with errors showed all locations in red
|
||||
* Fixed children on namespace activation were bundled
|
||||
* Fixed interrupting of analysis to show message in status bar
|
||||
* Disabled config file warnings
|
||||
* Added delay for changing fontsize via mouse wheel
|
||||
* Fixed Visual Studio plugin project loading
|
||||
* Improved context detection for template parameters
|
||||
* Fixed type references in headers saved multiple times
|
||||
* Prevent network message handling without valid license
|
||||
* Added font size limits
|
||||
* Center windows on top of main window
|
||||
* Fixed crash when accessing files without read permission
|
||||
#### 0.8.0
|
||||
released 2016-09-01
|
||||
|
||||
* Improved titles and help texts in project setup UI
|
||||
* Fixed error locations not saved with absolute file paths in Compilation Database projects
|
||||
* Added missing source files extensions setting to the Edit Project dialog #132
|
||||
* Changed default text colors to black in project setup UI #140
|
||||
* Added plugin ports settings to Preferences #145
|
||||
* Improved project state handling on refreshing
|
||||
* Added Java sample project JavaParser: http://javaparser.org/
|
||||
* Fixed regex for system includes used wrongly in syntax highlighter
|
||||
* Added setting to disable file and console logging, default is off #157
|
||||
* Added migrations between different ApplicationSettings versions
|
||||
* Added auto detection for Java library to Preferences
|
||||
* Removed auto refresh option from Search view
|
||||
* Added progress dialogs for indexing and block UI #143
|
||||
* Hide name qualifiers for graph nodes in Java projects
|
||||
* Added handling when java library not found
|
||||
* Added plain text editing dialog to path list boxes
|
||||
* Use language dependent symbol name delimiter in UI
|
||||
* Added scroll speed setting to preferences #112
|
||||
* Added Java project setup UI
|
||||
* Record start and end locations of scopes in Java
|
||||
* Display unresolved types names in Java as 'unresolved-type'
|
||||
* Cache stats for overview to speed up display
|
||||
* Fixed graph nodes to restore their expand state when going back #118
|
||||
* Added shortcuts for navigating to next and previous reference in code view
|
||||
* Pressing Tab in search completes up to next ::, Delete erases to last :: #133
|
||||
* Bundle anonymous namespaces separately in graph overview #126
|
||||
* Added 'Show Data Folder' and 'Show Log Folder' items to Help menu
|
||||
* Added new status bar loader gif with higher resolution
|
||||
* Record type aliases in C++
|
||||
* Added Java indexer
|
||||
* Changed public icon in graph and added default icon
|
||||
* Scroll to file location when finding no symbol at specified location from plugin message
|
||||
* Added shortcut for Preferences on Windows/Linux
|
||||
* Leave code view at original line when expanding scopes
|
||||
* Pan graph view to center on name of active symbol after activation
|
||||
* Moved color scheme selection to Preferences
|
||||
* Moved Preferences menu item to Edit menu on Windows/Linux #113
|
||||
* Added setting for hiding non-fatal errors in unindexed files to preferences, turned on by default
|
||||
* Fixed file out-of-date asterisk disappearing when showing snippets after minimize state
|
||||
* Implemented Atom plugin: https://github.com/CoatiSoftware/atom-coati
|
||||
* Implemented CLion/IntelliJ plugin: https://github.com/CoatiSoftware/idea-coati
|
||||
* Implemented Eclipse plugin: https://github.com/CoatiSoftware/eCoati
|
||||
* Implemented emacs plugin: https://github.com/CoatiSoftware/emacs-coati
|
||||
* Improved code view rendering times
|
||||
* Don't show implicit nodes in search auto completion list
|
||||
|
||||
|
||||
#### 0.7.0.22
|
||||
released 2016-07-07
|
||||
|
||||
* Fixed detected global header search paths lost correct order and caused problems with #include_next directives
|
||||
* Fixed MaxOSX build crashed on launch due to unknown command line option passed
|
||||
* Removed 'Save Project' and 'Save Project As' actions from menu
|
||||
* Fixed indexer getting stuck at 'building caches' when indexing is interrupted
|
||||
* Fixed database not properly closed when errors appeared during indexing
|
||||
* Fixed autocompletions popup flickering while typing
|
||||
* Added resize grip to bottom right corner of every dialog window
|
||||
* Fixed 'paths don't exist' dialog window getting too big with lots of paths shown
|
||||
* Added context menu with 'back' and 'forward' actions available in all views
|
||||
* Removed Clang compiler warnings from console output
|
||||
* Added handling of project specific VS macros to VS solution parser
|
||||
|
||||
#### 0.7.0.0
|
||||
released 2016-06-15
|
||||
|
||||
* Updated to clang 3.8
|
||||
* Fixed crash in search autocompletion retrieval due to edge case in sorting
|
||||
* Fixed size policies in code view to avoid global scrollbar
|
||||
* Added full text search via search field: ?<query> for case-insensitive search, ??<query> for case-sensitive search
|
||||
* Made initialization for full text search lazy: done on first full text search
|
||||
* Defined full text search color in all color schemes
|
||||
* Increased code view performance by caching file IDs and paths
|
||||
* Added multithreaded indexing. Number of threads can be set in the Preferences UI, default is 4
|
||||
* Reworked graph node bundling to only distinguish defined and undefined nodes in each bucket
|
||||
* Made graph node sorting alphabetical and put bundles at end
|
||||
* Changed code view snippet sorting to always show definition on top
|
||||
* Fixed local symbols were not available within lambdas
|
||||
* Added settings for font family, font size and tab with to Preferences UI
|
||||
* Fixed VS solution parser issue with internal macros
|
||||
* Removed header extensions, all included files within the project paths are now analyzed
|
||||
* Fixed crash in sqlite when symbol name has special characters
|
||||
* Improved code view performance by reducing amount of initially open code files
|
||||
* Improved graph view performance through faster data retrieval and smarter structures
|
||||
* Increased aggregation click speed with faster edge id retrieval
|
||||
* Fixed png color profiles to avoid console warning: "libpng warning: iCCP: known incorrect sRGB profile"
|
||||
* Fixed graph edge drawn wrong when leaving from child node of smaller node
|
||||
* Fixed Sublime Text Plugin issue with wrong encoding
|
||||
* Randomized source file order for multithreaded analysis to increase performance
|
||||
* Show name of removed symbol when going back after refreshing
|
||||
* Fixed macro definition not connected to file
|
||||
* Fixed macro use not found in #ifdef, #ifndef, defined() and some expand cases
|
||||
* Removed back and forward steps for some graph and code view manipulations
|
||||
* Fixed code view style broken on Mac due to change of working directory when analyzing compilation database
|
||||
* Added database optimization step after indexing to reduce database size by ~25%
|
||||
* Fixed artifacts after graph view change by clearing view
|
||||
* Fixed autocompletion list highlights at wrong location for long names
|
||||
* Allow files and directories to be excluded from analysis in advanced settings for project setup
|
||||
* Added Qt gif plugin to Mac Release so that loader gif in status bar is visible
|
||||
* Added link to download page to start screen to remind users of updating once in a while
|
||||
* Check if compilation database still exists before refreshing
|
||||
* Added separate step for defining project name, project location and compiliation database to project setup
|
||||
* Explain that the project stays up-to-date with the compilation databes on refresh in project setup UI
|
||||
* Disregard source extensions when loading from compilation database
|
||||
* Removed error logs in name resolver
|
||||
* Added plugin for VIM: https://github.com/CoatiSoftware/vim-coati
|
||||
|
||||
#### 0.6.0.0
|
||||
released 2016-04-27
|
||||
|
||||
* Smoother graph panning and zooming on keyboard using update loop
|
||||
* Differentiate between explicit and implicit nodes and only show implicit nodes in the graph view when connected
|
||||
* Improved file clearing performance on project refresh
|
||||
* Show deleted projects on the start screen and show messagebox to delete them
|
||||
* Show analysis duration in hh:mm:ss
|
||||
* Added suppport for temporary test licenses and show error message when it expired
|
||||
* Increased graph performance by reducing to fixed number of requests
|
||||
* Add vs-clang compatibility flags when creating project from Visual Studio solution
|
||||
* Increased graph edge drawing performance
|
||||
* Added auto detection for system header paths to project wizard and preferences when using gcc, clang or vs compilers
|
||||
* Added bug tracker to help menu
|
||||
* Increased search autocompletion performance to stay mostly below 100ms
|
||||
* Changed style of aggregation edge to cleaner look
|
||||
* Allow certain edge types to enter and leave at top and bottom of nodes as well e.g. inheritance
|
||||
* Increased project load performance
|
||||
* Increased graph creation performance for overview screen
|
||||
* Changed namespace activation to show the namespace name in the search bar and the namespace definitions in the code view
|
||||
* Updated to Qt 5.6
|
||||
* Added analysis for local symbols and allow selecting them in the code view
|
||||
* Improved error display performance by not expanding all of them at once
|
||||
* Added home button next to search field for showing the project overview
|
||||
* Added shortcut and menu item to show project overview
|
||||
* Fixed Path boxes not sized correctly when switching back and forth in the project wizard
|
||||
* Allow support for environment variables in project setup with syntax ${VARIABLE_NAME}
|
||||
* Show quit button on license enter screen when no valid license was entered yet
|
||||
* Allow color schemes to define text colors for code view highlights
|
||||
* Added support for function pointers to analysis
|
||||
* Added Windows system dlls to installer on Windows so users don't not need to install the redistributable package
|
||||
* Changed style of out-of-date files to be followed by *
|
||||
* Set Qt flag for high DPI scaling
|
||||
* Check analyzed paths for existence in project wizard
|
||||
* Inform the user about project changes and ask before reparsing the project
|
||||
* Removed "simple setup" step in project wizard and added "lazy include search"-checkbox
|
||||
* Edit the project settings by clicking the project name in the overview stats
|
||||
* Added welcome message to Coati trial
|
||||
* Defined new highlight colors for code view in all color schemes
|
||||
|
||||
#### 0.5.1.21
|
||||
released 2016-03-16
|
||||
|
||||
* Fixed file logger using wrong directory for first log file
|
||||
* Fixed crash when accessing files without read permission
|
||||
* Center windows on top of main window
|
||||
* Added font size limits
|
||||
* Prevent network message handling without valid license
|
||||
* Fixed type references in headers saved multiple times
|
||||
* Improved context detection for template parameters
|
||||
* Fixed Visual Studio plugin project loading
|
||||
* Added delay for changing fontsize via mouse wheel
|
||||
* Disabled config file warnings
|
||||
* Fixed interrupting of analysis to show message in status bar
|
||||
* Fixed children on namespace activation were bundled
|
||||
* Fixed expanding file with errors showed all locations in red
|
||||
* Show loader animation when loading project
|
||||
* Removed high traffic log messages
|
||||
* Fixed crash when opening newer project with older version of Coati
|
||||
* Fixed project paths are now saved relative if defined relative
|
||||
* Fixed project setup window sizes to adapt to content size
|
||||
* Fixed linux package creating ~/.config if not there
|
||||
* Show fatal errors in UI that stopped analysis
|
||||
* Added compiler flags UI to advanced settings in project setup summary
|
||||
* Added file extension UI to advanced settings in project setup summary
|
||||
* Added graph zooming with Shift + mouse wheel or Shift + WS
|
||||
* Added graph panning with WASD
|
||||
* Improved project load and code view performance
|
||||
* Improved analysis performance for large projects (10x as fast for 1.000.000 LoC)
|
||||
* Added project setup for Compilation Databases
|
||||
|
||||
#### 0.5.0.4
|
||||
released 2016-02-25
|
||||
|
||||
* Fixed preferences not saved
|
||||
* Added link to documentation to Help menu
|
||||
* Improved painting of icons in graph to be smoother
|
||||
* Improved logging to alternate between 2 files of 1000 lines to decrease logfile sizes
|
||||
* Improved analysis performance to take only 66% of the time
|
||||
* Save user data in ~/Library/Application Support/Coati on Mac
|
||||
* Improved style of ui windows
|
||||
* Added Visual Studio solution parsing via project wizard or VS plugin
|
||||
* Added project setup wizard for step-by-step project setup
|
||||
* Added overview and error keywords to search view
|
||||
* Show overview on project open with node bundles per type
|
||||
* Added application move protection to reenter license key
|
||||
* Improved log file names to be sorted chronologically
|
||||
* Improved graph view node bundeling to bundle more
|
||||
* Display scope name at bottom of code snippet
|
||||
* Added .coatiproject file associations with icon for Mac and Windows
|
||||
* Return to last scroll position when going back in code view
|
||||
* Improved back & forward in code view
|
||||
* Update error count while analysis
|
||||
* Improved code view annotation painting performance
|
||||
* Added web documentation
|
||||
* Added trial target without analysis
|
||||
* Added license key window and license checker
|
||||
* Refresh project editing settings
|
||||
* Added C and C++ standard setting to project
|
||||
* Fixed cursor changing for resize and text interactions
|
||||
* Added commandline option for project file
|
||||
* Improved performance of token name saving
|
||||
* Fixed number postions in graph
|
||||
* Added shortcuts for font size resetting to View menu
|
||||
* Added C support
|
||||
* Added option to hide widget window title bars to View menu
|
||||
|
||||
#### 0.4.0
|
||||
released 2016-01-07
|
||||
|
||||
* navigate back via backspace key
|
||||
* navigate back&forward via mouse buttons
|
||||
* renamed undo&redo to back&forward
|
||||
* Fixed tooltip colors in dark color scheme
|
||||
* Fixed style of function or method nodes with children
|
||||
* Improved lambda handling in analysis
|
||||
* Added help texts to project setup and preferences window
|
||||
* Removed 'close window' action from menu
|
||||
* Fixed constructors and destructors using return type 'void' withou source location
|
||||
* Parse errors will be displayed as they appear during analysis
|
||||
* Redesigned the about window
|
||||
* Installing prerequisits in Windows Installer
|
||||
* Added installer for Windows
|
||||
* Introduced file endings .coatiproject and .coatidb for Coati's project files
|
||||
* Removed Coati directory from Linux package
|
||||
* Fixed graph font size was too small for Windows and Linux
|
||||
* Show function and method signature in tooltip when hovering the graph node
|
||||
* Added analysis for template parameter packs
|
||||
* Fixed syntax highlighting to correctly identify strings, comments and block comments
|
||||
* Fixed source locations of many declarations
|
||||
* Coati shows a template's general definition when an implicit specialization is activated
|
||||
* Added new color scheme called "bad_rainbow"
|
||||
* Extended color schemes to allow more extensive use in the graph
|
||||
* Coati now handles anonymous symbols when parsing files
|
||||
* Improved handling of template arguments in analysis
|
||||
* Coati can now handle inclass initialization of members
|
||||
* Network ports for IDE communication can be defined in the ApplicationSettings.xml
|
||||
|
||||
#### 0.3.0
|
||||
released 2015-12-14
|
||||
|
||||
* Saving all template arguments type uses
|
||||
* Added recent projects menu option
|
||||
* Focus all overlapping source locations in the code view
|
||||
* Improved code view auto scroll to center the first active line in the middle
|
||||
* Fixed search query disappeared when not token was found for it
|
||||
* Fixed cursor was jumping at end of query when editing a search query
|
||||
* Reworked code view highlighting
|
||||
* Save comment locations and display them when right next to active symbol
|
||||
* Fixed old data was still in new project window when creating another project
|
||||
* Save macro scopes
|
||||
* Save errors to storage and reactivate them via button in the status bar
|
||||
* Fixed horizontal scroll in code view not activated while scrolling vertically
|
||||
* Improved source locations of template scopes
|
||||
* Save Coati version to sqlite and reparse project whenever the version changes
|
||||
* Increased autocompletion performance by caching and limiting results to 100
|
||||
* Added plugin for Sublime Text (2 & 3)
|
||||
* Added plugin for Visual Studio (2012, 2013, 2015)
|
||||
* Added communication interface from and to Coati via TCP sockets
|
||||
* Added Tutorial project
|
||||
|
||||
@@ -35,12 +35,15 @@
|
||||
</framework_search_paths>
|
||||
|
||||
<extensions>
|
||||
<header_extensions><!-- STRING: extension for header/include e.g. .h --></header_extensions>
|
||||
<source_extensions><!-- STRING: extension for source e.g. .cpp --></source_extensions>
|
||||
</extensions>
|
||||
|
||||
<use_source_paths_for_header_search><!-- BOOL: If enabled all subfolder of the source paths will be used for header search --></use_source_paths_for_header_search>
|
||||
|
||||
<exclude_paths>
|
||||
<exclude_path><!-- STRING: path to file or directory to exclude from analysis --></source_path>
|
||||
</exclude_paths>
|
||||
|
||||
<build_file_path>
|
||||
<vs_solution_path><!-- STRING: path to Visual Studio solution *.sln --></vs_solution_path>
|
||||
<compilation_db_path><!-- STRING: path to Compilation Database --></compilation_db_path>
|
||||
|
||||
@@ -173,11 +173,14 @@
|
||||
|
||||
<!-- OPTIONAL: type specific node colors can be overriden by using the TEMPLATE within a type tag below -->
|
||||
<type></type>
|
||||
<builtin_type></builtin_type>
|
||||
<class></class>
|
||||
<interface></interface>
|
||||
<struct></struct>
|
||||
<enum></enum>
|
||||
<typedef></typedef>
|
||||
<template_parameter_type></template_parameter_type>
|
||||
<type_parameter></type_parameter>
|
||||
|
||||
<function></function>
|
||||
<method></method>
|
||||
@@ -188,6 +191,7 @@
|
||||
|
||||
<undefined></undefined>
|
||||
<namespace></namespace>
|
||||
<package></package>
|
||||
|
||||
<file></file>
|
||||
<macro></macro>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</button>
|
||||
|
||||
<field>
|
||||
<text>#3D3D3D</text>
|
||||
<text>#FFFFFF</text>
|
||||
<background>#808080</background>
|
||||
<highlight>#B1B1B1</highlight>
|
||||
</field>
|
||||
@@ -27,17 +27,45 @@
|
||||
|
||||
<query>
|
||||
<none>
|
||||
<normal>#B1B1B1</normal>
|
||||
<hover>#CCCCCC</hover>
|
||||
<normal>
|
||||
<fill>#B1B1B1</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#CCCCCC</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</hover>
|
||||
</none>
|
||||
<command>
|
||||
<normal>#86BD40</normal>
|
||||
<hover>#9EC769</hover>
|
||||
<normal>
|
||||
<fill>#86BD40</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#9EC769</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#7D2724</normal>
|
||||
<hover>#8C2B29</hover>
|
||||
<normal>
|
||||
<fill>#7D2724</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#8C2B29</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</hover>
|
||||
</operator>
|
||||
<fulltext>
|
||||
<normal>
|
||||
<fill>#C2AFEF</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#AB96EA</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</hover>
|
||||
</fulltext>
|
||||
</query>
|
||||
</search>
|
||||
|
||||
@@ -87,48 +115,62 @@
|
||||
</syntax>
|
||||
|
||||
<selection>
|
||||
<location>
|
||||
<token>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#B2B2B2</border>
|
||||
<border>#EDEDED</border>
|
||||
<fill>transparent</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>#B2B2B2</border>
|
||||
<fill>#4A4A4A</fill>
|
||||
<border>#EDEDED</border>
|
||||
<fill>#EDEDED</fill>
|
||||
<text>#262626</text>
|
||||
</active>
|
||||
</location>
|
||||
</token>
|
||||
<local_symbol>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#9BDAFF</border>
|
||||
<fill>#A5DEFF</fill>
|
||||
<text>#262626</text>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>#A5DEFF</fill>
|
||||
<text>#262626</text>
|
||||
</active>
|
||||
</local_symbol>
|
||||
<scope>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</active>
|
||||
</scope>
|
||||
<error>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>#A0FF0000</fill>
|
||||
<text>#000000</text>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>transparent</border>
|
||||
<fill>#FFFF0000</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>#FFFF0000</fill>
|
||||
</active>
|
||||
</error>
|
||||
<fulltext>
|
||||
<normal>
|
||||
<fill>#C2AFEF</fill>
|
||||
<text>#3D3D3D</text>
|
||||
</normal>
|
||||
<focus>
|
||||
<fill>#987CEA</fill>
|
||||
</focus>
|
||||
</fulltext>
|
||||
</selection>
|
||||
</snippet>
|
||||
</code>
|
||||
@@ -167,9 +209,15 @@
|
||||
<normal>#FFFFFF</normal>
|
||||
</icon>
|
||||
</type>
|
||||
<builtin_type>
|
||||
<like>type</like>
|
||||
</builtin_type>
|
||||
<class>
|
||||
<like>type</like>
|
||||
</class>
|
||||
<interface>
|
||||
<like>type</like>
|
||||
</interface>
|
||||
<struct>
|
||||
<like>type</like>
|
||||
</struct>
|
||||
@@ -182,6 +230,9 @@
|
||||
<template_parameter_type>
|
||||
<like>type</like>
|
||||
</template_parameter_type>
|
||||
<type_parameter>
|
||||
<like>type</like>
|
||||
</type_parameter>
|
||||
|
||||
<function>
|
||||
<fill>
|
||||
@@ -233,6 +284,9 @@
|
||||
<namespace>
|
||||
<like>undefined</like>
|
||||
</namespace>
|
||||
<package>
|
||||
<like>undefined</like>
|
||||
</package>
|
||||
|
||||
<file>
|
||||
<fill>
|
||||
@@ -243,6 +297,12 @@
|
||||
<normal>#20FFFFFF</normal>
|
||||
<focus>#FFFFFF</focus>
|
||||
</border>
|
||||
<text>
|
||||
<normal>#FFFFFF</normal>
|
||||
</text>
|
||||
<icon>
|
||||
<normal>#FFFFFF</normal>
|
||||
</icon>
|
||||
</file>
|
||||
<macro>
|
||||
<like>file</like>
|
||||
@@ -297,18 +357,21 @@
|
||||
<normal>#2A6484</normal>
|
||||
</use>
|
||||
|
||||
<template_parameter>
|
||||
<normal>#C1305D</normal>
|
||||
</template_parameter>
|
||||
<template_argument>
|
||||
<normal>#C1305D</normal>
|
||||
</template_argument>
|
||||
<type_argument>
|
||||
<like>template_argument</like>
|
||||
</type_argument>
|
||||
<template_default_argument>
|
||||
<normal>#C1305D</normal>
|
||||
<like>template_argument</like>
|
||||
</template_default_argument>
|
||||
<template_specialization>
|
||||
<normal>#C1305D</normal>
|
||||
<like>template_argument</like>
|
||||
</template_specialization>
|
||||
<template_member_specialization>
|
||||
<like>template_argument</like>
|
||||
</template_member_specialization>
|
||||
|
||||
<include>
|
||||
<normal>#4E82F6</normal>
|
||||
|
||||
@@ -27,17 +27,45 @@
|
||||
|
||||
<query>
|
||||
<none>
|
||||
<normal>white</normal>
|
||||
<hover>#F5F5F5</hover>
|
||||
<normal>
|
||||
<fill>white</fill>
|
||||
<text>black</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#F5F5F5</fill>
|
||||
<text>black</text>
|
||||
</hover>
|
||||
</none>
|
||||
<command>
|
||||
<normal>#8FBC92</normal>
|
||||
<hover>#5EA071</hover>
|
||||
<normal>
|
||||
<fill>#8FBC92</fill>
|
||||
<text>black</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#5EA071</fill>
|
||||
<text>black</text>
|
||||
</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#FCA47E</normal>
|
||||
<hover>#F97A4E</hover>
|
||||
<normal>
|
||||
<fill>#FCA47E</fill>
|
||||
<text>black</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#F97A4E</fill>
|
||||
<text>black</text>
|
||||
</hover>
|
||||
</operator>
|
||||
<fulltext>
|
||||
<normal>
|
||||
<fill>#C7C7E2</fill>
|
||||
<text>black</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#ABABDD</fill>
|
||||
<text>black</text>
|
||||
</hover>
|
||||
</fulltext>
|
||||
</query>
|
||||
</search>
|
||||
|
||||
@@ -87,48 +115,60 @@
|
||||
</syntax>
|
||||
|
||||
<selection>
|
||||
<location>
|
||||
<token>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#B2B2B2</border>
|
||||
<border>#8E8E8E</border>
|
||||
<fill>transparent</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>#B2B2B2</border>
|
||||
<fill>#EDEDED</fill>
|
||||
<border>#A0A0A0</border>
|
||||
<fill>#A0A0A0</fill>
|
||||
<text>#FFFFFF</text>
|
||||
</active>
|
||||
</location>
|
||||
</token>
|
||||
<local_symbol>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#AAE0FF</border>
|
||||
<fill>#C6EAFF</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>#C6EAFF</fill>
|
||||
</active>
|
||||
</local_symbol>
|
||||
<scope>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</active>
|
||||
</scope>
|
||||
<error>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>#80FF0000</fill>
|
||||
<text>#000000</text>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>transparent</border>
|
||||
<fill>#FFFF0000</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>#FFFF0000</fill>
|
||||
</active>
|
||||
</error>
|
||||
<fulltext>
|
||||
<normal>
|
||||
<fill>#C7C7E2</fill>
|
||||
<text>#000000</text>
|
||||
</normal>
|
||||
<focus>
|
||||
<fill>#ABABDD</fill>
|
||||
</focus>
|
||||
</fulltext>
|
||||
</selection>
|
||||
</snippet>
|
||||
</code>
|
||||
@@ -161,9 +201,15 @@
|
||||
<focus>#3C3C3C</focus>
|
||||
</border>
|
||||
</type>
|
||||
<builtin_type>
|
||||
<like>type</like>
|
||||
</builtin_type>
|
||||
<class>
|
||||
<like>type</like>
|
||||
</class>
|
||||
<interface>
|
||||
<like>type</like>
|
||||
</interface>
|
||||
<struct>
|
||||
<like>type</like>
|
||||
</struct>
|
||||
@@ -176,6 +222,9 @@
|
||||
<template_parameter_type>
|
||||
<like>type</like>
|
||||
</template_parameter_type>
|
||||
<type_parameter>
|
||||
<like>type</like>
|
||||
</type_parameter>
|
||||
|
||||
<function>
|
||||
<fill>
|
||||
@@ -220,6 +269,9 @@
|
||||
<namespace>
|
||||
<like>undefined</like>
|
||||
</namespace>
|
||||
<package>
|
||||
<like>undefined</like>
|
||||
</package>
|
||||
|
||||
<file>
|
||||
<fill>
|
||||
@@ -278,25 +330,25 @@
|
||||
<normal>#3190BA</normal>
|
||||
</use>
|
||||
|
||||
<template_parameter>
|
||||
<normal>#C1305D</normal>
|
||||
</template_parameter>
|
||||
<template_argument>
|
||||
<like>template_parameter</like>
|
||||
<normal>#C1305D</normal>
|
||||
</template_argument>
|
||||
<type_argument>
|
||||
<like>template_argument</like>
|
||||
</type_argument>
|
||||
<template_default_argument>
|
||||
<like>template_parameter</like>
|
||||
<like>template_argument</like>
|
||||
</template_default_argument>
|
||||
<template_specialization>
|
||||
<like>template_parameter</like>
|
||||
<like>template_argument</like>
|
||||
</template_specialization>
|
||||
<template_member_specialization>
|
||||
<like>template_parameter</like>
|
||||
<like>template_argument</like>
|
||||
</template_member_specialization>
|
||||
|
||||
<aggregation>
|
||||
<normal>#EEE</normal>
|
||||
<focus>#DDD</focus>
|
||||
<normal>#DDD</normal>
|
||||
<focus>#CCC</focus>
|
||||
</aggregation>
|
||||
</edge>
|
||||
</graph>
|
||||
|
||||
@@ -27,17 +27,64 @@
|
||||
|
||||
<query>
|
||||
<none>
|
||||
<normal>#2F2F2F</normal>
|
||||
<hover>black</hover>
|
||||
<normal></normal>
|
||||
<hover></hover>
|
||||
</none>
|
||||
<command>
|
||||
<normal>#406D4D</normal>
|
||||
<hover>#4E855E</hover>
|
||||
<normal></normal>
|
||||
<hover></hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#7D2724</normal>
|
||||
<hover>#8C2B29</hover>
|
||||
<normal></normal>
|
||||
<hover></hover>
|
||||
</operator>
|
||||
<fulltext>
|
||||
<normal></normal>
|
||||
<hover></hover>
|
||||
</fulltext>
|
||||
</query>
|
||||
|
||||
<query>
|
||||
<none>
|
||||
<normal>
|
||||
<fill>#2F2F2F</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>black</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</hover>
|
||||
</none>
|
||||
<command>
|
||||
<normal>
|
||||
<fill>#406D4D</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#4E855E</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>
|
||||
<fill>#7D2724</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#8C2B29</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</hover>
|
||||
</operator>
|
||||
<fulltext>
|
||||
<normal>
|
||||
<fill>#207EA8</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</normal>
|
||||
<hover>
|
||||
<fill>#006D93</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</hover>
|
||||
</fulltext>
|
||||
</query>
|
||||
</search>
|
||||
|
||||
@@ -87,48 +134,63 @@
|
||||
</syntax>
|
||||
|
||||
<selection>
|
||||
<location>
|
||||
<token>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#B2B2B2</border>
|
||||
<border>#F7F7F7</border>
|
||||
<fill>transparent</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>#B2B2B2</border>
|
||||
<fill>#4A4A4A</fill>
|
||||
<border>transparent</border>
|
||||
<fill>#F7F7F7</fill>
|
||||
<text>#272728</text>
|
||||
</active>
|
||||
</location>
|
||||
</token>
|
||||
<local_symbol>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#A0A0A0</border>
|
||||
<fill>#969696</fill>
|
||||
<text>#191919</text>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>#969696</fill>
|
||||
<text>#272728</text>
|
||||
</active>
|
||||
</local_symbol>
|
||||
<scope>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>transparent</fill>
|
||||
</active>
|
||||
</scope>
|
||||
<error>
|
||||
<normal>
|
||||
<border>transparent</border>
|
||||
<fill>#A0FF0000</fill>
|
||||
<text>#000000</text>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>transparent</border>
|
||||
<fill>#FFFF0000</fill>
|
||||
</focus>
|
||||
<active>
|
||||
<border>transparent</border>
|
||||
<fill>#FFFF0000</fill>
|
||||
</active>
|
||||
</error>
|
||||
<fulltext>
|
||||
<normal>
|
||||
<fill>#207EA8</fill>
|
||||
<text>#F7F7F7</text>
|
||||
</normal>
|
||||
<focus>
|
||||
<border>#006D93</border>
|
||||
<fill>#134B63</fill>
|
||||
</focus>
|
||||
</fulltext>
|
||||
</selection>
|
||||
</snippet>
|
||||
</code>
|
||||
@@ -161,36 +223,30 @@
|
||||
<focus>#C3C3C3</focus>
|
||||
</border>
|
||||
</type>
|
||||
<builtin_type>
|
||||
<like>type</like>
|
||||
</builtin_type>
|
||||
<class>
|
||||
<border>
|
||||
<normal>#20C3C3C3</normal>
|
||||
<focus>#C3C3C3</focus>
|
||||
</border>
|
||||
<like>type</like>
|
||||
</class>
|
||||
<interface>
|
||||
<like>type</like>
|
||||
</interface>
|
||||
<struct>
|
||||
<border>
|
||||
<normal>#20C3C3C3</normal>
|
||||
<focus>#C3C3C3</focus>
|
||||
</border>
|
||||
<like>type</like>
|
||||
</struct>
|
||||
<enum>
|
||||
<border>
|
||||
<normal>#20C3C3C3</normal>
|
||||
<focus>#C3C3C3</focus>
|
||||
</border>
|
||||
<like>type</like>
|
||||
</enum>
|
||||
<typedef>
|
||||
<border>
|
||||
<normal>#20C3C3C3</normal>
|
||||
<focus>#C3C3C3</focus>
|
||||
</border>
|
||||
<like>type</like>
|
||||
</typedef>
|
||||
<template_parameter_type>
|
||||
<border>
|
||||
<normal>#20C3C3C3</normal>
|
||||
<focus>#C3C3C3</focus>
|
||||
</border>
|
||||
<like>type</like>
|
||||
</template_parameter_type>
|
||||
<type_parameter>
|
||||
<like>type</like>
|
||||
</type_parameter>
|
||||
|
||||
<function>
|
||||
<fill>
|
||||
@@ -235,6 +291,9 @@
|
||||
<namespace>
|
||||
<like>undefined</like>
|
||||
</namespace>
|
||||
<package>
|
||||
<like>undefined</like>
|
||||
</package>
|
||||
|
||||
<file>
|
||||
<fill>
|
||||
@@ -293,20 +352,20 @@
|
||||
<normal>#2A6484</normal>
|
||||
</use>
|
||||
|
||||
<template_parameter>
|
||||
<normal>#C1305D</normal>
|
||||
</template_parameter>
|
||||
<template_argument>
|
||||
<normal>#C1305D</normal>
|
||||
</template_argument>
|
||||
<type_argument>
|
||||
<like>template_argument</like>
|
||||
</type_argument>
|
||||
<template_default_argument>
|
||||
<normal>#C1305D</normal>
|
||||
<like>template_argument</like>
|
||||
</template_default_argument>
|
||||
<template_specialization>
|
||||
<normal>#C1305D</normal>
|
||||
<like>template_argument</like>
|
||||
</template_specialization>
|
||||
<template_member_specialization>
|
||||
<normal>#C1305D</normal>
|
||||
<like>template_argument</like>
|
||||
</template_member_specialization>
|
||||
|
||||
<include>
|
||||
@@ -317,8 +376,8 @@
|
||||
</macro_use>
|
||||
|
||||
<aggregation>
|
||||
<normal>#5D5D5D</normal>
|
||||
<focus>#6D6D6D</focus>
|
||||
<normal>#3D3D3D</normal>
|
||||
<focus>#4D4D4D</focus>
|
||||
</aggregation>
|
||||
</edge>
|
||||
</graph>
|
||||
|
||||
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 517 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 8.0 KiB |
@@ -1,17 +1,14 @@
|
||||
#code_file_list_base, #code_file_list {
|
||||
#code_container, #code_file_list {
|
||||
background-color: <color:code/background>;
|
||||
}
|
||||
|
||||
* {
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file {
|
||||
background-color: <color:code/snippet/background>;
|
||||
border: 2px solid <color:code/file/background>;
|
||||
border-radius: 12px;
|
||||
border-top-left-radius: 14px;
|
||||
border-top-right-radius: 14px;
|
||||
font-size: <setting:font_size>pt;
|
||||
padding-bottom: 7px;
|
||||
}
|
||||
|
||||
@@ -19,6 +16,7 @@
|
||||
background-color: <color:code/file/background>;
|
||||
border-top-left-radius: 7px;
|
||||
border-top-right-radius: 7px;
|
||||
font-size: <setting:font_size>pt;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
@@ -27,6 +25,7 @@
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
color: <color:code/file/title/text>;
|
||||
font-size: <setting:font_size>pt;
|
||||
padding: 2px 4px;
|
||||
margin: 1px 8px 3px;
|
||||
}
|
||||
@@ -52,10 +51,7 @@
|
||||
#code_file #code_snippet {
|
||||
background-color: <color:code/snippet/background>;
|
||||
border-top: 2px solid <color:code/file/background>;
|
||||
}
|
||||
|
||||
#code_file #code_snippet * {
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file #code_snippet[isFirst=true] {
|
||||
@@ -65,8 +61,10 @@
|
||||
|
||||
#code_file #code_snippet #scope_name, #code_file #code_snippet #dots {
|
||||
background-color: <color:code/snippet/title/background>;
|
||||
color: <color:code/snippet/title/text>;
|
||||
border: none;
|
||||
color: <color:code/snippet/title/text>;
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name:hover {
|
||||
@@ -88,11 +86,15 @@
|
||||
background-color: <color:code/snippet/line_number/background>;
|
||||
border: none;
|
||||
color: <color:code/snippet/line_number/text>;
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_area {
|
||||
background-color: transparent;
|
||||
color: <color:code/snippet/syntax/normal>;
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file #maximize_button, #code_file #snippet_button, #code_file #minimize_button {
|
||||
|
||||
|
After Width: | Height: | Size: 867 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 536 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 606 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 536 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 760 B After Width: | Height: | Size: 986 B |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 827 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 693 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 852 B After Width: | Height: | Size: 718 B |
|
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 699 B |
|
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 816 B |
|
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 953 B |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 532 B |
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,57 @@
|
||||
QLabel {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#topHalf {
|
||||
background: #007AC2;
|
||||
border-top-left-radius: 15px;
|
||||
border-top-right-radius: 15px;
|
||||
}
|
||||
|
||||
#title {
|
||||
color: white;
|
||||
font-size: 22pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#percent {
|
||||
font-size: 22pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#message {
|
||||
font-size: 14pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#filePath {
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
#errorCount {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: white;
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
#windowButton {
|
||||
background: transparent;
|
||||
border: 1px solid white;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#windowButton:hover {
|
||||
background: transparent;
|
||||
border: 1px solid white;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#windowButton:hover {
|
||||
color: #2E3C86;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#windowButton:default {
|
||||
border: 2px solid white;
|
||||
}
|
||||
|
After Width: | Height: | Size: 315 B |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
@@ -3,7 +3,3 @@ QToolTip {
|
||||
color: black;
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: "Roboto";
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 925 B |
@@ -22,12 +22,7 @@ QPushButton:pressed {
|
||||
}
|
||||
|
||||
#refresh_button {
|
||||
border-bottom-left-radius: 12px;
|
||||
border-top-left-radius: 12px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
#auto_refresh_button {
|
||||
border-bottom-right-radius: 12px;
|
||||
border-top-right-radius: 12px;
|
||||
/*border-bottom-left-radius: 12px;*/
|
||||
/*border-top-left-radius: 12px;*/
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 811 B |
@@ -16,6 +16,7 @@ QWidget#search_box_container {
|
||||
border: none;
|
||||
border-bottom-left-radius: 12px;
|
||||
border-top-left-radius: 12px;
|
||||
margin-left: 5px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ QLineEdit#search_box {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
color: <color:search/field/text>;
|
||||
margin-left: 5px;
|
||||
selection-background-color: <color:search/field/highlight>;
|
||||
}
|
||||
|
||||
@@ -41,19 +43,23 @@ QAbstractItemView#search_box_popup {
|
||||
selection-background-color: <color:search/popup/highlight>;
|
||||
}
|
||||
|
||||
QPushButton#search_button {
|
||||
#search_button, #home_button {
|
||||
background: <color:search/button/normal>;
|
||||
border: none;
|
||||
border-bottom-right-radius: 12px;
|
||||
border-top-right-radius: 12px;
|
||||
border-radius: 12px;
|
||||
background-position: 15px 5px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
#search_button:hover {
|
||||
#search_button {
|
||||
border-bottom-left-radius: 0px;
|
||||
border-top-left-radius: 0px;
|
||||
}
|
||||
|
||||
#search_button:hover, #home_button:hover {
|
||||
background: <color:search/button/hover>;
|
||||
}
|
||||
|
||||
#search_button:pressed {
|
||||
#search_button:pressed, #home_button:pressed {
|
||||
background: <color:search/button/press>;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 29 KiB |
@@ -20,7 +20,14 @@
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#recentButton:hover {
|
||||
#recentButtonMissing {
|
||||
background: none;
|
||||
border: none;
|
||||
color: grey;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#recentButton:hover, #recentButtonMissing:hover {
|
||||
background-color: #CFD2E0;
|
||||
border-radius: 10px;
|
||||
}
|
||||
@@ -29,4 +36,21 @@
|
||||
color: black;
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#versionLabel {
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#updateLabel {
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#welcomeLabel {
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 578 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -15,8 +15,8 @@ QListWidget {
|
||||
}
|
||||
|
||||
QListWidget::item {
|
||||
height: 20px;
|
||||
border-bottom: 1px solid lightgray;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
QListWidget::item:selected {
|
||||
@@ -26,6 +26,7 @@ QListWidget::item:selected {
|
||||
QtListItemWidget #field {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
color: black;
|
||||
margin-top: 2px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
@@ -34,7 +35,7 @@ QtListItemWidget #field {
|
||||
border-top: 1px solid lightgray;
|
||||
}
|
||||
|
||||
#plusButton, #minusButton, #dotsButton {
|
||||
#plusButton, #minusButton, #dotsButton, #editButton {
|
||||
color: white;
|
||||
height: 1em;
|
||||
margin-right: 3px;
|
||||
@@ -70,6 +71,15 @@ QtListItemWidget #field {
|
||||
border-image: url(<setting:gui_path>window/dots_hover.png);
|
||||
}
|
||||
|
||||
#editButton {
|
||||
border-image: url(<setting:gui_path>code_view/images/edit.png);
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#editButton:hover {
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
#dropInfo {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 672 B |
@@ -2,14 +2,16 @@
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#title {
|
||||
QLabel, QCheckBox {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#title {
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#section, #projectTitle {
|
||||
color: black;
|
||||
#projectTitle {
|
||||
font-size: 14pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -25,24 +27,34 @@
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#description {
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#label {
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#titleLabel {
|
||||
font-size: 14pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#formArea {
|
||||
background: white;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#scrollArea {
|
||||
background: white;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-top: 1px solid lightgrey;
|
||||
border-bottom: 1px solid lightgrey;
|
||||
}
|
||||
|
||||
#form {
|
||||
background: white;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#helpButton, #dotsButton, #refreshButton {
|
||||
@@ -77,8 +89,10 @@
|
||||
}
|
||||
|
||||
#name, #picker {
|
||||
background: white;
|
||||
border-radius: 10px;
|
||||
border: 1px solid lightgrey;
|
||||
color: black;
|
||||
padding: 2px 5px 0px;
|
||||
}
|
||||
|
||||
@@ -86,6 +100,7 @@
|
||||
background: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
color: black;
|
||||
margin-left: 5px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
@@ -110,16 +125,20 @@
|
||||
border-radius: 8px;
|
||||
border-bottom-right-radius: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
color: black;
|
||||
font-size: 15pt;
|
||||
margin-right: 0px;
|
||||
margin-bottom: 7px;
|
||||
height: 25px;
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
#windowButton:hover {
|
||||
color: white;
|
||||
background: #2D3F85;
|
||||
background: #2D3C86;
|
||||
}
|
||||
|
||||
#windowButton:default {
|
||||
border: 2px solid lightgray;
|
||||
}
|
||||
|
||||
#menuButton:hover, #menuButton:checked {
|
||||
@@ -141,6 +160,7 @@
|
||||
#projectButton {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
width: 7em;
|
||||
height: 7em;
|
||||
@@ -151,8 +171,10 @@
|
||||
background: #CFD2E0;
|
||||
}
|
||||
|
||||
#files {
|
||||
#textField, #pathList {
|
||||
background: white;
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 12px;
|
||||
color: black;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
%windir%\system32\msiexec.exe /I{E6343DF1-6651-4487-BACE-59068B169BA0}
|
||||
%windir%\system32\msiexec.exe /I{560C569F-03CF-424D-9B63-92B86779ECB6}
|
||||
@@ -1 +1 @@
|
||||
%windir%\system32\msiexec.exe /I{99D5E031-E895-47B2-B108-AD026571FD29}
|
||||
%windir%\system32\msiexec.exe /I{A977609C-DEE3-48BF-8597-302959F82D1A}
|
||||
@@ -0,0 +1 @@
|
||||
%windir%\system32\msiexec.exe /x {596E7336-D5B9-449A-95E9-6040F354E283}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<config>
|
||||
<info>
|
||||
<description>
|
||||
WHAT IS THIS?\n
|
||||
\tJavaParser is an open-source Java project for parsing Java code and\n
|
||||
\tgenerating an Abstract Syntax Tree (AST). Additionally it supports a\n
|
||||
\tvisitor pattern to traverse the generated AST. For more information on\n
|
||||
\tthis project please visit javaparser.org\n
|
||||
\n
|
||||
LET'S GET STARTED!\n
|
||||
\tHave you ever wondered what a parser for a real programming language\n
|
||||
\tmay look like? Go ahead and find out!\n
|
||||
\n
|
||||
\tIf you ask yourself where to start, click the symbol linked below.\n
|
||||
\n
|
||||
[com\ts\tp\tngithub\ts\tp\tnjavaparser\ts\tp\tnast\ts\tp\tnbody\ts\tp\tnClassOrInterfaceDeclaration\ts\tp] // <- start here!\n\n
|
||||
</description>
|
||||
</info>
|
||||
<language_settings>
|
||||
<language>Java</language>
|
||||
<standard>8</standard>
|
||||
</language_settings>
|
||||
<source>
|
||||
<extensions>
|
||||
<source_extensions>.java</source_extensions>
|
||||
</extensions>
|
||||
<source_paths>
|
||||
<source_path>./src/main/java</source_path>
|
||||
<source_path>./target/generated-sources/javacc</source_path>
|
||||
</source_paths>
|
||||
</source>
|
||||
</config>
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser;
|
||||
|
||||
import com.github.javaparser.ast.CompilationUnit;
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.comments.Comment;
|
||||
import com.github.javaparser.ast.comments.CommentsCollection;
|
||||
import com.github.javaparser.ast.comments.CommentsParser;
|
||||
import com.github.javaparser.ast.comments.LineComment;
|
||||
import com.github.javaparser.utils.PositionUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Assigns comments to nodes of the AST.
|
||||
*
|
||||
* @author Sebastian Kuerten
|
||||
* @author Júlio Vilmar Gesser
|
||||
*/
|
||||
class CommentsInserter {
|
||||
private boolean doNotAssignCommentsPreceedingEmptyLines = true;
|
||||
private boolean doNotConsiderAnnotationsAsNodeStartForCodeAttribution = false;
|
||||
|
||||
CommentsInserter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the comments found in the source code of a compilation unit to that compilation unit.
|
||||
* @param cu an already created compilation unit
|
||||
* @param cuSourceCode the source code of the compilation unit. It will be parsed to find comments.
|
||||
*/
|
||||
public void insertComments(CompilationUnit cu, String cuSourceCode) throws IOException {
|
||||
CommentsParser commentsParser = new CommentsParser();
|
||||
CommentsCollection allComments = commentsParser.parse(cuSourceCode);
|
||||
|
||||
insertCommentsInCu(cu, allComments);
|
||||
}
|
||||
|
||||
public boolean getDoNotConsiderAnnotationsAsNodeStartForCodeAttribution() {
|
||||
return doNotConsiderAnnotationsAsNodeStartForCodeAttribution;
|
||||
}
|
||||
|
||||
public void setDoNotConsiderAnnotationsAsNodeStartForCodeAttribution(boolean newValue) {
|
||||
this.doNotConsiderAnnotationsAsNodeStartForCodeAttribution = newValue;
|
||||
}
|
||||
|
||||
public boolean getDoNotAssignCommentsPreceedingEmptyLines() {
|
||||
return doNotAssignCommentsPreceedingEmptyLines;
|
||||
}
|
||||
|
||||
public void setDoNotAssignCommentsPreceedingEmptyLines(boolean newValue) {
|
||||
this.doNotAssignCommentsPreceedingEmptyLines = newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comments are attributed to the thing the comment and are removed from
|
||||
* allComments.
|
||||
*/
|
||||
private void insertCommentsInCu(CompilationUnit cu,
|
||||
CommentsCollection commentsCollection) {
|
||||
if (commentsCollection.size() == 0)
|
||||
return;
|
||||
|
||||
// I should sort all the direct children and the comments, if a comment
|
||||
// is the first thing then it
|
||||
// a comment to the CompilationUnit
|
||||
// FIXME if there is no package it could be also a comment to the
|
||||
// following class...
|
||||
// so I could use some heuristics in these cases to distinguish the two
|
||||
// cases
|
||||
|
||||
List<Comment> comments = commentsCollection.getAll();
|
||||
PositionUtils.sortByBeginPosition(comments);
|
||||
List<Node> children = cu.getChildrenNodes();
|
||||
PositionUtils.sortByBeginPosition(children);
|
||||
|
||||
if (cu.getPackage() != null
|
||||
&& (children.isEmpty() || PositionUtils.areInOrder(
|
||||
comments.get(0), children.get(0)))) {
|
||||
cu.setComment(comments.get(0));
|
||||
comments.remove(0);
|
||||
}
|
||||
|
||||
insertCommentsInNode(cu, comments);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method try to attributes the nodes received to child of the node. It
|
||||
* returns the node that were not attributed.
|
||||
*/
|
||||
private void insertCommentsInNode(Node node,
|
||||
List<Comment> commentsToAttribute) {
|
||||
if (commentsToAttribute.isEmpty())
|
||||
return;
|
||||
|
||||
// the comments can:
|
||||
// 1) Inside one of the child, then it is the child that have to
|
||||
// associate them
|
||||
// 2) If they are not inside a child they could be preceeding nothing, a
|
||||
// comment or a child
|
||||
// if they preceed a child they are assigned to it, otherweise they
|
||||
// remain "orphans"
|
||||
|
||||
List<Node> children = node.getChildrenNodes();
|
||||
PositionUtils.sortByBeginPosition(children);
|
||||
|
||||
for (Node child : children) {
|
||||
List<Comment> commentsInsideChild = new LinkedList<Comment>();
|
||||
for (Comment c : commentsToAttribute) {
|
||||
if (PositionUtils.nodeContains(child, c,
|
||||
doNotConsiderAnnotationsAsNodeStartForCodeAttribution)) {
|
||||
commentsInsideChild.add(c);
|
||||
}
|
||||
}
|
||||
commentsToAttribute.removeAll(commentsInsideChild);
|
||||
insertCommentsInNode(child, commentsInsideChild);
|
||||
}
|
||||
|
||||
// I can attribute in line comments to elements preceeding them, if
|
||||
// there
|
||||
// is something contained in their line
|
||||
List<Comment> attributedComments = new LinkedList<Comment>();
|
||||
for (Comment comment : commentsToAttribute) {
|
||||
if (comment.isLineComment()) {
|
||||
for (Node child : children) {
|
||||
if (child.getEnd().line == comment.getBegin().line
|
||||
&& attributeLineCommentToNodeOrChild(child,
|
||||
comment.asLineComment())) {
|
||||
attributedComments.add(comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point I create an ordered list of all remaining comments and
|
||||
// children
|
||||
Comment previousComment = null;
|
||||
attributedComments = new LinkedList<Comment>();
|
||||
List<Node> childrenAndComments = new LinkedList<Node>();
|
||||
childrenAndComments.addAll(children);
|
||||
childrenAndComments.addAll(commentsToAttribute);
|
||||
PositionUtils.sortByBeginPosition(childrenAndComments,
|
||||
doNotConsiderAnnotationsAsNodeStartForCodeAttribution);
|
||||
|
||||
for (Node thing : childrenAndComments) {
|
||||
if (thing instanceof Comment) {
|
||||
previousComment = (Comment) thing;
|
||||
if (!previousComment.isOrphan()) {
|
||||
previousComment = null;
|
||||
}
|
||||
} else {
|
||||
if (previousComment != null && !thing.hasComment()) {
|
||||
if (!doNotAssignCommentsPreceedingEmptyLines
|
||||
|| !thereAreLinesBetween(previousComment, thing)) {
|
||||
thing.setComment(previousComment);
|
||||
attributedComments.add(previousComment);
|
||||
previousComment = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
commentsToAttribute.removeAll(attributedComments);
|
||||
|
||||
// all the remaining are orphan nodes
|
||||
for (Comment c : commentsToAttribute) {
|
||||
if (c.isOrphan()) {
|
||||
node.addOrphanComment(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean attributeLineCommentToNodeOrChild(Node node,
|
||||
LineComment lineComment) {
|
||||
// The node start and end at the same line as the comment,
|
||||
// let's give to it the comment
|
||||
if (node.getBegin().line == lineComment.getBegin().line
|
||||
&& !node.hasComment()) {
|
||||
if(!(node instanceof Comment)) {
|
||||
node.setComment(lineComment);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// try with all the children, sorted by reverse position (so the
|
||||
// first one is the nearest to the comment
|
||||
List<Node> children = new LinkedList<Node>();
|
||||
children.addAll(node.getChildrenNodes());
|
||||
PositionUtils.sortByBeginPosition(children);
|
||||
Collections.reverse(children);
|
||||
|
||||
for (Node child : children) {
|
||||
if (attributeLineCommentToNodeOrChild(child, lineComment)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean thereAreLinesBetween(Node a, Node b) {
|
||||
if (!PositionUtils.areInOrder(a, b)) {
|
||||
return thereAreLinesBetween(b, a);
|
||||
}
|
||||
int endOfA = a.getEnd().line;
|
||||
return b.getBegin().line > (endOfA + 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,563 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.github.javaparser.ast.CompilationUnit;
|
||||
import com.github.javaparser.ast.ImportDeclaration;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.expr.Expression;
|
||||
import com.github.javaparser.ast.stmt.BlockStmt;
|
||||
import com.github.javaparser.ast.stmt.Statement;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.readerToString;
|
||||
|
||||
/**
|
||||
* Parse Java source code and creates Abstract Syntax Tree classes.
|
||||
*
|
||||
* @author Júlio Vilmar Gesser
|
||||
*/
|
||||
public final class JavaParser {
|
||||
private static final CommentsInserter commentsInserter = new CommentsInserter();
|
||||
private static final Charset UTF8 = Charset.forName("utf-8");
|
||||
|
||||
private ASTParser astParser = null;
|
||||
private Provider provider = null;
|
||||
|
||||
/**
|
||||
* Instantiate the parser. Note that parsing can also be done with the static methods on this class.
|
||||
* Creating an instance will reduce setup time between parsing files.
|
||||
*/
|
||||
public JavaParser() {
|
||||
// No specific constructors for this class.
|
||||
}
|
||||
|
||||
public JavaParser setSource(Provider provider) {
|
||||
this.provider=provider;
|
||||
if(astParser==null) {
|
||||
astParser = new ASTParser(provider);
|
||||
}else{
|
||||
astParser.ReInit(provider);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public JavaParser setSource(Reader reader) {
|
||||
return setSource(new StreamProvider(reader));
|
||||
}
|
||||
|
||||
public JavaParser setSource(InputStream input) throws IOException {
|
||||
return setSource(new StreamProvider(input));
|
||||
}
|
||||
|
||||
public JavaParser setSource(InputStream input, Charset encoding) throws IOException {
|
||||
return setSource(new StreamProvider(input, encoding.name()));
|
||||
}
|
||||
|
||||
public JavaParser setSource(File file) throws IOException {
|
||||
return setSource(new FileInputStream(file));
|
||||
}
|
||||
|
||||
public JavaParser setSource(File file, Charset encoding) throws IOException {
|
||||
return setSource(new FileInputStream(file), encoding);
|
||||
}
|
||||
|
||||
public JavaParser setSource(String source) {
|
||||
return setSource(new StringReader(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of tokens that have been encountered while parsing code
|
||||
* using this parser.
|
||||
*
|
||||
* @return a list of tokens
|
||||
*/
|
||||
public List<Token> getTokens() {
|
||||
checkSourceSet();
|
||||
return astParser.getTokens();
|
||||
}
|
||||
|
||||
private void checkSourceSet() {
|
||||
if (astParser == null || provider == null) {
|
||||
throw new IllegalStateException("Please setSource() before doing any parsing.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code and returns a {@link CompilationUnit} that
|
||||
* represents it.
|
||||
*
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public CompilationUnit parse() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.CompilationUnit();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
private void closeProvider() {
|
||||
try {
|
||||
checkSourceSet();
|
||||
provider.close();
|
||||
} catch (IOException e) {
|
||||
// Since we're done parsing and have our result, we don't care about any errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java block and returns a {@link BlockStmt} that represents it.
|
||||
*
|
||||
* @return BlockStmt representing the Java block
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public BlockStmt parseBlock() throws ParseException {
|
||||
try{
|
||||
checkSourceSet();
|
||||
return astParser.Block();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java block and returns a {@link List} of {@link Statement}s
|
||||
* that represents it.
|
||||
*
|
||||
* @return Statement representing the Java statement
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public List<Statement> parseStatements() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.Statements();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java statement and returns a {@link Statement} that represents
|
||||
* it.
|
||||
*
|
||||
* @return Statement representing the Java statement
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public Statement parseStatement() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.Statement();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java import and returns a {@link ImportDeclaration} that
|
||||
* represents it.
|
||||
*
|
||||
* @return ImportDeclaration representing the Java import declaration
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public ImportDeclaration parseImport() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.ImportDeclaration();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java expression and returns a {@link Expression} that
|
||||
* represents it.
|
||||
*
|
||||
* @return Expression representing the Java expression
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public Expression parseExpression() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.Expression();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java annotation and returns a {@link AnnotationExpr} that
|
||||
* represents it.
|
||||
*
|
||||
* @return AnnotationExpr representing the Java annotation
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public AnnotationExpr parseAnnotation() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.Annotation();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java body declaration(e.g fields or methods) and returns a
|
||||
* {@link BodyDeclaration} that represents it.
|
||||
*
|
||||
* @return BodyDeclaration representing the Java body
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public BodyDeclaration<?> parseBodyDeclaration() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.AnnotationBodyDeclaration();
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a Java class body declaration(e.g fields or methods) and returns a
|
||||
* {@link BodyDeclaration} that represents it.
|
||||
*
|
||||
* @return BodyDeclaration representing the Java class body
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public BodyDeclaration<?> parseClassBodyDeclaration() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.ClassOrInterfaceBodyDeclaration(false);
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a Java interface body declaration(e.g fields or methods) and returns a
|
||||
* {@link BodyDeclaration} that represents it.
|
||||
*
|
||||
* @return BodyDeclaration representing the Java interface body
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public BodyDeclaration<?> parseInterfaceBodyDeclaration() throws ParseException {
|
||||
try {
|
||||
checkSourceSet();
|
||||
return astParser.ClassOrInterfaceBodyDeclaration(true);
|
||||
} finally {
|
||||
closeProvider();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getDoNotConsiderAnnotationsAsNodeStartForCodeAttribution() {
|
||||
return commentsInserter.getDoNotConsiderAnnotationsAsNodeStartForCodeAttribution();
|
||||
}
|
||||
|
||||
public static void setDoNotConsiderAnnotationsAsNodeStartForCodeAttribution(boolean newValue) {
|
||||
commentsInserter.setDoNotConsiderAnnotationsAsNodeStartForCodeAttribution(newValue);
|
||||
}
|
||||
|
||||
public static boolean getDoNotAssignCommentsPreceedingEmptyLines() {
|
||||
return commentsInserter.getDoNotAssignCommentsPreceedingEmptyLines();
|
||||
}
|
||||
|
||||
public static void setDoNotAssignCommentsPreceedingEmptyLines(boolean newValue) {
|
||||
commentsInserter.setDoNotAssignCommentsPreceedingEmptyLines(newValue);
|
||||
}
|
||||
|
||||
public static CompilationUnit parse(final InputStream in,
|
||||
final Charset encoding) throws ParseException {
|
||||
return parse(in,encoding,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code contained in the {@link InputStream} and returns a
|
||||
* {@link CompilationUnit} that represents it.
|
||||
*
|
||||
* @param in
|
||||
* {@link InputStream} containing Java source code
|
||||
* @param encoding
|
||||
* encoding of the source code
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static CompilationUnit parse(final InputStream in,
|
||||
Charset encoding,
|
||||
boolean considerComments) throws ParseException {
|
||||
try {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(in, encoding)) {
|
||||
return parse(inputStreamReader, considerComments);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new ParseException(ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code contained in the {@link InputStream} and returns a
|
||||
* {@link CompilationUnit} that represents it.<br>
|
||||
* Note: Uses UTF-8 encoding
|
||||
*
|
||||
* @param in
|
||||
* {@link InputStream} containing Java source code
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static CompilationUnit parse(final InputStream in)
|
||||
throws ParseException {
|
||||
return parse(in, UTF8, true);
|
||||
}
|
||||
|
||||
public static CompilationUnit parse(final File file, final Charset encoding)
|
||||
throws ParseException, IOException {
|
||||
return parse(file,encoding,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code contained in a {@link File} and returns a
|
||||
* {@link CompilationUnit} that represents it.
|
||||
*
|
||||
* @param file
|
||||
* {@link File} containing Java source code
|
||||
* @param encoding
|
||||
* encoding of the source code
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static CompilationUnit parse(final File file, final Charset encoding, boolean considerComments)
|
||||
throws ParseException {
|
||||
try {
|
||||
try (FileInputStream in = new FileInputStream(file)) {
|
||||
return parse(in, encoding, considerComments);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new ParseException(ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code contained in a {@link File} and returns a
|
||||
* {@link CompilationUnit} that represents it.<br>
|
||||
* Note: Uses UTF-8 encoding
|
||||
*
|
||||
*
|
||||
* @param file
|
||||
* {@link File} containing Java source code
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
* @throws IOException
|
||||
*/
|
||||
public static CompilationUnit parse(final File file) throws ParseException,
|
||||
IOException {
|
||||
return parse(file, UTF8, true);
|
||||
}
|
||||
|
||||
public static CompilationUnit parse(final Reader reader)
|
||||
throws ParseException {
|
||||
return parse(reader, true);
|
||||
}
|
||||
|
||||
public static CompilationUnit parse(final Reader reader, boolean considerComments)
|
||||
throws ParseException {
|
||||
try {
|
||||
String comments = readerToString(reader);
|
||||
CompilationUnit cu = new JavaParser().setSource(comments).parse();
|
||||
if (considerComments){
|
||||
commentsInserter.insertComments(cu, comments);
|
||||
}
|
||||
return cu;
|
||||
} catch (IOException ioe){
|
||||
throw new ParseException(ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code contained in code and returns a
|
||||
* {@link CompilationUnit} that represents it.
|
||||
*
|
||||
* @param code Java source code
|
||||
* @param considerComments parse or ignore comments
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException if the source code has parser errors
|
||||
*/
|
||||
public static CompilationUnit parse(String code, boolean considerComments) throws ParseException {
|
||||
return parse(new StringReader(code), considerComments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java code contained in code and returns a
|
||||
* {@link CompilationUnit} that represents it.
|
||||
*
|
||||
* @param code Java source code
|
||||
* @return CompilationUnit representing the Java source code
|
||||
* @throws ParseException if the source code has parser errors
|
||||
*/
|
||||
public static CompilationUnit parse(String code) throws ParseException {
|
||||
return parse(code, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java block contained in a {@link String} and returns a
|
||||
* {@link BlockStmt} that represents it.
|
||||
*
|
||||
* @param blockStatement
|
||||
* {@link String} containing Java block code
|
||||
* @return BlockStmt representing the Java block
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static BlockStmt parseBlock(final String blockStatement)
|
||||
throws ParseException {
|
||||
return new JavaParser().setSource(blockStatement).parseBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java statement contained in a {@link String} and returns a
|
||||
* {@link Statement} that represents it.
|
||||
*
|
||||
* @param statement
|
||||
* {@link String} containing Java statement code
|
||||
* @return Statement representing the Java statement
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static Statement parseStatement(final String statement) throws ParseException {
|
||||
return new JavaParser().setSource(statement).parseStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java statements contained in a {@link String} and returns a
|
||||
* list of {@link Statement} that represents it.
|
||||
*
|
||||
* @param statements
|
||||
* {@link String} containing Java statements
|
||||
* @return list of Statement representing the Java statement
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static List<Statement> parseStatements(final String statements) throws ParseException {
|
||||
return new JavaParser().setSource(statements).parseStatements();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java import contained in a {@link String} and returns a
|
||||
* {@link ImportDeclaration} that represents it.
|
||||
*
|
||||
* @param importDeclaration
|
||||
* {@link String} containing Java import code
|
||||
* @return ImportDeclaration representing the Java import declaration
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static ImportDeclaration parseImport(final String importDeclaration) throws ParseException {
|
||||
return new JavaParser().setSource(importDeclaration).parseImport();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java expression contained in a {@link String} and returns a
|
||||
* {@link Expression} that represents it.
|
||||
*
|
||||
* @param expression
|
||||
* {@link String} containing Java expression
|
||||
* @return Expression representing the Java expression
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static Expression parseExpression(final String expression) throws ParseException {
|
||||
return new JavaParser().setSource(expression).parseExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java annotation contained in a {@link String} and returns a
|
||||
* {@link AnnotationExpr} that represents it.
|
||||
*
|
||||
* @param annotation
|
||||
* {@link String} containing Java annotation
|
||||
* @return AnnotationExpr representing the Java annotation
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static AnnotationExpr parseAnnotation(final String annotation) throws ParseException {
|
||||
return new JavaParser().setSource(annotation).parseAnnotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the Java body declaration(e.g fields or methods) contained in a
|
||||
* {@link String} and returns a {@link BodyDeclaration} that represents it.
|
||||
*
|
||||
* @param body
|
||||
* {@link String} containing Java body declaration
|
||||
* @return BodyDeclaration representing the Java annotation
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static BodyDeclaration<?> parseBodyDeclaration(final String body) throws ParseException {
|
||||
return new JavaParser().setSource(body).parseBodyDeclaration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a Java class body declaration(e.g fields or methods) and returns a
|
||||
* {@link BodyDeclaration} that represents it.
|
||||
*
|
||||
* @param body the body of a class
|
||||
* @return BodyDeclaration representing the Java class body
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static BodyDeclaration<?> parseClassBodyDeclaration(String body) throws ParseException {
|
||||
return new JavaParser().setSource(body).parseClassBodyDeclaration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a Java interface body declaration(e.g fields or methods) and returns a
|
||||
* {@link BodyDeclaration} that represents it.
|
||||
*
|
||||
* @param body the body of an interface
|
||||
* @return BodyDeclaration representing the Java interface body
|
||||
* @throws ParseException
|
||||
* if the source code has parser errors
|
||||
*/
|
||||
public static BodyDeclaration parseInterfaceBodyDeclaration(String body) throws ParseException {
|
||||
return new JavaParser().setSource(body).parseInterfaceBodyDeclaration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser;
|
||||
|
||||
import com.github.javaparser.ast.Node;
|
||||
|
||||
/**
|
||||
* A position in a source file. Lines and columns start counting at 1.
|
||||
*/
|
||||
public class Position implements Comparable<Position> {
|
||||
public final int line;
|
||||
public final int column;
|
||||
|
||||
public static final Position ABSOLUTE_START = new Position(Node.ABSOLUTE_BEGIN_LINE, -1);
|
||||
public static final Position ABSOLUTE_END = new Position(Node.ABSOLUTE_END_LINE, -1);
|
||||
|
||||
/**
|
||||
* The first position in the file
|
||||
*/
|
||||
public static final Position HOME = new Position(1, 1);
|
||||
public static final Position UNKNOWN = new Position(0, 0);
|
||||
|
||||
public Position(int line, int column) {
|
||||
if (line < Node.ABSOLUTE_END_LINE) {
|
||||
throw new IllegalArgumentException("Can't position at line " + line);
|
||||
}
|
||||
if (column < -1) {
|
||||
throw new IllegalArgumentException("Can't position at column " + column);
|
||||
}
|
||||
this.line = line;
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient factory method.
|
||||
*/
|
||||
public static Position pos(int line, int column) {
|
||||
return new Position(line, column);
|
||||
}
|
||||
|
||||
public Position withColumn(int column) {
|
||||
return new Position(this.line, column);
|
||||
}
|
||||
|
||||
public Position withLine(int line) {
|
||||
return new Position(line, this.column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the position is usable. Does not know what it is pointing at, so it can't check if the position is after the end of the source.
|
||||
*/
|
||||
public boolean valid() {
|
||||
return line > 0 && column > 0;
|
||||
}
|
||||
|
||||
public boolean invalid() {
|
||||
return !valid();
|
||||
}
|
||||
|
||||
public Position orIfInvalid(Position anotherPosition) {
|
||||
if (valid()) {
|
||||
return this;
|
||||
}
|
||||
return anotherPosition;
|
||||
}
|
||||
|
||||
public boolean isAfter(Position position) {
|
||||
if (position.line == Node.ABSOLUTE_BEGIN_LINE) return true;
|
||||
if (line > position.line) {
|
||||
return true;
|
||||
} else if (line == position.line) {
|
||||
return column > position.column;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public boolean isBefore(Position position) {
|
||||
if (position.line == Node.ABSOLUTE_END_LINE) return true;
|
||||
if (line < position.line) {
|
||||
return true;
|
||||
} else if (line == position.line) {
|
||||
return column < position.column;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Position o) {
|
||||
if (isBefore(o)) {
|
||||
return -1;
|
||||
}
|
||||
if (isAfter(o)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Position position = (Position) o;
|
||||
|
||||
return line == position.line && column == position.column;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 31 * line + column;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(line " + line + ",col " + column + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.github.javaparser;
|
||||
|
||||
import static com.github.javaparser.Position.pos;
|
||||
|
||||
/**
|
||||
* A range of characters in a source file, from "begin" to "end", including the characters at "begin" and "end".
|
||||
*/
|
||||
public class Range {
|
||||
public static final Range UNKNOWN = range(Position.UNKNOWN, Position.UNKNOWN);
|
||||
|
||||
public final Position begin;
|
||||
public final Position end;
|
||||
|
||||
public Range(Position begin, Position end) {
|
||||
if (begin == null) {
|
||||
throw new IllegalArgumentException("begin can't be null");
|
||||
}
|
||||
if (end == null) {
|
||||
throw new IllegalArgumentException("end can't be null");
|
||||
}
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public static Range range(Position begin, Position end) {
|
||||
return new Range(begin, end);
|
||||
}
|
||||
|
||||
public static Range range(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
return new Range(pos(beginLine, beginColumn), pos(endLine, endColumn));
|
||||
}
|
||||
|
||||
public Range withBeginColumn(int column) {
|
||||
return range(begin.withColumn(column), end);
|
||||
}
|
||||
|
||||
public Range withBeginLine(int line) {
|
||||
return range(begin.withLine(line), end);
|
||||
}
|
||||
|
||||
public Range withEndColumn(int column) {
|
||||
return range(begin, end.withColumn(column));
|
||||
}
|
||||
|
||||
public Range withEndLine(int line) {
|
||||
return range(begin, end.withLine(line));
|
||||
}
|
||||
|
||||
public Range withBegin(Position begin) {
|
||||
return range(begin, this.end);
|
||||
}
|
||||
|
||||
public Range withEnd(Position end) {
|
||||
return range(this.begin, end);
|
||||
}
|
||||
|
||||
public boolean contains(Range other) {
|
||||
return begin.isBefore(other.begin) && end.isAfter(other.end);
|
||||
}
|
||||
|
||||
public boolean isBefore(Position position) {
|
||||
return end.isBefore(position);
|
||||
}
|
||||
|
||||
public boolean isAfter(Position position) {
|
||||
return begin.isAfter(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Range range = (Range) o;
|
||||
|
||||
return begin.equals(range.begin) && end.equals(range.end);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 31 * begin.hashCode() + end.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return begin+"-"+end;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
/**
|
||||
* Access specifier. Represents one of the possible levels of
|
||||
* access permitted by the language.
|
||||
*
|
||||
* @author Federico Tomassetti
|
||||
* @since July 2014
|
||||
*/
|
||||
public enum AccessSpecifier {
|
||||
|
||||
PUBLIC("public"),
|
||||
PRIVATE("private"),
|
||||
PROTECTED("protected"),
|
||||
DEFAULT("");
|
||||
|
||||
private String codeRepresenation;
|
||||
|
||||
AccessSpecifier(String codeRepresentation) {
|
||||
this.codeRepresenation = codeRepresentation;
|
||||
}
|
||||
|
||||
public String getCodeRepresenation(){
|
||||
return this.codeRepresenation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,404 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.ensureNotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.github.javaparser.ast.expr.NameExpr;
|
||||
import com.github.javaparser.utils.ClassUtils;
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.body.AnnotationDeclaration;
|
||||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
||||
import com.github.javaparser.ast.body.EmptyTypeDeclaration;
|
||||
import com.github.javaparser.ast.body.EnumDeclaration;
|
||||
import com.github.javaparser.ast.body.TypeDeclaration;
|
||||
import com.github.javaparser.ast.comments.Comment;
|
||||
import com.github.javaparser.ast.comments.JavadocComment;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents the entire compilation unit. Each java file denotes a
|
||||
* compilation unit.
|
||||
* </p>
|
||||
* The CompilationUnit is constructed following the syntax:<br>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* CompilationUnit ::= ( }{@link PackageDeclaration}{@code )?
|
||||
* ( }{@link ImportDeclaration}{@code )*
|
||||
* ( }{@link TypeDeclaration}{@code )*
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class CompilationUnit extends Node {
|
||||
|
||||
private PackageDeclaration pakage;
|
||||
|
||||
private List<ImportDeclaration> imports;
|
||||
|
||||
private List<TypeDeclaration<?>> types;
|
||||
|
||||
public CompilationUnit() {
|
||||
}
|
||||
|
||||
public CompilationUnit(PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration<?>> types) {
|
||||
setPackage(pakage);
|
||||
setImports(imports);
|
||||
setTypes(types);
|
||||
}
|
||||
|
||||
public CompilationUnit(Range range, PackageDeclaration pakage, List<ImportDeclaration> imports,
|
||||
List<TypeDeclaration<?>> types) {
|
||||
super(range);
|
||||
setPackage(pakage);
|
||||
setImports(imports);
|
||||
setTypes(types);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list containing all comments declared in this compilation unit.
|
||||
* Including javadocs, line comments and block comments of all types,
|
||||
* inner-classes and other members.<br>
|
||||
* If there is no comment, <code>null</code> is returned.
|
||||
*
|
||||
* @return list with all comments of this compilation unit or
|
||||
* <code>null</code>
|
||||
* @see JavadocComment
|
||||
* @see com.github.javaparser.ast.comments.LineComment
|
||||
* @see com.github.javaparser.ast.comments.BlockComment
|
||||
*/
|
||||
public List<Comment> getComments() {
|
||||
return this.getAllContainedComments();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of imports declared in this compilation unit or
|
||||
* <code>null</code> if there is no import.
|
||||
*
|
||||
* @return the list of imports or <code>null</code> if there is no import
|
||||
*/
|
||||
public List<ImportDeclaration> getImports() {
|
||||
imports = ensureNotNull(imports);
|
||||
return imports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the package declaration of this compilation unit.<br>
|
||||
* If this compilation unit has no package declaration (default package),
|
||||
* <code>null</code> is returned.
|
||||
*
|
||||
* @return the package declaration or <code>null</code>
|
||||
*/
|
||||
public PackageDeclaration getPackage() {
|
||||
return pakage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of types declared in this compilation unit.<br>
|
||||
* If there is no types declared, <code>null</code> is returned.
|
||||
*
|
||||
* @return the list of types or <code>null</code> null if there is no type
|
||||
* @see AnnotationDeclaration
|
||||
* @see ClassOrInterfaceDeclaration
|
||||
* @see EmptyTypeDeclaration
|
||||
* @see EnumDeclaration
|
||||
*/
|
||||
public List<TypeDeclaration<?>> getTypes() {
|
||||
types = ensureNotNull(types);
|
||||
return types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of comments of this compilation unit.
|
||||
*
|
||||
* @param comments
|
||||
* the list of comments
|
||||
*/
|
||||
public void setComments(List<Comment> comments) {
|
||||
throw new RuntimeException("Not implemented!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of imports of this compilation unit. The list is initially
|
||||
* <code>null</code>.
|
||||
*
|
||||
* @param imports
|
||||
* the list of imports
|
||||
*/
|
||||
public void setImports(List<ImportDeclaration> imports) {
|
||||
this.imports = imports;
|
||||
setAsParentNodeOf(this.imports);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or clear the package declarations of this compilation unit.
|
||||
*
|
||||
* @param pakage
|
||||
* the pakage declaration to set or <code>null</code> to default
|
||||
* package
|
||||
*/
|
||||
public void setPackage(PackageDeclaration pakage) {
|
||||
this.pakage = pakage;
|
||||
setAsParentNodeOf(this.pakage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of types declared in this compilation unit.
|
||||
*
|
||||
* @param types
|
||||
* the lis of types
|
||||
*/
|
||||
public void setTypes(List<TypeDeclaration<?>> types) {
|
||||
this.types = types;
|
||||
setAsParentNodeOf(this.types);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the package declaration of this compilation unit
|
||||
*
|
||||
* @param name the name of the package
|
||||
* @return this, the {@link CompilationUnit}
|
||||
*/
|
||||
public CompilationUnit setPackageName(String name) {
|
||||
setPackage(new PackageDeclaration(NameExpr.create(name)));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an import to the list of {@link ImportDeclaration} of this compilation unit<br>
|
||||
* shorthand for {@link #addImport(String, boolean, boolean)} with name,false,false
|
||||
*
|
||||
* @param name the import name
|
||||
* @return this, the {@link CompilationUnit}
|
||||
*/
|
||||
public CompilationUnit addImport(String name) {
|
||||
return addImport(name, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an import to the list of {@link ImportDeclaration} of this compilation unit<br>
|
||||
* shorthand for {@link #addImport(String)} with clazz.getName()
|
||||
*
|
||||
* @param clazz the class to import
|
||||
* @return this, the {@link CompilationUnit}
|
||||
*/
|
||||
public CompilationUnit addImport(Class<?> clazz) {
|
||||
if (ClassUtils.isPrimitiveOrWrapper(clazz) || clazz.getName().startsWith("java.lang"))
|
||||
return this;
|
||||
else if (clazz.isArray() && !ClassUtils.isPrimitiveOrWrapper(clazz.getComponentType())
|
||||
&& !clazz.getComponentType().getName().startsWith("java.lang"))
|
||||
return addImport(clazz.getComponentType().getName());
|
||||
return addImport(clazz.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an import to the list of {@link ImportDeclaration} of this compilation unit<br>
|
||||
* <b>This method check if no import with the same name is already in the list</b>
|
||||
*
|
||||
* @param name the import name
|
||||
* @param isStatic is it an "import static"
|
||||
* @param isAsterisk does the import end with ".*"
|
||||
* @return this, the {@link CompilationUnit}
|
||||
*/
|
||||
public CompilationUnit addImport(String name, boolean isStatic, boolean isAsterisk) {
|
||||
if (getImports().stream().anyMatch(i -> i.getName().toString().equals(name)))
|
||||
return this;
|
||||
else {
|
||||
ImportDeclaration importDeclaration = new ImportDeclaration(NameExpr.create(name), isStatic,
|
||||
isAsterisk);
|
||||
getImports().add(importDeclaration);
|
||||
importDeclaration.setParentNode(this);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a public class to the types of this compilation unit
|
||||
*
|
||||
* @param name the class name
|
||||
* @return the newly created class
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addClass(String name) {
|
||||
return addClass(name, Modifier.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a class to the types of this compilation unit
|
||||
*
|
||||
* @param name the class name
|
||||
* @param modifiers the modifiers (like Modifier.PUBLIC)
|
||||
* @return the newly created class
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addClass(String name, Modifier... modifiers) {
|
||||
ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration(
|
||||
Arrays.stream(modifiers)
|
||||
.collect(Collectors.toCollection(() -> EnumSet.noneOf(Modifier.class))),
|
||||
false, name);
|
||||
getTypes().add(classOrInterfaceDeclaration);
|
||||
classOrInterfaceDeclaration.setParentNode(this);
|
||||
return classOrInterfaceDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a public interface class to the types of this compilation unit
|
||||
*
|
||||
* @param name the interface name
|
||||
* @return the newly created class
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addInterface(String name) {
|
||||
return addInterface(name, Modifier.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an interface to the types of this compilation unit
|
||||
*
|
||||
* @param name the interface name
|
||||
* @param modifiers the modifiers (like Modifier.PUBLIC)
|
||||
* @return the newly created class
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addInterface(String name, Modifier... modifiers) {
|
||||
ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration(
|
||||
Arrays.stream(modifiers)
|
||||
.collect(Collectors.toCollection(() -> EnumSet.noneOf(Modifier.class))),
|
||||
true, name);
|
||||
getTypes().add(classOrInterfaceDeclaration);
|
||||
classOrInterfaceDeclaration.setParentNode(this);
|
||||
return classOrInterfaceDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a public enum to the types of this compilation unit
|
||||
*
|
||||
* @param name the enum name
|
||||
* @return the newly created class
|
||||
*/
|
||||
public EnumDeclaration addEnum(String name) {
|
||||
return addEnum(name, Modifier.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an enum to the types of this compilation unit
|
||||
*
|
||||
* @param name the enum name
|
||||
* @param modifiers the modifiers (like Modifier.PUBLIC)
|
||||
* @return the newly created class
|
||||
*/
|
||||
public EnumDeclaration addEnum(String name, Modifier... modifiers) {
|
||||
EnumDeclaration enumDeclaration = new EnumDeclaration(Arrays.stream(modifiers)
|
||||
.collect(Collectors.toCollection(() -> EnumSet.noneOf(Modifier.class))), name);
|
||||
getTypes().add(enumDeclaration);
|
||||
enumDeclaration.setParentNode(this);
|
||||
return enumDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a public annotation declaration to the types of this compilation unit
|
||||
*
|
||||
* @param name the annotation name
|
||||
* @return the newly created class
|
||||
*/
|
||||
public AnnotationDeclaration addAnnotationDeclaration(String name) {
|
||||
return addAnnotationDeclaration(name, Modifier.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an annotation declaration to the types of this compilation unit
|
||||
*
|
||||
* @param name the annotation name
|
||||
* @param modifiers the modifiers (like Modifier.PUBLIC)
|
||||
* @return the newly created class
|
||||
*/
|
||||
public AnnotationDeclaration addAnnotationDeclaration(String name, Modifier... modifiers) {
|
||||
AnnotationDeclaration annotationDeclaration = new AnnotationDeclaration(Arrays.stream(modifiers)
|
||||
.collect(Collectors.toCollection(() -> EnumSet.noneOf(Modifier.class))), name);
|
||||
getTypes().add(annotationDeclaration);
|
||||
annotationDeclaration.setParentNode(this);
|
||||
return annotationDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get a class by its name
|
||||
*
|
||||
* @param className the class name (case-sensitive)
|
||||
* @return null if not found, the class otherwise
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration getClassByName(String className) {
|
||||
return (ClassOrInterfaceDeclaration) getTypes().stream().filter(type -> type.getName().equals(className)
|
||||
&& type instanceof ClassOrInterfaceDeclaration && !((ClassOrInterfaceDeclaration) type).isInterface())
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get an interface by its name
|
||||
*
|
||||
* @param interfaceName the interface name (case-sensitive)
|
||||
* @return null if not found, the interface otherwise
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration getInterfaceByName(String interfaceName) {
|
||||
return (ClassOrInterfaceDeclaration) getTypes().stream().filter(type -> type.getName().equals(interfaceName)
|
||||
&& type instanceof ClassOrInterfaceDeclaration && ((ClassOrInterfaceDeclaration) type).isInterface())
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get an enum by its name
|
||||
*
|
||||
* @param enumName the enum name (case-sensitive)
|
||||
* @return null if not found, the enum otherwise
|
||||
*/
|
||||
public EnumDeclaration getEnumByName(String enumName) {
|
||||
return (EnumDeclaration) getTypes().stream().filter(type -> type.getName().equals(enumName)
|
||||
&& type instanceof EnumDeclaration)
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get an annotation by its name
|
||||
*
|
||||
* @param annotationName the annotation name (case-sensitive)
|
||||
* @return null if not found, the annotation otherwise
|
||||
*/
|
||||
public AnnotationDeclaration getAnnotationDeclarationByName(String annotationName) {
|
||||
return (AnnotationDeclaration) getTypes().stream().filter(type -> type.getName().equals(annotationName)
|
||||
&& type instanceof AnnotationDeclaration)
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.expr.NameExpr;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents a import declaration or an empty import declaration. Imports are optional for the
|
||||
* {@link CompilationUnit}.
|
||||
* </p>
|
||||
* The ImportDeclaration is constructed following the syntax:<br>
|
||||
* <pre>
|
||||
* {@code
|
||||
* ImportDeclaration ::= "import" ( "static" )? }{@link NameExpr}{@code ( "." "*" )? ";"
|
||||
* }
|
||||
* </pre>
|
||||
* An enmpty import declaration is simply a semicolon among the import declarations.
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ImportDeclaration extends Node {
|
||||
|
||||
private NameExpr name;
|
||||
private boolean static_;
|
||||
private boolean asterisk;
|
||||
private boolean isEmptyImportDeclaration;
|
||||
|
||||
private ImportDeclaration() {
|
||||
this.isEmptyImportDeclaration = true;
|
||||
static_ = false;
|
||||
asterisk = false;
|
||||
}
|
||||
|
||||
private ImportDeclaration(Range range) {
|
||||
super(range);
|
||||
this.isEmptyImportDeclaration = true;
|
||||
static_ = false;
|
||||
asterisk = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an empty import declaration without specifying its position.
|
||||
*/
|
||||
public static ImportDeclaration createEmptyDeclaration(){
|
||||
return new ImportDeclaration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an empty import declaration specifying its position.
|
||||
*/
|
||||
public static ImportDeclaration createEmptyDeclaration(Range range){
|
||||
return new ImportDeclaration(range);
|
||||
}
|
||||
|
||||
public ImportDeclaration(NameExpr name, boolean isStatic, boolean isAsterisk) {
|
||||
setAsterisk(isAsterisk);
|
||||
setName(name);
|
||||
setStatic(isStatic);
|
||||
this.isEmptyImportDeclaration = false;
|
||||
}
|
||||
|
||||
public ImportDeclaration(Range range, NameExpr name, boolean isStatic, boolean isAsterisk) {
|
||||
super(range);
|
||||
setAsterisk(isAsterisk);
|
||||
setName(name);
|
||||
setStatic(isStatic);
|
||||
this.isEmptyImportDeclaration = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this an empty import declaration or a normal import declaration?
|
||||
*/
|
||||
public boolean isEmptyImportDeclaration(){
|
||||
return this.isEmptyImportDeclaration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name of the import.
|
||||
*
|
||||
* @return the name of the import
|
||||
* @throws UnsupportedOperationException when invoked on an empty import declaration
|
||||
*/
|
||||
public NameExpr getName() {
|
||||
if (isEmptyImportDeclaration) {
|
||||
throw new UnsupportedOperationException("Empty import declarations have no name");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the import ends with "*".
|
||||
*
|
||||
* @return <code>true</code> if the import ends with "*", <code>false</code>
|
||||
* otherwise
|
||||
*/
|
||||
public boolean isAsterisk() {
|
||||
return asterisk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the import is static.
|
||||
*
|
||||
* @return <code>true</code> if the import is static, <code>false</code>
|
||||
* otherwise
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return static_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if this import is asterisk.
|
||||
*
|
||||
* @param asterisk
|
||||
* <code>true</code> if this import is asterisk
|
||||
* @throws UnsupportedOperationException when setting true on an empty import declaration
|
||||
*/
|
||||
public void setAsterisk(boolean asterisk) {
|
||||
if (isEmptyImportDeclaration && asterisk) {
|
||||
throw new UnsupportedOperationException("Empty import cannot have asterisk");
|
||||
}
|
||||
this.asterisk = asterisk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name this import.
|
||||
*
|
||||
* @param name
|
||||
* the name to set
|
||||
* @throws UnsupportedOperationException when invoked on an empty import declaration
|
||||
*/
|
||||
public void setName(NameExpr name) {
|
||||
if (isEmptyImportDeclaration) {
|
||||
throw new UnsupportedOperationException("Empty import cannot have name");
|
||||
}
|
||||
this.name = name;
|
||||
setAsParentNodeOf(this.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if this import is static.
|
||||
*
|
||||
* @param static_
|
||||
* <code>true</code> if this import is static
|
||||
* @throws UnsupportedOperationException when setting true on an empty import declaration
|
||||
*/
|
||||
public void setStatic(boolean static_) {
|
||||
if (isEmptyImportDeclaration && static_) {
|
||||
throw new UnsupportedOperationException("Empty import cannot be static");
|
||||
}
|
||||
this.static_ = static_;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public enum Modifier {
|
||||
PUBLIC("public"),
|
||||
PROTECTED("protected"),
|
||||
PRIVATE("private"),
|
||||
ABSTRACT("abstract"),
|
||||
STATIC("static"),
|
||||
FINAL("final"),
|
||||
TRANSIENT("transient"),
|
||||
VOLATILE("volatile"),
|
||||
SYNCHRONIZED("synchronized"),
|
||||
NATIVE("native"),
|
||||
STRICTFP("strictfp");
|
||||
|
||||
String lib;
|
||||
|
||||
private Modifier(String lib) {
|
||||
this.lib = lib;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lib
|
||||
*/
|
||||
public String getLib() {
|
||||
return lib;
|
||||
}
|
||||
|
||||
public EnumSet<Modifier> toEnumSet() {
|
||||
return EnumSet.of(this);
|
||||
}
|
||||
|
||||
public static AccessSpecifier getAccessSpecifier(EnumSet<Modifier> modifiers) {
|
||||
if (modifiers.contains(Modifier.PUBLIC)) {
|
||||
return AccessSpecifier.PUBLIC;
|
||||
} else if (modifiers.contains(Modifier.PROTECTED)) {
|
||||
return AccessSpecifier.PROTECTED;
|
||||
} else if (modifiers.contains(Modifier.PRIVATE)) {
|
||||
return AccessSpecifier.PRIVATE;
|
||||
} else {
|
||||
return AccessSpecifier.DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,372 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import com.github.javaparser.Position;
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.comments.BlockComment;
|
||||
import com.github.javaparser.ast.comments.Comment;
|
||||
import com.github.javaparser.ast.comments.LineComment;
|
||||
import com.github.javaparser.ast.visitor.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Abstract class for all nodes of the AST.
|
||||
*
|
||||
* Each Node can have one associated comment which describe it and
|
||||
* a number of "orphan comments" which it contains but are not specifically
|
||||
* associated to any element.
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class Node implements Cloneable {
|
||||
private Range range;
|
||||
|
||||
private Node parentNode;
|
||||
|
||||
private List<Node> childrenNodes = new LinkedList<>();
|
||||
private List<Comment> orphanComments = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* This attribute can store additional information from semantic analysis.
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
private Comment comment;
|
||||
|
||||
public Node() {
|
||||
this(Range.UNKNOWN);
|
||||
}
|
||||
|
||||
public Node(Range range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept method for visitor support.
|
||||
*
|
||||
* @param <R>
|
||||
* the type the return value of the visitor
|
||||
* @param <A>
|
||||
* the type the argument passed to the visitor
|
||||
* @param v
|
||||
* the visitor implementation
|
||||
* @param arg
|
||||
* the argument passed to the visitor
|
||||
* @return the result of the visit
|
||||
*/
|
||||
public abstract <R, A> R accept(GenericVisitor<R, A> v, A arg);
|
||||
|
||||
/**
|
||||
* Accept method for visitor support.
|
||||
*
|
||||
* @param <A>
|
||||
* the type the argument passed for the visitor
|
||||
* @param v
|
||||
* the visitor implementation
|
||||
* @param arg
|
||||
* any value relevant for the visitor
|
||||
*/
|
||||
public abstract <A> void accept(VoidVisitor<A> v, A arg);
|
||||
|
||||
/**
|
||||
* This is a comment associated with this node.
|
||||
*
|
||||
* @return comment property
|
||||
*/
|
||||
public final Comment getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to retrieve additional information associated to this node.
|
||||
*
|
||||
* @return data property
|
||||
*/
|
||||
public final Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* The begin position of this node in the source file.
|
||||
*/
|
||||
public Position getBegin() {
|
||||
return range.begin;
|
||||
}
|
||||
|
||||
/**
|
||||
* The end position of this node in the source file.
|
||||
*/
|
||||
public Position getEnd() {
|
||||
return range.end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the begin position of this node in the source file.
|
||||
*/
|
||||
public void setBegin(Position begin) {
|
||||
range = range.withBegin(begin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end position of this node in the source file.
|
||||
*/
|
||||
public void setEnd(Position end) {
|
||||
range = range.withEnd(end);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the range of characters in the source code that this node covers.
|
||||
*/
|
||||
public Range getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param range the range of characters in the source code that this node covers.
|
||||
*/
|
||||
public void setRange(Range range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to store additional information to this node.
|
||||
*
|
||||
* @param comment to be set
|
||||
*/
|
||||
public final void setComment(final Comment comment) {
|
||||
if (comment != null && (this instanceof Comment)) {
|
||||
throw new RuntimeException("A comment can not be commented");
|
||||
}
|
||||
if (this.comment != null) {
|
||||
this.comment.setCommentedNode(null);
|
||||
}
|
||||
this.comment = comment;
|
||||
if (comment != null) {
|
||||
this.comment.setCommentedNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Use this to store additional information to this node.
|
||||
*
|
||||
* @param comment to be set
|
||||
*/
|
||||
public final void setLineComment(String comment) {
|
||||
setComment(new LineComment(comment));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to store additional information to this node.
|
||||
*
|
||||
* @param comment to be set
|
||||
*/
|
||||
public final void setBlockComment(String comment) {
|
||||
setComment(new BlockComment(comment));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to store additional information to this node.
|
||||
*
|
||||
* @param data to be set
|
||||
*/
|
||||
public final void setData(final Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the String representation of this node.
|
||||
*
|
||||
* @return the String representation of this node
|
||||
*/
|
||||
@Override
|
||||
public final String toString() {
|
||||
final DumpVisitor visitor = new DumpVisitor();
|
||||
accept(visitor, null);
|
||||
return visitor.getSource();
|
||||
}
|
||||
|
||||
public final String toStringWithoutComments() {
|
||||
final DumpVisitor visitor = new DumpVisitor(false);
|
||||
accept(visitor, null);
|
||||
return visitor.getSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return toString().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null || !(obj instanceof Node)) {
|
||||
return false;
|
||||
}
|
||||
return EqualsVisitor.equals(this, (Node) obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node clone() {
|
||||
return this.accept(new CloneVisitor(), null);
|
||||
}
|
||||
|
||||
public Node getParentNode() {
|
||||
return parentNode;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getParentNodeOfType(Class<T> classType) {
|
||||
Node parent = parentNode;
|
||||
while (parent != null) {
|
||||
if (classType.isAssignableFrom(parent.getClass()))
|
||||
return (T) parent;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Node> getChildrenNodes() {
|
||||
return childrenNodes;
|
||||
}
|
||||
|
||||
public boolean contains(Node other) {
|
||||
return range.contains(other.range);
|
||||
}
|
||||
|
||||
public void addOrphanComment(Comment comment) {
|
||||
orphanComments.add(comment);
|
||||
comment.setParentNode(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a list of Comment which are inside the node and are not associated
|
||||
* with any meaningful AST Node.
|
||||
*
|
||||
* For example, comments at the end of methods (immediately before the parenthesis)
|
||||
* or at the end of CompilationUnit are orphan comments.
|
||||
*
|
||||
* When more than one comment preceeds a statement, the one immediately preceding it
|
||||
* it is associated with the statements, while the others are orphans.
|
||||
*
|
||||
* @return all comments that cannot be attributed to a concept
|
||||
*/
|
||||
public List<Comment> getOrphanComments() {
|
||||
return orphanComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the list of Comment which are contained in the Node either because
|
||||
* they are properly associated to one of its children or because they are floating
|
||||
* around inside the Node
|
||||
*
|
||||
* @return all Comments within the node as a list
|
||||
*/
|
||||
public List<Comment> getAllContainedComments() {
|
||||
List<Comment> comments = new LinkedList<>();
|
||||
comments.addAll(getOrphanComments());
|
||||
|
||||
for (Node child : getChildrenNodes()) {
|
||||
if (child.getComment() != null) {
|
||||
comments.add(child.getComment());
|
||||
}
|
||||
comments.addAll(child.getAllContainedComments());
|
||||
}
|
||||
|
||||
return comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new parent to this node, removing it
|
||||
* from the list of children of the previous parent, if any.
|
||||
*
|
||||
* @param parentNode node to be set as parent
|
||||
*/
|
||||
public void setParentNode(Node parentNode) {
|
||||
// remove from old parent, if any
|
||||
if (this.parentNode != null) {
|
||||
this.parentNode.childrenNodes.remove(this);
|
||||
}
|
||||
this.parentNode = parentNode;
|
||||
// add to new parent, if any
|
||||
if (this.parentNode != null) {
|
||||
this.parentNode.childrenNodes.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setAsParentNodeOf(List<? extends Node> childNodes) {
|
||||
if (childNodes != null) {
|
||||
for (Node current : childNodes) {
|
||||
current.setParentNode(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setAsParentNodeOf(Node childNode) {
|
||||
if (childNode != null) {
|
||||
childNode.setParentNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static final int ABSOLUTE_BEGIN_LINE = -1;
|
||||
public static final int ABSOLUTE_END_LINE = -2;
|
||||
|
||||
public boolean isPositionedAfter(Position position) {
|
||||
return range.isAfter(position);
|
||||
}
|
||||
|
||||
public boolean isPositionedBefore(Position position) {
|
||||
return range.isBefore(position);
|
||||
}
|
||||
|
||||
public boolean hasComment() {
|
||||
return comment != null;
|
||||
}
|
||||
|
||||
public void tryAddImportToParentCompilationUnit(Class<?> clazz) {
|
||||
CompilationUnit parentNode = getParentNodeOfType(CompilationUnit.class);
|
||||
if (parentNode != null) {
|
||||
parentNode.addImport(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds all nodes of a certain type.
|
||||
*
|
||||
* @param clazz the type of node to find.
|
||||
*/
|
||||
public <N extends Node> List<N> getNodesByType(Class<N> clazz) {
|
||||
List<N> nodes = new ArrayList<>();
|
||||
for (Node child : getChildrenNodes()) {
|
||||
if (clazz.isInstance(child)) {
|
||||
nodes.add(clazz.cast(child));
|
||||
}
|
||||
nodes.addAll(child.getNodesByType(clazz));
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.expr.NameExpr;
|
||||
import com.github.javaparser.utils.Utils;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents the package declaration. The package declaration is
|
||||
* optional for the {@link CompilationUnit}.
|
||||
* </p>
|
||||
* The PackageDeclaration is constructed following the syntax:<br>
|
||||
* <pre>
|
||||
* {@code
|
||||
* PackageDeclaration ::= ( }{@link AnnotationExpr}{@code )* "package" }{@link NameExpr}{@code ) ";"
|
||||
* }
|
||||
* </pre>
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class PackageDeclaration extends Node {
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
private NameExpr name;
|
||||
|
||||
public PackageDeclaration() {
|
||||
}
|
||||
|
||||
public PackageDeclaration(NameExpr name) {
|
||||
setName(name);
|
||||
}
|
||||
|
||||
public PackageDeclaration(List<AnnotationExpr> annotations, NameExpr name) {
|
||||
setAnnotations(annotations);
|
||||
setName(name);
|
||||
}
|
||||
|
||||
public PackageDeclaration(Range range, List<AnnotationExpr> annotations, NameExpr name) {
|
||||
super(range);
|
||||
setAnnotations(annotations);
|
||||
setName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of annotations declared before the package
|
||||
* declaration. Return <code>null</code> if there are no annotations.
|
||||
*
|
||||
* @return list of annotations or <code>null</code>
|
||||
*/
|
||||
public List<AnnotationExpr> getAnnotations() {
|
||||
annotations = Utils.ensureNotNull(annotations);
|
||||
return annotations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name expression of the package.
|
||||
*
|
||||
* @return the name of the package
|
||||
*/
|
||||
public NameExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full package name.
|
||||
*/
|
||||
public String getPackageName() {
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param annotations
|
||||
* the annotations to set
|
||||
*/
|
||||
public void setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
setAsParentNodeOf(this.annotations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this package declaration.
|
||||
*
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(NameExpr name) {
|
||||
this.name = name;
|
||||
setAsParentNodeOf(this.name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import com.github.javaparser.ast.type.Type;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.ensureNotNull;
|
||||
|
||||
public class TypeArguments {
|
||||
public static final TypeArguments EMPTY = withArguments(Collections.<Type>emptyList());
|
||||
|
||||
private final List<Type> typeArguments;
|
||||
private final boolean usesDiamondOperator;
|
||||
|
||||
private TypeArguments(List<Type> typeArguments, boolean usesDiamondOperator) {
|
||||
this.typeArguments = ensureNotNull(typeArguments);
|
||||
this.usesDiamondOperator = usesDiamondOperator;
|
||||
}
|
||||
|
||||
public List<Type> getTypeArguments() {
|
||||
return typeArguments;
|
||||
}
|
||||
|
||||
public boolean isUsingDiamondOperator() {
|
||||
return usesDiamondOperator;
|
||||
}
|
||||
|
||||
public static TypeArguments withDiamondOperator() {
|
||||
return new TypeArguments(Collections.<Type>emptyList(), true);
|
||||
}
|
||||
|
||||
public static TypeArguments withArguments(List<Type> typeArguments) {
|
||||
return new TypeArguments(typeArguments, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.ensureNotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithName;
|
||||
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents the declaration of a generics argument.
|
||||
* </p>
|
||||
* The TypeParameter is constructed following the syntax:<br>
|
||||
* <pre>
|
||||
* {@code
|
||||
* TypeParameter ::= <IDENTIFIER> ( "extends" }{@link ClassOrInterfaceType}{@code ( "&" }{@link ClassOrInterfaceType}{@code )* )?
|
||||
* }
|
||||
* </pre>
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class TypeParameter extends Node implements NodeWithName<TypeParameter> {
|
||||
|
||||
private String name;
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
private List<ClassOrInterfaceType> typeBound;
|
||||
|
||||
public TypeParameter() {
|
||||
}
|
||||
|
||||
public TypeParameter(final String name, final List<ClassOrInterfaceType> typeBound) {
|
||||
setName(name);
|
||||
setTypeBound(typeBound);
|
||||
}
|
||||
|
||||
public TypeParameter(Range range, final String name, final List<ClassOrInterfaceType> typeBound) {
|
||||
super(range);
|
||||
setName(name);
|
||||
setTypeBound(typeBound);
|
||||
}
|
||||
|
||||
public TypeParameter(Range range, String name, List<ClassOrInterfaceType> typeBound, List<AnnotationExpr> annotations) {
|
||||
this(range, name, typeBound);
|
||||
setTypeBound(typeBound);
|
||||
setAnnotations(annotations);
|
||||
}
|
||||
|
||||
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the paramenter.
|
||||
*
|
||||
* @return the name of the paramenter
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of {@link ClassOrInterfaceType} that this parameter
|
||||
* extends. Return <code>null</code> null if there are no type.
|
||||
*
|
||||
* @return list of types that this paramente extends or <code>null</code>
|
||||
*/
|
||||
public List<ClassOrInterfaceType> getTypeBound() {
|
||||
typeBound = ensureNotNull(typeBound);
|
||||
return typeBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this type parameter.
|
||||
*
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
@Override
|
||||
public TypeParameter setName(final String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list o types.
|
||||
*
|
||||
* @param typeBound
|
||||
* the typeBound to set
|
||||
*/
|
||||
public void setTypeBound(final List<ClassOrInterfaceType> typeBound) {
|
||||
this.typeBound = typeBound;
|
||||
setAsParentNodeOf(typeBound);
|
||||
}
|
||||
|
||||
public List<AnnotationExpr> getAnnotations() {
|
||||
annotations = ensureNotNull(annotations);
|
||||
return annotations;
|
||||
}
|
||||
|
||||
public void setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
setAsParentNodeOf(this.annotations);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class AnnotationDeclaration extends TypeDeclaration<AnnotationDeclaration> {
|
||||
|
||||
public AnnotationDeclaration() {
|
||||
}
|
||||
|
||||
public AnnotationDeclaration(EnumSet<Modifier> modifiers, String name) {
|
||||
super(modifiers, name);
|
||||
}
|
||||
|
||||
public AnnotationDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, String name,
|
||||
List<BodyDeclaration<?>> members) {
|
||||
super(annotations, modifiers, name, members);
|
||||
}
|
||||
|
||||
public AnnotationDeclaration(Range range, EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, String name,
|
||||
List<BodyDeclaration<?>> members) {
|
||||
super(range, annotations, modifiers, name, members);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.comments.JavadocComment;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.expr.Expression;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithJavaDoc;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithModifiers;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithName;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithType;
|
||||
import com.github.javaparser.ast.type.Type;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class AnnotationMemberDeclaration extends BodyDeclaration<AnnotationMemberDeclaration>
|
||||
implements NodeWithJavaDoc<AnnotationMemberDeclaration>, NodeWithName<AnnotationMemberDeclaration>,
|
||||
NodeWithType<AnnotationMemberDeclaration>, NodeWithModifiers<AnnotationMemberDeclaration> {
|
||||
|
||||
private EnumSet<Modifier> modifiers = EnumSet.noneOf(Modifier.class);
|
||||
|
||||
private Type type;
|
||||
|
||||
private String name;
|
||||
|
||||
private Expression defaultValue;
|
||||
|
||||
public AnnotationMemberDeclaration() {
|
||||
}
|
||||
|
||||
public AnnotationMemberDeclaration(EnumSet<Modifier> modifiers, Type type, String name, Expression defaultValue) {
|
||||
setModifiers(modifiers);
|
||||
setType(type);
|
||||
setName(name);
|
||||
setDefaultValue(defaultValue);
|
||||
}
|
||||
|
||||
public AnnotationMemberDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, Type type, String name,
|
||||
Expression defaultValue) {
|
||||
super(annotations);
|
||||
setModifiers(modifiers);
|
||||
setType(type);
|
||||
setName(name);
|
||||
setDefaultValue(defaultValue);
|
||||
}
|
||||
|
||||
public AnnotationMemberDeclaration(Range range, EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, Type type,
|
||||
String name, Expression defaultValue) {
|
||||
super(range, annotations);
|
||||
setModifiers(modifiers);
|
||||
setType(type);
|
||||
setName(name);
|
||||
setDefaultValue(defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this member declaration.
|
||||
*
|
||||
* @see Modifier
|
||||
* @return modifiers
|
||||
*/
|
||||
@Override
|
||||
public EnumSet<Modifier> getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setDefaultValue(Expression defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
setAsParentNodeOf(defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationMemberDeclaration setModifiers(EnumSet<Modifier> modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationMemberDeclaration setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationMemberDeclaration setType(Type type) {
|
||||
this.type = type;
|
||||
setAsParentNodeOf(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavadocComment getJavaDoc() {
|
||||
if (getComment() instanceof JavadocComment) {
|
||||
return (JavadocComment) getComment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.ensureNotNull;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithModifiers;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithName;
|
||||
|
||||
public abstract class BaseParameter<T>
|
||||
extends Node
|
||||
implements NodeWithAnnotations<T>, NodeWithName<T>, NodeWithModifiers<T> {
|
||||
private EnumSet<Modifier> modifiers = EnumSet.noneOf(Modifier.class);
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
private VariableDeclaratorId id;
|
||||
|
||||
public BaseParameter() {
|
||||
}
|
||||
|
||||
public BaseParameter(VariableDeclaratorId id) {
|
||||
setId(id);
|
||||
}
|
||||
|
||||
public BaseParameter(EnumSet<Modifier> modifiers, VariableDeclaratorId id) {
|
||||
setModifiers(modifiers);
|
||||
setId(id);
|
||||
}
|
||||
|
||||
public BaseParameter(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, VariableDeclaratorId id) {
|
||||
setModifiers(modifiers);
|
||||
setAnnotations(annotations);
|
||||
setId(id);
|
||||
}
|
||||
|
||||
public BaseParameter(final Range range, EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, VariableDeclaratorId id) {
|
||||
super(range);
|
||||
setModifiers(modifiers);
|
||||
setAnnotations(annotations);
|
||||
setId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list returned could be immutable (in that case it will be empty)
|
||||
*/
|
||||
@Override
|
||||
public List<AnnotationExpr> getAnnotations() {
|
||||
annotations = ensureNotNull(annotations);
|
||||
return annotations;
|
||||
}
|
||||
|
||||
public VariableDeclaratorId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getId().getName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public T setName(String name) {
|
||||
if (id != null)
|
||||
id.setName(name);
|
||||
else
|
||||
id = new VariableDeclaratorId(name);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this parameter declaration.
|
||||
*
|
||||
* @see Modifier
|
||||
* @return modifiers
|
||||
*/
|
||||
@Override
|
||||
public EnumSet<Modifier> getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param annotations a null value is currently treated as an empty list. This behavior could change
|
||||
* in the future, so please avoid passing null
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
setAsParentNodeOf(this.annotations);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public void setId(VariableDeclaratorId id) {
|
||||
this.id = id;
|
||||
setAsParentNodeOf(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T setModifiers(EnumSet<Modifier> modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.utils.Utils;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithAnnotations;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class BodyDeclaration<T> extends Node implements NodeWithAnnotations<T> {
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
public BodyDeclaration() {
|
||||
}
|
||||
|
||||
public BodyDeclaration(List<AnnotationExpr> annotations) {
|
||||
setAnnotations(annotations);
|
||||
}
|
||||
|
||||
public BodyDeclaration(Range range, List<AnnotationExpr> annotations) {
|
||||
super(range);
|
||||
setAnnotations(annotations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<AnnotationExpr> getAnnotations() {
|
||||
annotations = Utils.ensureNotNull(annotations);
|
||||
return annotations;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param annotations a null value is currently treated as an empty list. This behavior could change
|
||||
* in the future, so please avoid passing null
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final T setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
setAsParentNodeOf(this.annotations);
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.ensureNotNull;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ClassOrInterfaceDeclaration extends TypeDeclaration<ClassOrInterfaceDeclaration> {
|
||||
|
||||
private boolean interface_;
|
||||
|
||||
private List<TypeParameter> typeParameters;
|
||||
|
||||
// Can contain more than one item if this is an interface
|
||||
private List<ClassOrInterfaceType> extendsList;
|
||||
|
||||
private List<ClassOrInterfaceType> implementsList;
|
||||
|
||||
public ClassOrInterfaceDeclaration() {
|
||||
}
|
||||
|
||||
public ClassOrInterfaceDeclaration(final EnumSet<Modifier> modifiers, final boolean isInterface,
|
||||
final String name) {
|
||||
super(modifiers, name);
|
||||
setInterface(isInterface);
|
||||
}
|
||||
|
||||
public ClassOrInterfaceDeclaration(final EnumSet<Modifier> modifiers,
|
||||
final List<AnnotationExpr> annotations, final boolean isInterface,
|
||||
final String name,
|
||||
final List<TypeParameter> typeParameters,
|
||||
final List<ClassOrInterfaceType> extendsList,
|
||||
final List<ClassOrInterfaceType> implementsList,
|
||||
final List<BodyDeclaration<?>> members) {
|
||||
super(annotations, modifiers, name, members);
|
||||
setInterface(isInterface);
|
||||
setTypeParameters(typeParameters);
|
||||
setExtends(extendsList);
|
||||
setImplements(implementsList);
|
||||
}
|
||||
|
||||
public ClassOrInterfaceDeclaration(Range range, final EnumSet<Modifier> modifiers,
|
||||
final List<AnnotationExpr> annotations, final boolean isInterface,
|
||||
final String name,
|
||||
final List<TypeParameter> typeParameters,
|
||||
final List<ClassOrInterfaceType> extendsList,
|
||||
final List<ClassOrInterfaceType> implementsList,
|
||||
final List<BodyDeclaration<?>> members) {
|
||||
super(range, annotations, modifiers, name, members);
|
||||
setInterface(isInterface);
|
||||
setTypeParameters(typeParameters);
|
||||
setExtends(extendsList);
|
||||
setImplements(implementsList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(final VoidVisitor<A> v, final A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<ClassOrInterfaceType> getExtends() {
|
||||
extendsList = ensureNotNull(extendsList);
|
||||
return extendsList;
|
||||
}
|
||||
|
||||
public List<ClassOrInterfaceType> getImplements() {
|
||||
implementsList = ensureNotNull(implementsList);
|
||||
return implementsList;
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters() {
|
||||
typeParameters = ensureNotNull(typeParameters);
|
||||
return typeParameters;
|
||||
}
|
||||
|
||||
public boolean isInterface() {
|
||||
return interface_;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param extendsList a null value is currently treated as an empty list. This behavior could change
|
||||
* in the future, so please avoid passing null
|
||||
*/
|
||||
public void setExtends(final List<ClassOrInterfaceType> extendsList) {
|
||||
this.extendsList = extendsList;
|
||||
setAsParentNodeOf(this.extendsList);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param implementsList a null value is currently treated as an empty list. This behavior could change
|
||||
* in the future, so please avoid passing null
|
||||
*/
|
||||
public void setImplements(final List<ClassOrInterfaceType> implementsList) {
|
||||
this.implementsList = implementsList;
|
||||
setAsParentNodeOf(this.implementsList);
|
||||
}
|
||||
|
||||
public void setInterface(final boolean interface_) {
|
||||
this.interface_ = interface_;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param typeParameters a null value is currently treated as an empty list. This behavior could change
|
||||
* in the future, so please avoid passing null
|
||||
*/
|
||||
public void setTypeParameters(final List<TypeParameter> typeParameters) {
|
||||
this.typeParameters = typeParameters;
|
||||
setAsParentNodeOf(this.typeParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an extends to this class or interface and automatically add the import
|
||||
*
|
||||
* @param clazz the class to extand from
|
||||
* @return this, the {@link ClassOrInterfaceDeclaration}
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addExtends(Class<?> clazz) {
|
||||
tryAddImportToParentCompilationUnit(clazz);
|
||||
return addExtends(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an extends to this class or interface
|
||||
*
|
||||
* @param name the name of the type to extends from
|
||||
* @return this, the {@link ClassOrInterfaceDeclaration}
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addExtends(String name) {
|
||||
ClassOrInterfaceType classOrInterfaceType = new ClassOrInterfaceType(name);
|
||||
getExtends().add(classOrInterfaceType);
|
||||
classOrInterfaceType.setParentNode(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an implements to this class or interface
|
||||
*
|
||||
* @param name the name of the type to extends from
|
||||
* @return this, the {@link ClassOrInterfaceDeclaration}
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addImplements(String name) {
|
||||
ClassOrInterfaceType classOrInterfaceType = new ClassOrInterfaceType(name);
|
||||
getImplements().add(classOrInterfaceType);
|
||||
classOrInterfaceType.setParentNode(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an implements to this class or interface and automatically add the import
|
||||
*
|
||||
* @param clazz the type to implements from
|
||||
* @return this, the {@link ClassOrInterfaceDeclaration}
|
||||
*/
|
||||
public ClassOrInterfaceDeclaration addImplements(Class<?> clazz) {
|
||||
tryAddImportToParentCompilationUnit(clazz);
|
||||
return addImplements(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import static com.github.javaparser.utils.Utils.ensureNotNull;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.AccessSpecifier;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
import com.github.javaparser.ast.comments.JavadocComment;
|
||||
import com.github.javaparser.ast.expr.AnnotationExpr;
|
||||
import com.github.javaparser.ast.expr.NameExpr;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithBlockStmt;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithDeclaration;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithJavaDoc;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithModifiers;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithName;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithParameters;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithThrowable;
|
||||
import com.github.javaparser.ast.stmt.BlockStmt;
|
||||
import com.github.javaparser.ast.type.ReferenceType;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ConstructorDeclaration extends BodyDeclaration<ConstructorDeclaration>
|
||||
implements NodeWithJavaDoc<ConstructorDeclaration>, NodeWithDeclaration,
|
||||
NodeWithName<ConstructorDeclaration>, NodeWithModifiers<ConstructorDeclaration>,
|
||||
NodeWithParameters<ConstructorDeclaration>, NodeWithThrowable<ConstructorDeclaration>,
|
||||
NodeWithBlockStmt<ConstructorDeclaration> {
|
||||
|
||||
private EnumSet<Modifier> modifiers = EnumSet.noneOf(Modifier.class);
|
||||
|
||||
private List<TypeParameter> typeParameters;
|
||||
|
||||
private NameExpr name;
|
||||
|
||||
private List<Parameter> parameters;
|
||||
|
||||
private List<ReferenceType> throws_;
|
||||
|
||||
private BlockStmt body;
|
||||
|
||||
public ConstructorDeclaration() {
|
||||
}
|
||||
|
||||
public ConstructorDeclaration(EnumSet<Modifier> modifiers, String name) {
|
||||
setModifiers(modifiers);
|
||||
setName(name);
|
||||
}
|
||||
|
||||
public ConstructorDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations,
|
||||
List<TypeParameter> typeParameters,
|
||||
String name, List<Parameter> parameters, List<ReferenceType> throws_,
|
||||
BlockStmt block) {
|
||||
super(annotations);
|
||||
setModifiers(modifiers);
|
||||
setTypeParameters(typeParameters);
|
||||
setName(name);
|
||||
setParameters(parameters);
|
||||
setThrows(throws_);
|
||||
setBody(block);
|
||||
}
|
||||
|
||||
public ConstructorDeclaration(Range range, EnumSet<Modifier> modifiers,
|
||||
List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name,
|
||||
List<Parameter> parameters, List<ReferenceType> throws_, BlockStmt block) {
|
||||
super(range, annotations);
|
||||
setModifiers(modifiers);
|
||||
setTypeParameters(typeParameters);
|
||||
setName(name);
|
||||
setParameters(parameters);
|
||||
setThrows(throws_);
|
||||
setBody(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this member declaration.
|
||||
*
|
||||
* @see Modifier
|
||||
* @return modifiers
|
||||
*/
|
||||
@Override
|
||||
public EnumSet<Modifier> getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name == null ? null : name.getName();
|
||||
}
|
||||
|
||||
public NameExpr getNameExpr() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Parameter> getParameters() {
|
||||
parameters = ensureNotNull(parameters);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReferenceType> getThrows() {
|
||||
throws_ = ensureNotNull(throws_);
|
||||
return throws_;
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters() {
|
||||
typeParameters = ensureNotNull(typeParameters);
|
||||
return typeParameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDeclaration setModifiers(EnumSet<Modifier> modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDeclaration setName(String name) {
|
||||
setNameExpr(new NameExpr(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConstructorDeclaration setNameExpr(NameExpr name) {
|
||||
this.name = name;
|
||||
setAsParentNodeOf(this.name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDeclaration setParameters(List<Parameter> parameters) {
|
||||
this.parameters = parameters;
|
||||
setAsParentNodeOf(this.parameters);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDeclaration setThrows(List<ReferenceType> throws_) {
|
||||
this.throws_ = throws_;
|
||||
setAsParentNodeOf(this.throws_);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setTypeParameters(List<TypeParameter> typeParameters) {
|
||||
this.typeParameters = typeParameters;
|
||||
setAsParentNodeOf(this.typeParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration returned has this schema:
|
||||
*
|
||||
* [accessSpecifier] className ([paramType [paramName]])
|
||||
* [throws exceptionsList]
|
||||
*/
|
||||
@Override
|
||||
public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows,
|
||||
boolean includingParameterName) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (includingModifiers) {
|
||||
AccessSpecifier accessSpecifier = Modifier.getAccessSpecifier(getModifiers());
|
||||
sb.append(accessSpecifier.getCodeRepresenation());
|
||||
sb.append(accessSpecifier == AccessSpecifier.DEFAULT ? "" : " ");
|
||||
}
|
||||
sb.append(getName());
|
||||
sb.append("(");
|
||||
boolean firstParam = true;
|
||||
for (Parameter param : getParameters()) {
|
||||
if (firstParam) {
|
||||
firstParam = false;
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
if (includingParameterName) {
|
||||
sb.append(param.toStringWithoutComments());
|
||||
} else {
|
||||
sb.append(param.getType().toStringWithoutComments());
|
||||
}
|
||||
}
|
||||
sb.append(")");
|
||||
if (includingThrows) {
|
||||
boolean firstThrow = true;
|
||||
for (ReferenceType thr : getThrows()) {
|
||||
if (firstThrow) {
|
||||
firstThrow = false;
|
||||
sb.append(" throws ");
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(thr.toStringWithoutComments());
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows) {
|
||||
return getDeclarationAsString(includingModifiers, includingThrows, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeclarationAsString() {
|
||||
return getDeclarationAsString(true, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavadocComment getJavaDoc() {
|
||||
if (getComment() instanceof JavadocComment) {
|
||||
return (JavadocComment) getComment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStmt getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDeclaration setBody(BlockStmt body) {
|
||||
this.body = body;
|
||||
setAsParentNodeOf(body);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.comments.JavadocComment;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithJavaDoc;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EmptyMemberDeclaration extends BodyDeclaration<EmptyMemberDeclaration>
|
||||
implements NodeWithJavaDoc<EmptyMemberDeclaration> {
|
||||
|
||||
public EmptyMemberDeclaration() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
public EmptyMemberDeclaration(Range range) {
|
||||
super(range, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavadocComment getJavaDoc() {
|
||||
if(getComment() instanceof JavadocComment){
|
||||
return (JavadocComment) getComment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
|
||||
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
|
||||
*
|
||||
* This file is part of JavaParser.
|
||||
*
|
||||
* JavaParser can be used either under the terms of
|
||||
* a) the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* b) the terms of the Apache License
|
||||
*
|
||||
* You should have received a copy of both licenses in LICENCE.LGPL and
|
||||
* LICENCE.APACHE. Please refer to those files for details.
|
||||
*
|
||||
* JavaParser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
package com.github.javaparser.ast.body;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.visitor.GenericVisitor;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EmptyTypeDeclaration extends TypeDeclaration<EmptyTypeDeclaration> {
|
||||
|
||||
public EmptyTypeDeclaration() {
|
||||
super(null, EnumSet.noneOf(Modifier.class), null, null);
|
||||
}
|
||||
|
||||
public EmptyTypeDeclaration(Range range) {
|
||||
super(range, null, EnumSet.noneOf(Modifier.class), null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||