Compare commits

...
Author SHA1 Message Date
Eberhard Graether 9550ea1fdc delta time for loader 2016-07-08 14:37:49 +02:00
Eberhard Graether cad473c097 started with delay 2016-07-08 14:37:49 +02:00
Eberhard Graether 89264d97bb in code view 2016-07-08 14:37:49 +02:00
Eberhard Graether 096291a6c4 fixed animation 2016-07-08 14:37:49 +02:00
Eberhard Graether 1fcb241189 View interface 2016-07-08 14:37:49 +02:00
Eberhard Graether 996b33b1fb overlay for code view 2016-07-08 14:37:49 +02:00
Eberhard Graether fea26bfc60 animated loader with circles 2016-07-08 14:37:49 +02:00
Eberhard Graether 6a3717b8c1 basic overlay for graph view 2016-07-08 14:37:49 +02:00
Eberhard Graether 8b770b0c71 ui: Increase code view performance by caching line lengths in QtCodeArea 2016-07-08 14:36:12 +02:00
Eberhard Graether 06255286ae data: No implicit nodes in search autocompletion 2016-07-08 11:08:56 +02:00
Eberhard Graether 8a13aebc3f build: Added changelog for release 0.7.0.22 2016-07-07 14:32:01 +02:00
malte_langkabel 5bfd0ecbbe build: added size grip image to windows installer 2016-07-07 13:16:18 +02:00
Eberhard Graether e604c3b025 build: Fixes for release
* show custom icon for size grip
* add small margin at bottom of windows to show full shadow on Windows
* remove color_scheme_test keyword from autocompletions
* commented failing vs solution parser tests
2016-07-07 12:25:20 +02:00
Manuel Dobusch b683d7b2d6 logic: VS Solution Macro Handling
Added handling of project specific VS macros
2016-07-07 00:14:29 +02:00
malte_langkabel dbcb8f449c ui: removed clang warnings from console
* disabled clang warnings to be dumped into the console
* changed logging type of storage stats from WARNING to INFO
2016-07-06 18:22:02 +02:00
Andreas Stallinger 592cc99cee src: fix missing include
include memory for shared_ptr
2016-07-04 15:14:54 +02:00
Eberhard Graether 4e18389d38 ui: Added singleton QtContextMenu with global back and forward actions
* QtContextMenu holds default actions for back and forward
* additional actions can be passed to extend the default menu
* currently used in QtMainWindow and QtCodeArea
* fixed crash on undo when only view actions happened since project load

bug id = 108
2016-06-30 16:49:16 +02:00
Eberhard Graether 32f894422d ui: Made QtWindow resizeable with resize grip
* added size grip to bottom right corner of QtWindow
* use layouts on start screen
* added close button in about window to layout

bug id = 102
2016-06-30 13:52:18 +02:00
Eberhard Graether b5d9d20bc9 ui: fixed flickering of search autocompletions popup 2016-06-29 22:15:00 +02:00
Eberhard Graether cba0cfad65 logic: Fixed crashes and halting during indexing
* Fixed CPPSqliteException being thrown due to not properly destructed statement in addError
* Fixed indexer getting stuck after building caches because MessageFinishedParsing was interrupted
* removed Message::cancel() method and all related code

bug id = 105
2016-06-29 14:10:26 +02:00
Eberhard Graether ba3316008a build: Fixed MacOSX build crashing on launch due to unknown command line option
bug id = 103
2016-06-28 17:50:36 +02:00
Eberhard Graether 8ca54f2091 ui: removed 'Save Project' and 'Save Project As' actions
* removed save actions from menu in QtMainWindow
* removed MessageSaveProject and all Listeners
* updated project loading to ask whether old project and db file should be kept at old location
* fixed crash for missing include files
* fixed simple header search within source paths was broken
2016-06-28 15:59:22 +02:00
Eberhard Graether 2cf033d43a data: Speed up include parsing by reusing current path in PreprocessorCallbacks 2016-06-24 14:41:17 +02:00
Eberhard Graether 3430ed2a1b logic: Fixed spaces not working in search bar
The QShortcut members of QtMainWindow did not propagate the keypress events further. The keyPressEvent of QtMainWindow
is now used instead.
2016-06-24 13:54:54 +02:00
Eberhard Graether 140d4a406a logic: Fixed detected global search paths keep original order
The global header search paths were sorted alphabetically after detection due to checking for uniqueness. This caused
problems with #include_next directives in certain std header files that relied on the correct header search path order.

bug id = 101
2016-06-24 13:35:16 +02:00
Eberhard Graether 44cee3d130 web: Fixed syntax highlighting did not work on Mac due to missing language specification 2016-06-24 12:44:11 +02:00
malte_langkabel 5161455355 web: fixed clang post
<description>
2016-06-24 11:56:13 +02:00
malte_langkabel e7efff8843 web: indexing clang with coati using clang
* added new blog post
* implemented play button for gifs
2016-06-23 17:53:36 +02:00
Eberhard Graether 7f867bf889 ui: added color_scheme_test command displaying all graph node types and states
implementations for other views comming.
2016-06-22 16:14:06 +02:00
malte_langkabel 36c504d8a0 build: added missing include 2016-06-21 10:35:38 +02:00
Eberhard Graether 9560cc4ea6 utility: Added Tracer for collecting time measurements
* define TRACING_ENABLED in utility/tracing.h to enable tracing
* invoke TraceEvent by writing TRACE() at start of function or scope
* provide an event name with TRACE("name")
* press SPACE to show collected traces history and report with accumulated times
2016-06-16 12:03:34 +02:00
Eberhard Graether 6b31a43f75 blog: post for release 0.7 2016-06-16 10:03:05 +02:00
Eberhard Graether b4c094e784 docs: Updated documentation to 0.7.0 2016-06-16 10:00:50 +02:00
Eberhard Graether 7227a47b49 build: Changelog for 0.7.0 2016-06-16 09:57:15 +02:00
malte_langkabel 0aa97adb17 data: fixed tutorial includes 2016-06-14 17:21:55 +02:00
malte_langkabel 247be13650 build: updated windows deploy
* added vim plugin directory to package
* changed version number of installer
2016-06-14 16:19:09 +02:00
malte_langkabel 2b93bdc283 src: headless crash
* fixed crash when loading project in headless mode
2016-06-14 16:02:40 +02:00
malte_langkabel 98b13ef24d ui: overlay window base size
* added property in application settings to define a basic width and height that is used when creating new overlay windows.
* fixed crash in tests
2016-06-14 15:27:03 +02:00
Eberhard Graether b7ba10e119 script: Added vim to plugins in Mac bundle 2016-06-14 12:50:15 +02:00
Eberhard Graether 253af27067 ui: changed wording in the UI to indexing instead of analysing 2016-06-14 12:45:13 +02:00
Andreas Stallinger 83e4bcd049 build: vim plugin readme added to linux package
<description>
2016-06-14 12:41:23 +02:00
Andreas Stallinger 2125396665 utility: vim plugin
readme for vim plugin added to ide_plugins
2016-06-14 12:34:43 +02:00
Eberhard Graether 1c0c2e78df data: Cache current file path in PreprocessorCallbacks to avoid lookup for every macro directive 2016-06-14 10:41:41 +02:00
Eberhard Graether b9c0f9ed3e data: Fixed macro expand location was wrong when used within expansion of different file 2016-06-14 00:01:36 +02:00
Eberhard Graether 72a48f997f logic: Avoid reparsing when no project files nothing changed 2016-06-13 23:21:35 +02:00
Eberhard Graether 986f67df8e data: Removed error logs in CxxDeclNameResolver.cpp
bug id = 94
2016-06-13 22:50:02 +02:00
Eberhard Graether 208f2b1158 ui: Changed full text search character to ? and added shortcut CTRL+SHIFT+F 2016-06-13 21:07:14 +02:00
Eberhard Graether b07d03692d logic: Reworked CDB project setup
* added separate step for project name, project location and cdb path
* added description that project stays up-to-date under cdb path picker.
* added include and framework paths to advanced settings
* disregard source extensions for cdb projects

bug id = 70
2016-06-13 16:43:37 +02:00
Eberhard Graether aae388d8ee logic: Check compilation database path before refreshing 2016-06-12 11:21:18 +02:00
Eberhard Graether b57171552f ui: Added download link to start screen 2016-06-12 10:12:27 +02:00
Eberhard Graether be3ba0ba23 ui: Added status messages for fulltext search 2016-06-12 09:35:11 +02:00
Eberhard Graether 19e26268cf build: Added Qt gif plugin to fix loader gif in release build not working 2016-06-11 04:14:10 +02:00
Eberhard Graether 77080464d7 data: Analyze all types of macro usage 2016-06-11 03:46:44 +02:00
Eberhard Graether 594bb41a6f logic: Fixed app can't find user data after parsing CDB because working directory changed 2016-06-11 03:09:04 +02:00
Eberhard Graether c5af4ed4e5 data: Fixed files being consumed by multiple threads 2016-06-11 02:25:19 +02:00
Eberhard Graether 6821fd1c9a data: Fixed macro expands not saved within macro expands 2016-06-10 22:24:14 +02:00
Eberhard Graether 7e3b2622ec src: miscellaneous bug fixes for upcoming release
* only randomize parsing order of source files for multithreaded indexing
* fixed overview not displayed when switching projects due to MessageScrollCode being dispatched
* avoid adding duplicate TokenLocations that causes highlighting to break in QtCodeArea
* clear all controllers when switching project
* maximize unindexed file when clicking title instead of activating it
2016-06-09 12:30:00 +02:00
Eberhard Graether 5173400b8d logic: Showing annotations in fulltext search results
* new LocationType for errors
* refactored CodeController
* cache active locations in CodeController for later manipulations
2016-06-08 20:33:34 +02:00
Eberhard Graether c6fa1f0969 ui: Defined colors for fulltext search and fulltext code highlights 2016-06-07 15:10:09 +02:00
Eberhard Graether b10c55e7f9 src: Added logic and UI for excluding files and directories from analysis
bug id = 68, 47
2016-06-07 10:46:36 +02:00
Andreas Stallinger 6edcd77eb2 logic: fulltextsearch with suffixarray
* delete test.sqlite in storagetestsuite in desstructor
* remove new and delete from suffixarray
* case sensitive fts
* fixed fulltext results annotated like errors
* lazy suffix array building
* fulltextsearch folder added
* go back too branch without _publish
* suffixarray working
* logic: Improved code view performance
2016-06-07 08:49:34 +02:00
Eberhard Graether 53120cf270 ui: fixed autocompletion list highlights wrong for large indices 2016-06-06 15:40:46 +02:00
Eberhard Graether 468e55f078 ui: Repaint graph view after animation to remove artifacts
bug id = 75
2016-05-31 16:44:24 +02:00
Eberhard Graether ab43d309cb data: optimize memory of sqlite database
* use sqlite "VACUUM" after analysis to reduce memory size
* only add filename to name of local symbol
2016-05-31 15:49:12 +02:00
Eberhard Graether da01855b68 ui: Fixed edge name showing when undoing and redoing 2016-05-31 14:15:50 +02:00
Eberhard Graether 2660465b31 ui: Fixed derived bundle layouted to wrong bucket 2016-05-31 14:02:30 +02:00
Eberhard Graether dfcb9214f4 build: Fixed broken code view style due to app changing working directory while analysing from compilation database 2016-05-31 13:17:36 +02:00
Eberhard Graether d6e2c46420 data: Catch sqlite database close exception that happens sometimes 2016-05-31 12:34:07 +02:00
Eberhard Graether 8222729bb9 logic: Removed undo step for graph and code view manipulations
* graph node moving
* graph node expanding
* code file expanding
* scope expanding
2016-05-31 12:12:05 +02:00
Eberhard Graether 3f032ea822 data: Fixed macro definition not connected to file 2016-05-30 17:06:35 +02:00
Eberhard Graether 5a6e042c8f logic: Removed ActivationTranslator and show old token names in search field 2016-05-30 16:00:55 +02:00
Eberhard Graether 5bb6902cdf src: remove unused stuff
* PersistenStorage::removeUnusedNames
* Dictionary
* DictionaryTestSuite
2016-05-30 14:23:50 +02:00
Eberhard Graether 71cf6bb5f4 logic: randomize source file parsing order to reduce header file double parsing
saves 20% parsing time for Coati
2016-05-30 12:21:39 +02:00
malte_langkabel f02169b08e data: more compiled statements
* added some more statement compilations regarding dangerous names.
2016-05-27 17:20:33 +02:00
Andreas Stallinger 4b734a05f9 utility: Sublime Plugin, import idna encoding
* include fileinfo in fileregister instead of include (for unordered_map)
* sublimeplugin import idna encoading
2016-05-27 12:26:52 +02:00
Eberhard Graether 6165d2fffa ui: Fixed edge drawn wrong when leaving from child nod of smaller node 2016-05-27 12:06:16 +02:00
Eberhard Graether 4e08d86602 logic: Fixed base and derived classes not correctly at top or bottom
Prioritize inheritance and override over all other edges.
2016-05-23 15:58:31 +02:00
malte_langkabel d80a123a5a logic: PARSING files are UNPARSED
* changed ***FileIsUnparsed in FileRegister to disregard files that are currently parsing.
* made Cach more generic by adding the option of providing a custom hasher
2016-05-23 14:58:48 +02:00
Eberhard Graether badad741b0 logic: Fixed slow aggregation click and nodes not staying expanded 2016-05-21 04:44:31 +02:00
Eberhard Graether 5d2a476813 logic: Improved graph and code view performance
* added sql index for component_access
* improved policy for expanded code files
* reduced amount of initially expanded code files
* faster DummyEdge creation
* faster DummyNode search by token id
* switched GraphController DummyNodes and DummyEdges to shared_ptr for memory safety
2016-05-21 00:01:46 +02:00
malte_langkabel 4a6f8cf420 src: crash fixes
* fixed crash when snippet has no code.
* fixed crash when saving a filenode with special characters in its name
* fixed crash when aborting the parsing
2016-05-20 13:52:37 +02:00
Eberhard Graether 946be38fa2 utility: Fixed FilePath::contains 2016-05-20 12:52:37 +02:00
Eberhard Graether 86d1ff2905 logic: Changed include files being analyzed solely by path
* removed header extensions
* added source extensions to source path setup screen
* added caching to hasFilePath check
* don't show header list in CDB setup
* removed TestSettings.xml
2016-05-19 21:47:09 +02:00
Manuel Dobusch 5295267513 ui: generic solution parser
completed first version of generic solution parsers
2016-05-18 16:50:26 +02:00
Manuel Dobusch 2f25279662 logic: vs solution parsing fix
Fixed issue with vs internal macros
2016-05-18 14:19:41 +02:00
Eberhard Graether e943ef149e ui: Added more settings to the preferences
Added font face, font size, tab width, analysis threads
2016-05-18 11:15:28 +02:00
malte_langkabel e40459e71d src: storage refactoring
* used the getFirst/getAll template methods throughout the SqliteStorage.
* renamed LambdaTask to TaskLambda to match our naming convention.
2016-05-17 17:09:18 +02:00
malte_langkabel cb9dde6641 logic: fix local symbols in lambda
* fixed the isImplicit method of the ASTVisitor to use the parent context to determine if a lambda record is implicit.
2016-05-17 16:30:26 +02:00
Eberhard Graether 4097493181 ui: Sort snippets to always show definition on top 2016-05-17 15:26:45 +02:00
Eberhard Graether 9f80bcbcb7 ui: Fixed nodes not sorted when expanding in overview 2016-05-17 14:47:36 +02:00
Eberhard Graether 79f788db2e ui: sort buckets in graph layout alphabetically and put bundles at end 2016-05-17 14:28:22 +02:00
malte_langkabel 67e4d84631 logic: indexer count and fixes
* added option to define the amount of parallel indexers in the appsettings
* fixed unparsed files query in ASTVisitor
* fixed: to update a node's type in the storage the node does not have to be defined anymore
2016-05-13 16:30:16 +02:00
Eberhard Graether 7bb40f2630 logic: Simplified node bundling by collecting relevant data upfront 2016-05-13 14:17:20 +02:00
malte_langkabel c61efbbcde logic: multithreaded parsing
* modified the TaskParseCxx to be able to run multiple times in parallel
* made FileRegister threadsafe and changed a lot of its mechanisms
* added TaskGroupParallel that runs all children in parallel
* added TaskParseWrapper that acts as a decorator to execute some code before and after parsing.
* implemented task setup in project with 4 parsing threads
* removed SimpleTask as it was only used as interface for the LambdaTask
2016-05-13 13:23:54 +02:00
Eberhard Graether 245cafdc7b logic: Improved code view performance
* fixed bottleneck in TokenLocationCollection::findLocationFile()
* cache file ids and paths in PersistenStorage
2016-05-12 22:50:14 +02:00
malte_langkabel 6a576bccc9 src: storage refactoring
* renamed Storage to PersistentStorage
* added Storage as baseclass that implements data injection
* cleaned ParserClient interface
* added default constructors for storage types
* cleaned SqlteStorage by implementing the private getAll methods as template specializations
* added CXX flags to CMakeLists (this is needed for sqlite with visual studio)
* removed TestStorage.h/.cpp since these files were not used anymore.
2016-05-11 13:23:31 +02:00
Andreas Stallinger 2a73c42a18 ui: Colorscheme update for Fulltextsearch 2016-05-10 15:34:06 +02:00
Eberhard Graether 9148a4fafb ui: Fixed file button in code file title bar not visible 2016-05-10 14:25:39 +02:00
Eberhard Graether c4ef18fb6d web: Added jekyll blog with hpstr theme and first post for release 0.6
The README contains the commands for building the blog in all different configurations.
2016-05-10 14:10:21 +02:00
351 changed files with 17547 additions and 5224 deletions
+11 -12
View File
@@ -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 --------------------------------------------------------------------
@@ -40,6 +33,9 @@ endif ()
project(${PROJECT_NAME})
# set Standerd build type to Release
set(CMAKE_BUILD_TYPE_INIT "Release")
#RPATH
if(UNIX AND NOT APPLE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
@@ -50,16 +46,19 @@ if(UNIX AND NOT APPLE)
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(-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 ()
# enable fts4 module for sqlite
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS4_PARENTHESIS")
# Clang ------------------------------------------------------------------------
if (UNIX AND APPLE)
+59
View File
@@ -94,6 +94,65 @@ $ git push --tags
### Changelog
#### 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
+4 -1
View File
@@ -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>
+48 -20
View File
@@ -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>
@@ -123,29 +151,23 @@
<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>
</fulltext>
</selection>
</snippet>
</code>
@@ -260,6 +282,12 @@
<normal>#20FFFFFF</normal>
<focus>#FFFFFF</focus>
</border>
<text>
<normal>#FFFFFF</normal>
</text>
<icon>
<normal>#FFFFFF</normal>
</icon>
</file>
<macro>
<like>file</like>
+40 -21
View File
@@ -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>
@@ -121,14 +149,6 @@
<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>
@@ -137,16 +157,15 @@
<text>#000000</text>
</normal>
<focus>
<border>transparent</border>
<fill>#FFFF0000</fill>
<text>#000000</text>
</focus>
<active>
<border>transparent</border>
<fill>#FFFF0000</fill>
<text>#000000</text>
</active>
</error>
<fulltext>
<normal>
<fill>#C7C7E2</fill>
<text>#000000</text>
</normal>
</fulltext>
</selection>
</snippet>
</code>
+60 -19
View File
@@ -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>
@@ -123,29 +170,23 @@
<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>
</fulltext>
</selection>
</snippet>
</code>
+11 -9
View File
@@ -2,16 +2,13 @@
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 {
@@ -36,6 +36,18 @@
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 {
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+10
View File
@@ -25,7 +25,17 @@
margin-left: 20px;
}
#description {
font-size: 12pt;
}
#label {
font-size: 12pt;
font-weight: bold;
}
#titleLabel {
font-size: 14pt;
font-weight: bold;
}
+1 -1
View File
@@ -1 +1 @@
%windir%\system32\msiexec.exe /I{A54890F6-A227-4BEC-8086-DF08B9B4D0D1}
%windir%\system32\msiexec.exe /I{E6E16577-C547-4A66-8202-AB30A02DDBC2}
+1 -1
View File
@@ -1 +1 @@
%windir%\system32\msiexec.exe /I{8732C041-A948-4D7F-BE08-FBCEF8BF4586}
%windir%\system32\msiexec.exe /I{225E11DF-20A0-4AE0-AD5C-00944A9E3D71}
@@ -3,6 +3,7 @@
#include "player.h"
class HumanPlayer : public Player {
public:
HumanPlayer( Field::Token token, const char* name );
@@ -2,6 +2,19 @@
#define MAIN_H
#include "code_tutorial_1.h"
#include "code_tutorial_2.h"
#include "code_tutorial_3.h"
#include "graph_tutorial_1.h"
#include "graph_tutorial_2.h"
#include "graph_tutorial_3.h"
#include "graph_tutorial_4.h"
#include "search_tutorial_1.h"
#include "search_tutorial_2.h"
#include "search_tutorial_3.h"
#include "search_tutorial_4.h"
#include "search_tutorial_5.h"
#include "my_first_step.h"
//------------------------------------------------------------------------------
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<config>
<user>
<recent_projects>
<recent_project>./data/projects/tutorial/tutorial.coatiproject</recent_project>
<recent_project>./data/projects/tictactoe/tictactoe.coatiproject</recent_project>
</recent_projects>
</user>
<application>
<indexer_thread_count>4</indexer_thread_count>
<window_base_width>500</window_base_width>
<window_base_height>500</window_base_height>
</application>
<user>
<recent_projects>
<recent_project>./data/projects/tutorial/tutorial.coatiproject</recent_project>
<recent_project>./data/projects/tictactoe/tictactoe.coatiproject</recent_project>
</recent_projects>
</user>
</config>
@@ -29,6 +29,9 @@
<font_size_max><!-- INTEGER: maximum font size in pt --></font_size_max>
<font_size_min><!-- INTEGER: minimum font size in pt --></font_size_min>
<font_size_std><!-- INTEGER: standard font size in pt --></font_size_std>
<indexer_thread_count><!-- INTEGER: number of threads indexing the source code --></indexer_thread_count>
<window_base_width><!-- INTEGER: initial width of an overlay window --></window_base_width>
<window_base_height><!-- INTEGER: initial height of an overlay window --></window_base_height>
</application>
<code>
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- INTEGER: int e.g 123 -->
<!-- DECIMAL: float e.g 123.456 -->
<!-- STRING: string e.g hello -->
<!-- COLOR: int int int int - rgba e.g. 125 125 125 255 -->
<config>
<source>
<HeaderSearchPaths>
<HeaderSearchPath><!-- STRING: header search path for each path a HeaderSearchPaht element--></HeaderSearchPath>
</HeaderSearchPaths>
</source>
</config>
+8
View File
@@ -47,3 +47,11 @@ NetworkProtocolHelper.cpp ERROR: Failed to parse message, invalid type token
NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
TextAccess.cpp ERROR: Could not open file path/to/test.h
TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 3 > 2
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
TextAccess.cpp WARNING: Line numbers start with one, is 0
TextAccess.cpp WARNING: Line numbers start with one, is 0
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 2:3 2:1
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 4:1 1:10
+6
View File
@@ -107,6 +107,12 @@ INSTALL(DIRECTORY
COMPONENT FULL
)
INSTALL(DIRECTORY
${CMAKE_SOURCE_DIR}/ide_plugins/vim
DESTINATION plugin
COMPONENT FULL
)
INSTALL(DIRECTORY
${CMAKE_SOURCE_DIR}/bin/app/data/projects
DESTINATION user
+8 -4
View File
@@ -2,12 +2,16 @@
find_package(PythonInterp REQUIRED)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/script/getSystemString.py"
OUTPUT_VARIABLE SYSSTRING
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/script/getSystemString.py"
OUTPUT_VARIABLE SYSSTRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(EXTERNAL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Coati_External")
set(EXTERNAL_SRC "${EXTERNAL_ROOT}/src")
set(EXTERNAL_BUILD "${EXTERNAL_ROOT}/${SYSSTRING}/${CMAKE_BUILD_TYPE}")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(EXTERNAL_BUILD "${EXTERNAL_ROOT}/${SYSSTRING}/Debug")
else()
set(EXTERNAL_BUILD "${EXTERNAL_ROOT}/${SYSSTRING}/Release")
endif()
+3 -1
View File
@@ -4,6 +4,8 @@
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_VERSION_NUMBER}")
message(STATUS "Get Public Key for Coati version: ${VERSION_MAJOR}")
message(STATUS "${CMAKE_SOURCE_DIR}/setup/RSA_keys/public-${VERSION_MAJOR}.pem")
set(pubKeyFile "${CMAKE_SOURCE_DIR}/setup/RSA_keys/public-${VERSION_MAJOR}.pem")
# message(STATUS "file: ${pubKeyFile}")
@@ -13,7 +15,7 @@ if(EXISTS ${pubKeyFile})
STRING(REGEX REPLACE "\n" "\\\\n\"\n\t\"" KEY "${KEY}")
# message(STATUS "key: ${KEY}")
else()
message(WARNING "public keyfile for this version of Coati")
message(WARNING "public keyfile for this version of Coati not found")
endif()
configure_file(
@@ -501,6 +501,12 @@
}
"Entry"
{
"MsmKey" = "8:_8C02107F94A64029901B8B190E8C6BAC"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_8E2479A7DD6C48F88B7BCC1567A53892"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
@@ -862,7 +868,7 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_C84BE68F0D9E42D3B9BD9C8A53DF049A"
"OwnerKey" = "8:_FB29EAD658C3497D9AC46ADE92D33C83"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -874,7 +880,7 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_FB29EAD658C3497D9AC46ADE92D33C83"
"OwnerKey" = "8:_C84BE68F0D9E42D3B9BD9C8A53DF049A"
"MsmSig" = "8:_UNDEFINED"
}
}
@@ -2776,6 +2782,26 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8C02107F94A64029901B8B190E8C6BAC"
{
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\data\\gui\\window\\size_grip.png"
"TargetName" = "8:size_grip.png"
"Tag" = "8:"
"Folder" = "8:_56A98FDB83CE48C489B793615E24C057"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8E2479A7DD6C48F88B7BCC1567A53892"
{
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\data\\projects\\tutorial\\src\\code_tutorial_2.h"
@@ -4284,15 +4310,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Coati"
"ProductCode" = "8:{A54890F6-A227-4BEC-8086-DF08B9B4D0D1}"
"PackageCode" = "8:{1EFFC244-8CCC-46E4-B6AC-F789BF1F7F18}"
"ProductCode" = "8:{E6E16577-C547-4A66-8202-AB30A02DDBC2}"
"PackageCode" = "8:{55D5307B-C6AB-4E1D-A512-239F7E164FCD}"
"UpgradeCode" = "8:{CFF09D53-87AF-4241-960D-98C21ED9D358}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:0.6.0000"
"ProductVersion" = "8:0.7.0022"
"Manufacturer" = "8:Coati Software"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:www.coati.io/support"
@@ -5253,7 +5279,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_3460FAB707F8431E87168499A7F51556"
{
"SourcePath" = "8:..\\SetupApplicationSettingsLib\\obj\\Release\\SetupApplicationSettingsLib.dll"
"SourcePath" = "8:..\\SetupApplicationSettingsLib\\obj\\Debug\\SetupApplicationSettingsLib.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -5281,7 +5307,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_C84BE68F0D9E42D3B9BD9C8A53DF049A"
{
"SourcePath" = "8:..\\SetupCreateStartMenuShortcutLib\\obj\\Release\\SetupCreateStartMenuShortcutLib.dll"
"SourcePath" = "8:..\\SetupCreateStartMenuShortcutLib\\obj\\Debug\\SetupCreateStartMenuShortcutLib.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -5309,7 +5335,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_F81B906E39E44A5DAC37B3D70BC8A8CE"
{
"SourcePath" = "8:..\\SetupCreateDesktopShortcutLib\\obj\\Release\\SetupCreateDesktopShortcutLib.dll"
"SourcePath" = "8:..\\SetupCreateDesktopShortcutLib\\obj\\Debug\\SetupCreateDesktopShortcutLib.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -5337,7 +5363,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FB29EAD658C3497D9AC46ADE92D33C83"
{
"SourcePath" = "8:..\\SetupRemoveCacheFiles\\obj\\Release\\SetupRemoveCacheFiles.dll"
"SourcePath" = "8:..\\SetupRemoveCacheFiles\\obj\\Debug\\SetupRemoveCacheFiles.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -219,6 +219,12 @@
}
"Entry"
{
"MsmKey" = "8:_41D7E42E67AA4615BEC19409547F70A2"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_4400372852214CC588823F7A1A9F5F5D"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
@@ -1868,6 +1874,26 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_41D7E42E67AA4615BEC19409547F70A2"
{
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\data\\gui\\window\\size_grip.png"
"TargetName" = "8:size_grip.png"
"Tag" = "8:"
"Folder" = "8:_991DBD2EDC144CE79F23005FB99BF9AF"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4400372852214CC588823F7A1A9F5F5D"
{
"SourcePath" = "8:..\\..\\..\\..\\bin\\app\\Release\\Qt5Gui.dll"
@@ -4313,15 +4339,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Coati Trial"
"ProductCode" = "8:{8732C041-A948-4D7F-BE08-FBCEF8BF4586}"
"PackageCode" = "8:{11F55D62-3346-49A5-AD7B-FCA50F3C1D98}"
"ProductCode" = "8:{225E11DF-20A0-4AE0-AD5C-00944A9E3D71}"
"PackageCode" = "8:{AFEFFBA8-DE40-4FD1-84A9-ACE53FE97555}"
"UpgradeCode" = "8:{00D35BB8-F11C-4179-9962-47B3D55E412C}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:0.6.0000"
"ProductVersion" = "8:0.7.0022"
"Manufacturer" = "8:Coati Software"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:www.coati.io/support"
@@ -5282,7 +5308,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_3460FAB707F8431E87168499A7F51556"
{
"SourcePath" = "8:..\\SetupApplicationSettingsLib\\obj\\Release\\SetupApplicationSettingsLib.dll"
"SourcePath" = "8:..\\SetupApplicationSettingsLib\\obj\\Debug\\SetupApplicationSettingsLib.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -5310,7 +5336,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_C84BE68F0D9E42D3B9BD9C8A53DF049A"
{
"SourcePath" = "8:..\\SetupCreateStartMenuShortcutLib\\obj\\Release\\SetupCreateStartMenuShortcutLib.dll"
"SourcePath" = "8:..\\SetupCreateStartMenuShortcutLib\\obj\\Debug\\SetupCreateStartMenuShortcutLib.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -5338,7 +5364,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_F81B906E39E44A5DAC37B3D70BC8A8CE"
{
"SourcePath" = "8:..\\SetupCreateDesktopShortcutLib\\obj\\Release\\SetupCreateDesktopShortcutLib.dll"
"SourcePath" = "8:..\\SetupCreateDesktopShortcutLib\\obj\\Debug\\SetupCreateDesktopShortcutLib.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -5366,7 +5392,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FB29EAD658C3497D9AC46ADE92D33C83"
{
"SourcePath" = "8:..\\SetupRemoveCacheFiles\\obj\\Release\\SetupRemoveCacheFiles.dll"
"SourcePath" = "8:..\\SetupRemoveCacheFiles\\obj\\Debug\\SetupRemoveCacheFiles.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A96454F2CE0E4C55B59EDE1094D40E56"
@@ -3,6 +3,7 @@ import sublime_plugin
import threading
import socket
import os.path
import encodings.idna
try: # use this for Sublime Text 2
import SocketServer
+5
View File
@@ -0,0 +1,5 @@
#vim-coati
The vim plugin is hosted at Github.
Link to the repository: [vim-coati](https://github.com/CoatiSoftware/vim-coati).
+4 -2
View File
@@ -129,10 +129,12 @@ mkdir -p $APP_PACKAGE_DIR
cp -u -r deployment/windows/CoatiAppSetup/CoatiSetup/Release/Coati.msi $APP_PACKAGE_DIR/
cp -u -r deployment/windows/CoatiAppSetup/CoatiSetup/Release/setup.exe $APP_PACKAGE_DIR/
mkdir -p $APP_PACKAGE_DIR/plugins/visual_studio/
cp -u -r ide_plugins/vs/coati_plugin_vs.vsix $APP_PACKAGE_DIR/plugins/visual_studio/
mkdir -p $APP_PACKAGE_DIR/plugins/sublime_text/
cp -u -r ide_plugins/sublime_text/* $APP_PACKAGE_DIR/plugins/sublime_text/
mkdir -p $APP_PACKAGE_DIR/plugins/vim/
cp -u -r ide_plugins/vim/* $APP_PACKAGE_DIR/plugins/vim/
mkdir -p $APP_PACKAGE_DIR/plugins/visual_studio/
cp -u -r ide_plugins/vs/coati_plugin_vs.vsix $APP_PACKAGE_DIR/plugins/visual_studio/
# PACKAGING COATI (APP)
+1 -1
View File
@@ -20,5 +20,5 @@ cp -rn $COATI_PATH/user/* ${HOME}/.config/coati/
export LD_LIBRARY_PATH="$COATI_PATH/lib:LD_LIBRARY_PATH"
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:$QT_XKB_CONFIG_ROOT"
#export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
exec $COATI_PATH/Coati $@
+1 -1
View File
@@ -21,6 +21,6 @@ cp -nr $COATI_PATH/user/* ${HOME}/.config/coatitrial/
export LD_LIBRARY_PATH="$COATI_PATH/lib:LD_LIBRARY_PATH"
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:$QT_XKB_CONFIG_ROOT"
#export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
exec $COATI_PATH/Coati_trial
+1 -1
View File
@@ -27,7 +27,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<string>@GIT_VERSION_NUMBER@</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
+1 -1
View File
@@ -27,7 +27,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<string>@GIT_VERSION_NUMBER@</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
+19 -10
View File
@@ -54,7 +54,7 @@ fi
BUNDLE_PATH=$PACKAGE_DIR/$BUNDLE_NAME.app
BIN_DIR=$BUNDLE_PATH/Contents/MacOS
DYNLIB_DIR=$BUNDLE_PATH/Contents/lib
PLUGIN_DIR=$BUNDLE_PATH/Contents/PlugIns/platforms
PLUGIN_DIR=$BUNDLE_PATH/Contents/PlugIns
FRAMEWORK_DIR=$BUNDLE_PATH/Contents/Frameworks
RES_DIR=$BUNDLE_PATH/Contents/Resources
APP_PATH=$BIN_DIR/$APP_NAME
@@ -70,6 +70,7 @@ echo -e $INFO "Copying top level contents."
mkdir -p $PACKAGE_DIR/plugins/visual_studio/
cp -r ../../../ide_plugins/vs/coati_plugin_vs.vsix $PACKAGE_DIR/plugins/visual_studio/
cp -R ../../../ide_plugins/sublime_text $PACKAGE_DIR/plugins/sublime_text/
cp -R ../../../ide_plugins/vim $PACKAGE_DIR/plugins/vim/
cp ../data/gui/installer/EULA.rtf $PACKAGE_DIR/EULA.rtf
@@ -125,7 +126,11 @@ done
echo -e $INFO "Copying Plugins"
cp $QT_DIR/plugins/platforms/libqcocoa.dylib $PLUGIN_DIR/libqcocoa.dylib
mkdir -p $PLUGIN_DIR/platforms
mkdir -p $PLUGIN_DIR/imageformats
cp $QT_DIR/plugins/platforms/libqcocoa.dylib $PLUGIN_DIR/platforms/libqcocoa.dylib
cp $QT_DIR/plugins/imageformats/libqgif.dylib $PLUGIN_DIR/imageformats/libqgif.dylib
echo -e $INFO "Copying frameworks."
@@ -153,11 +158,14 @@ install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_
install_name_tool -change @rpath/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui $FRAMEWORK_DIR/QtPrintSupport.framework/Versions/5/QtPrintSupport
install_name_tool -change @rpath/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets $FRAMEWORK_DIR/QtPrintSupport.framework/Versions/5/QtPrintSupport
install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore $PLUGIN_DIR/libqcocoa.dylib
install_name_tool -change @rpath/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui $PLUGIN_DIR/libqcocoa.dylib
install_name_tool -change @rpath/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets $PLUGIN_DIR/libqcocoa.dylib
install_name_tool -change @rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport @executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport $PLUGIN_DIR/libqcocoa.dylib
install_name_tool -change @rpath/QtDBus.framework/Versions/5/QtDBus @executable_path/../Frameworks/QtDBus.framework/Versions/5/QtDBus $PLUGIN_DIR/libqcocoa.dylib
install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore $PLUGIN_DIR/platforms/libqcocoa.dylib
install_name_tool -change @rpath/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui $PLUGIN_DIR/platforms/libqcocoa.dylib
install_name_tool -change @rpath/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets $PLUGIN_DIR/platforms/libqcocoa.dylib
install_name_tool -change @rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport @executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport $PLUGIN_DIR/platforms/libqcocoa.dylib
install_name_tool -change @rpath/QtDBus.framework/Versions/5/QtDBus @executable_path/../Frameworks/QtDBus.framework/Versions/5/QtDBus $PLUGIN_DIR/platforms/libqcocoa.dylib
install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore $PLUGIN_DIR/imageformats/libqgif.dylib
install_name_tool -change @rpath/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui $PLUGIN_DIR/imageformats/libqgif.dylib
install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore $FRAMEWORK_DIR/QtDBus.framework/Versions/5/QtDBus
@@ -170,7 +178,8 @@ otool -L $FRAMEWORK_DIR/QtWidgets.framework/Versions/5/QtWidgets
otool -L $FRAMEWORK_DIR/QtPrintSupport.framework/Versions/5/QtPrintSupport
otool -L $FRAMEWORK_DIR/QtDBus.framework/Versions/5/QtDBus
otool -L $FRAMEWORK_DIR/QtNetwork.framework/Versions/5/QtNetwork
otool -L $PLUGIN_DIR/libqcocoa.dylib
otool -L $PLUGIN_DIR/platforms/libqcocoa.dylib
otool -L $PLUGIN_DIR/imageformats/libqgif.dylib
echo -e $INFO "App dependencies"
@@ -214,11 +223,11 @@ convert $ICON -resize 1024x1024 $ICON_SET/icon_512x512@2x.png
iconutil -c icns -o $RES_DIR/project.icns $ICON_SET
# echo -e $INFO "Obfuscate binary"
echo -e $INFO "Obfuscate binary"
# upx -1 $APP_PATH
upx --best $APP_PATH
# echo -e $INFO "create DMG"
echo -e $INFO "create DMG"
hdiutil create ${PACKAGE_DIR}.dmg -volname ${PACKAGE_DIR} -srcfolder ${PACKAGE_DIR}
echo -e $SUCCESS "Installed bundle successfully!"
+10
View File
@@ -20,6 +20,13 @@ elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
PLATFORM='Windows'
fi
function fallback {
FALLBACK_BRANCH=${BRANCH_NAME:3}
FALLBACK_BRANCH="${FALLBACK_BRANCH%?}"
git checkout ${FALLBACK_BRANCH}
git branch -D ${BRANCH_NAME}
}
function build {
echo -e $INFO Building $1 \($2\)
cmake --build build/$2 --target $1 > /dev/null
@@ -30,6 +37,7 @@ function build {
echo -e $PASS Building $1 \($2\) passed
else
echo -e $FAIL Building $1 \($2\) failed
fallback
exit 1
fi
}
@@ -43,6 +51,7 @@ function build_type {
if [ $? -ne 0 ]
then
echo -e $FAIL At least one build or test failed, no push to $branch
fallback
exit 1
fi
else
@@ -65,6 +74,7 @@ function run_tests {
echo -e $PASS $1 Tests passed
else
echo -e $FAIL $1 Tests failed
fallback
exit 1
fi
cd $ROOTDIR
+1
View File
@@ -2,6 +2,7 @@ add_files(
APP_FILES
data/parser/cxx/TaskParseCxx.cpp
data/parser/cxx/TaskParseWrapper.cpp
utility/commandline/CommandLineParser.cpp
utility/commandline/CommandLineParser.h
+32 -70
View File
@@ -5,31 +5,12 @@
#include "clang/Tooling/JSONCompilationDatabase.h"
#include "data/parser/cxx/CxxParser.h"
#include "data/Storage.h"
#include "data/PersistentStorage.h"
#include "utility/file/FileRegister.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/utility.h"
TaskParseCxx::TaskParseCxx(
Storage* storage,
const FileManager* fileManager,
const Parser::Arguments& arguments,
const std::vector<FilePath>& files
)
: m_storage(storage)
, m_arguments(arguments)
, m_files(files)
, m_isCDB(false)
{
if (arguments.compilationDatabasePath.exists())
{
m_isCDB = true;
}
m_parserClient = std::make_shared<ParserClientImpl>();
m_parser = std::make_shared<CxxParser>(m_parserClient.get(), fileManager);
}
std::vector<FilePath> TaskParseCxx::getSourceFilesFromCDB(const FilePath& compilationDatabasePath)
{
std::string error;
@@ -45,52 +26,46 @@ std::vector<FilePath> TaskParseCxx::getSourceFilesFromCDB(const FilePath& compil
return filePaths;
}
TaskParseCxx::TaskParseCxx(
PersistentStorage* storage,
std::shared_ptr<std::mutex> storageMutex,
std::shared_ptr<FileRegister> fileRegister,
const Parser::Arguments& arguments
)
: m_storage(storage)
, m_storageMutex(storageMutex)
, m_arguments(arguments)
, m_isCDB(false)
{
if (arguments.compilationDatabasePath.exists())
{
m_isCDB = true;
}
m_parserClient = std::make_shared<ParserClientImpl>(); // todo: create one parserclient per file
m_parser = std::make_shared<CxxParser>(m_parserClient.get(), fileRegister);
}
void TaskParseCxx::enter()
{
m_start = utility::durationStart();
if (m_isCDB)
{
std::string error;
m_cdb = std::shared_ptr<clang::tooling::JSONCompilationDatabase>
(clang::tooling::JSONCompilationDatabase::loadFromFile(m_arguments.compilationDatabasePath.str(), error));
m_parser->setupParsingCDB(m_files, m_arguments);
m_parser->setupParsingCDB(m_arguments);
}
else
{
m_parser->setupParsing(m_files, m_arguments);
m_parser->setupParsing(m_arguments);
}
for (const FilePath& path : m_parser->getFileRegister()->getUnparsedSourceFilePaths())
{
m_sourcePaths.push_back(path.absolute());
}
m_storage->startParsing();
}
Task::TaskState TaskParseCxx::update()
{
FilePath sourcePath;
bool isSource = false;
FileRegister* fileRegister = m_parser->getFileRegister();
if (m_sourcePaths.size())
{
sourcePath = m_sourcePaths.front();
m_sourcePaths.pop_front();
isSource = true;
}
else if (!m_isCDB)
{
std::vector<FilePath> unparsedHeaders = fileRegister->getUnparsedIncludeFilePaths();
if (unparsedHeaders.size())
{
sourcePath = unparsedHeaders[0];
}
}
FilePath sourcePath = fileRegister->consumeSourceFile();
if (sourcePath.empty())
{
@@ -98,17 +73,16 @@ Task::TaskState TaskParseCxx::update()
}
std::stringstream ss;
ss << "analyzing files (ESC to quit): [";
ss << (m_isCDB ? fileRegister->getParsedSourceFilesCount() : fileRegister->getParsedFilesCount()) + 1 << "/";
ss << (m_isCDB ? fileRegister->getSourceFilesCount() : fileRegister->getFilesCount()) << "] ";
ss << "indexing files (ESC to quit): [";
ss << fileRegister->getParsedSourceFilesCount() << "/";
ss << fileRegister->getSourceFilesCount() << "] ";
ss << sourcePath.str();
MessageStatus(ss.str(), false, true).dispatch();
std::shared_ptr<IntermediateStorage> intermediateStorage = std::make_shared<IntermediateStorage>();
m_parserClient->setStorage(intermediateStorage);
m_parserClient->startParsingFile(sourcePath);
m_parserClient->startParsingFile();
if (m_isCDB)
{
@@ -123,37 +97,25 @@ Task::TaskState TaskParseCxx::update()
m_parser->runTool(std::vector<std::string>(1, sourcePath.str()));
}
m_parserClient->finishParsingFile(sourcePath);
m_parserClient->finishParsingFile();
m_parserClient->resetStorage();
m_storage->injectData(intermediateStorage);
if (isSource)
{
fileRegister->markSourceFileParsed(sourcePath.str());
std::lock_guard<std::mutex> lock(*(m_storageMutex.get()));
m_storage->inject(intermediateStorage.get());
}
fileRegister->markThreadFilesParsed();
return Task::STATE_RUNNING;
}
void TaskParseCxx::exit()
{
MessageStatus("building search index", false, true).dispatch();
m_storage->finishParsing();
FileRegister* fileRegister = m_parser->getFileRegister();
MessageFinishedParsing(
(m_isCDB ? fileRegister->getParsedSourceFilesCount() : fileRegister->getParsedFilesCount()),
(m_isCDB ? fileRegister->getSourceFilesCount() : fileRegister->getFilesCount()),
utility::duration(m_start)
).dispatch();
}
void TaskParseCxx::interrupt()
{
MessageStatus("analyzing files interrupted", false, true).dispatch();
}
void TaskParseCxx::revert()
@@ -0,0 +1,61 @@
#include "data/parser/cxx/TaskParseWrapper.h"
#include "data/PersistentStorage.h"
#include "utility/file/FileRegister.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/utility.h"
TaskParseWrapper::TaskParseWrapper(
std::shared_ptr<Task> child,
PersistentStorage* storage,
std::shared_ptr<FileRegister> fileRegister
)
: m_child(child)
, m_storage(storage)
, m_fileRegister(fileRegister)
{
}
void TaskParseWrapper::enter()
{
m_start = utility::durationStart();
m_storage->startParsing();
m_child->enter();
}
Task::TaskState TaskParseWrapper::update()
{
return m_child->update();
}
void TaskParseWrapper::exit()
{
m_child->exit();
MessageStatus("optimizing database", false, true).dispatch();
m_storage->optimizeMemory();
MessageStatus("building caches", false, true).dispatch();
m_storage->finishParsing();
MessageFinishedParsing(
m_fileRegister->getParsedSourceFilesCount(),
m_fileRegister->getSourceFilesCount(),
utility::duration(m_start)
).dispatch();
}
void TaskParseWrapper::interrupt()
{
MessageStatus("indexing files interrupted", false, true).dispatch();
m_child->interrupt();
}
void TaskParseWrapper::revert()
{
m_child->revert();
}
@@ -46,7 +46,7 @@ CommandLineParser::CommandLineParser(int argc, char** argv, const std::string& v
all.add(desc).add(hidden_desc);
po::variables_map vm;
po::store(po::command_line_parser(argc,argv).options(all).positional(positionalOption).run(), vm);
po::store(po::command_line_parser(argc,argv).options(all).positional(positionalOption).allow_unregistered().run(), vm);
po::notify(vm);
if (vm.count("help"))
+75 -30
View File
@@ -1,5 +1,6 @@
#include "Application.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/MessageQueue.h"
#include "utility/messaging/type/MessageActivateNodes.h"
@@ -7,6 +8,7 @@
#include "utility/messaging/type/MessageStatus.h"
#include "utility/messaging/type/MessageShowStartScreen.h"
#include "utility/scheduling/TaskScheduler.h"
#include "utility/tracing.h"
#include "utility/UserPaths.h"
#include "utility/Version.h"
@@ -19,6 +21,7 @@
#include "LicenseChecker.h"
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
#include "settings/ProjectSettings.h"
std::shared_ptr<Application> Application::create(
const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory
@@ -116,6 +119,11 @@ void Application::createAndLoadProject(const FilePath& projectSettingsFilePath)
void Application::loadProject(const FilePath& projectSettingsFilePath)
{
if (m_hasGUI)
{
m_componentManager->clearComponents();
}
bool reparse = false;
Project::ProjectState state = m_project->load(projectSettingsFilePath);
@@ -127,8 +135,8 @@ void Application::loadProject(const FilePath& projectSettingsFilePath)
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"The project file was changed after the last analysis. The project needs to get fully reanalysed to "
"reflect the current project state. Do you want to reanalyze the project?", options);
"The project file was changed after the last indexing. The project needs to get fully reindexed to "
"reflect the current project state. Do you want to reindex the project?", options);
reparse = (result == 0);
}
@@ -145,8 +153,8 @@ void Application::loadProject(const FilePath& projectSettingsFilePath)
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"This project was analyzed with a different version of Coati. It needs to be fully reanalyzed to be used "
"with this version of Coati. Do you want to reanalyze the project?", options);
"This project was indexed with a different version of Coati. It needs to be fully reindexed to be used "
"with this version of Coati. Do you want to reindex the project?", options);
reparse = (result == 0);
}
@@ -163,6 +171,23 @@ void Application::refreshProject()
{
MessageStatus("Refreshing Project").dispatch();
FilePath cdbPath = ProjectSettings::getInstance()->getCompilationDatabasePath();
if (!cdbPath.empty() && !cdbPath.exists())
{
MessageStatus("Can't refresh project").dispatch();
if (m_hasGUI)
{
std::vector<std::string> options;
options.push_back("Ok");
m_mainView->confirm(
"Can't refresh. The compilation database of the project does not exist anymore: " + cdbPath.str(),
options);
}
return;
}
m_storageCache->clear();
if (m_hasGUI)
{
@@ -177,18 +202,6 @@ void Application::refreshProject()
}
}
void Application::saveProject(const FilePath& projectSettingsFilePath)
{
if (!m_project->save(projectSettingsFilePath))
{
LOG_ERROR("No Project Settings File defined");
}
else
{
MessageStatus("Project saved").dispatch();
}
}
void Application::handleMessage(MessageActivateWindow* message)
{
if (m_hasGUI)
@@ -208,6 +221,8 @@ void Application::handleMessage(MessageFinishedParsing* message)
void Application::handleMessage(MessageLoadProject* message)
{
TRACE("app load project");
FilePath projectSettingsFilePath(message->projectSettingsFilePath);
if (projectSettingsFilePath.empty())
{
@@ -222,17 +237,50 @@ void Application::handleMessage(MessageLoadProject* message)
{
if (m_hasGUI)
{
std::vector<std::string> options;
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"Some settings were changed, the project needs to be fully reanalyzed. "
"Do you want to reanalyze the project?", options);
FilePath path = projectSettingsFilePath;
FilePath oldPath = m_project->getProjectSettingsFilePath();
if (result == 1)
if (oldPath.exists() && oldPath != path)
{
m_project->load(projectSettingsFilePath);
return;
std::vector<std::string> options;
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"You changed the project location. The project file (.coatiproject) and the database file (.coatidb) will "
"be moved to the new location. Do you want to keep a copy of the files in the previous location?"
, options);
FilePath dbPath = FilePath(path).replaceExtension("coatidb");
FilePath olddbPath = FilePath(oldPath).replaceExtension("coatidb");
m_project = Project::create(m_storageCache.get());
if (result == 0)
{
FileSystem::copyFile(olddbPath, dbPath);
}
else
{
FileSystem::remove(oldPath);
FileSystem::rename(olddbPath, dbPath);
}
}
else
{
std::vector<std::string> options;
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"Some settings were changed, the project needs to be fully reindexed. "
"Do you want to reindex the project?", options);
if (result == 1)
{
m_project->load(projectSettingsFilePath);
updateRecentProjects(projectSettingsFilePath);
m_mainView->setTitle("Coati - " + projectSettingsFilePath.fileName());
return;
}
}
}
@@ -256,6 +304,8 @@ void Application::handleMessage(MessageLoadProject* message)
void Application::handleMessage(MessageRefresh* message)
{
TRACE("app refresh");
loadSettings();
if (message->uiOnly)
@@ -273,11 +323,6 @@ void Application::handleMessage(MessageRefresh* message)
}
}
void Application::handleMessage(MessageSaveProject* message)
{
saveProject(message->projectSettingsFilePath);
}
void Application::startMessagingAndScheduling()
{
TaskScheduler::getInstance()->startSchedulerLoopThreaded();
-4
View File
@@ -10,7 +10,6 @@
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessageRefresh.h"
#include "utility/messaging/type/MessageSaveProject.h"
class IDECommunicationController;
class NetworkFactory;
@@ -24,7 +23,6 @@ class Application
, public MessageListener<MessageFinishedParsing>
, public MessageListener<MessageLoadProject>
, public MessageListener<MessageRefresh>
, public MessageListener<MessageSaveProject>
{
public:
static std::shared_ptr<Application> create(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory);
@@ -36,7 +34,6 @@ public:
void createAndLoadProject(const FilePath& projectSettingsFilePath);
void loadProject(const FilePath& projectSettingsFilePath);
void refreshProject();
void saveProject(const FilePath& projectSettingsFilePath);
bool hasGUI();
private:
@@ -46,7 +43,6 @@ private:
virtual void handleMessage(MessageFinishedParsing* message);
virtual void handleMessage(MessageLoadProject* message);
virtual void handleMessage(MessageRefresh* message);
virtual void handleMessage(MessageSaveProject* message);
void startMessagingAndScheduling();
+15 -9
View File
@@ -2,8 +2,6 @@
add_files(
LIB_FILES
component/controller/helper/ActivationTranslator.cpp
component/controller/helper/ActivationTranslator.h
component/controller/helper/BucketGrid.cpp
component/controller/helper/BucketGrid.h
component/controller/helper/DummyEdge.h
@@ -81,6 +79,11 @@ add_files(
data/access/StorageAccessProxy.cpp
data/access/StorageAccessProxy.h
data/fulltextsearch/FullTextSearchIndex.cpp
data/fulltextsearch/FullTextSearchIndex.h
data/fulltextsearch/SuffixArray.cpp
data/fulltextsearch/SuffixArray.h
data/graph/token_component/TokenComponent.cpp
data/graph/token_component/TokenComponent.h
data/graph/token_component/TokenComponentAbstraction.cpp
@@ -124,6 +127,7 @@ add_files(
data/name/NameHierarchy.h
data/parser/cxx/TaskParseCxx.h
data/parser/cxx/TaskParseWrapper.h
data/parser/ParseLocation.cpp
data/parser/ParseLocation.h
@@ -161,6 +165,8 @@ add_files(
data/HierarchyCache.h
data/IntermediateStorage.cpp
data/IntermediateStorage.h
data/PersistentStorage.cpp
data/PersistentStorage.h
data/SqliteIndex.cpp
data/SqliteIndex.h
data/SqliteStorage.cpp
@@ -228,6 +234,7 @@ add_files(
utility/messaging/type/MessageAutoRefreshChanged.h
utility/messaging/type/MessageChangeFileView.h
utility/messaging/type/MessageClearErrorCount.h
utility/messaging/type/MessageColorSchemeTest.h
utility/messaging/type/MessageDeactivateEdge.h
utility/messaging/type/MessageDispatchWhenLicenseValid.h
utility/messaging/type/MessageEnteredLicense.h
@@ -248,7 +255,6 @@ add_files(
utility/messaging/type/MessageRedo.h
utility/messaging/type/MessageRefresh.h
utility/messaging/type/MessageResetZoom.h
utility/messaging/type/MessageSaveProject.h
utility/messaging/type/MessageScrollCode.h
utility/messaging/type/MessageSearch.h
utility/messaging/type/MessageSearchAutocomplete.h
@@ -270,16 +276,16 @@ add_files(
utility/messaging/MessageQueue.cpp
utility/messaging/MessageQueue.h
utility/scheduling/LambdaTask.cpp
utility/scheduling/LambdaTask.h
utility/scheduling/SimpleTask.cpp
utility/scheduling/SimpleTask.h
utility/scheduling/Task.cpp
utility/scheduling/Task.h
utility/scheduling/TaskGroup.cpp
utility/scheduling/TaskGroup.h
utility/scheduling/TaskGroupParallel.cpp
utility/scheduling/TaskGroupParallel.h
utility/scheduling/TaskGroupSequential.cpp
utility/scheduling/TaskGroupSequential.h
utility/scheduling/TaskLambda.cpp
utility/scheduling/TaskLambda.h
utility/scheduling/TaskScheduler.cpp
utility/scheduling/TaskScheduler.h
@@ -296,8 +302,6 @@ add_files(
utility/solution/SolutionParserVisualStudio.cpp
utility/solution/SolutionParserVisualStudio.h
utility/text/Dictionary.cpp
utility/text/Dictionary.h
utility/text/TextAccess.cpp
utility/text/TextAccess.h
@@ -312,6 +316,8 @@ add_files(
utility/ScopedSwitcher.h
utility/TimePoint.cpp
utility/TimePoint.h
utility/tracing.cpp
utility/tracing.h
utility/types.h
utility/UserPaths.cpp
utility/UserPaths.h
+57 -61
View File
@@ -1,20 +1,23 @@
#include "Project.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/scheduling/TaskGroupSequential.h"
#include "utility/utility.h"
#include "utility/Version.h"
#include "data/access/StorageAccessProxy.h"
#include "data/graph/Token.h"
#include "data/parser/cxx/TaskParseCxx.h"
#include "data/Storage.h"
#include "data/parser/cxx/TaskParseWrapper.h"
#include "data/PersistentStorage.h"
#include "data/TaskCleanStorage.h"
#include "settings/ApplicationSettings.h"
#include "settings/ProjectSettings.h"
#include "utility/file/FileRegister.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/scheduling/TaskGroupSequential.h"
#include "utility/scheduling/TaskGroupParallel.h"
#include "utility/utility.h"
#include "utility/Version.h"
std::shared_ptr<Project> Project::create(StorageAccessProxy* storageAccessProxy)
{
std::shared_ptr<Project> ptr(new Project(storageAccessProxy));
@@ -88,36 +91,6 @@ Project::ProjectState Project::reload()
return m_state;
}
bool Project::save(const FilePath& projectSettingsFile)
{
bool differentLocation = (projectSettingsFile != m_projectSettingsFilepath);
if (!projectSettingsFile.empty())
{
setProjectSettingsFilePath(projectSettingsFile);
}
else
{
differentLocation = false;
}
if (m_projectSettingsFilepath.empty())
{
return false;
}
ProjectSettings settings;
settings.load(m_projectSettingsFilepath);
if (differentLocation || settings != *ProjectSettings::getInstance().get())
{
ProjectSettings::getInstance()->save(m_projectSettingsFilepath);
LOG_INFO_STREAM(<< "ProjectSettings saved to file: " << m_projectSettingsFilepath.str());
}
return true;
}
void Project::clearStorage()
{
if (m_state == PROJECT_OUTVERSIONED)
@@ -139,8 +112,6 @@ void Project::parseCode()
return;
}
std::shared_ptr<ProjectSettings> projSettings = ProjectSettings::getInstance();
m_fileManager.fetchFilePaths(m_storage->getInfoOnAllFiles());
std::set<FilePath> addedFilePaths = m_fileManager.getAddedFilePaths();
std::set<FilePath> updatedFilePaths = m_fileManager.getUpdatedFilePaths();
@@ -149,28 +120,51 @@ void Project::parseCode()
utility::append(updatedFilePaths, m_storage->getDependingFilePaths(updatedFilePaths));
utility::append(updatedFilePaths, m_storage->getDependingFilePaths(removedFilePaths));
std::shared_ptr<TaskGroupSequential> taskGroup = std::make_shared<TaskGroupSequential>();
std::vector<FilePath> filesToClean;
filesToClean.insert(filesToClean.end(), removedFilePaths.begin(), removedFilePaths.end());
filesToClean.insert(filesToClean.end(), updatedFilePaths.begin(), updatedFilePaths.end());
taskGroup->addTask(std::make_shared<TaskCleanStorage>(m_storage.get(), filesToClean));
std::vector<FilePath> filesToParse;
filesToParse.insert(filesToParse.end(), addedFilePaths.begin(), addedFilePaths.end());
filesToParse.insert(filesToParse.end(), updatedFilePaths.begin(), updatedFilePaths.end());
taskGroup->addTask(std::make_shared<TaskParseCxx>(
m_state = PROJECT_LOADED;
if (!filesToClean.size() && !filesToParse.size())
{
MessageFinishedParsing(0, 0, 0, true).dispatch();
return;
}
std::shared_ptr<TaskGroupSequential> taskSequential = std::make_shared<TaskGroupSequential>();
taskSequential->addTask(std::make_shared<TaskCleanStorage>(m_storage.get(), filesToClean));
int indexerThreadCount = ApplicationSettings::getInstance()->getIndexerThreadCount();
std::shared_ptr<FileRegister> fileRegister = std::make_shared<FileRegister>(&m_fileManager, indexerThreadCount > 1);
fileRegister->setFilePaths(filesToParse);
std::shared_ptr<TaskGroupParallel> taskParallel = std::make_shared<TaskGroupParallel>();
taskSequential->addTask(std::make_shared<TaskParseWrapper>(
taskParallel,
m_storage.get(),
&m_fileManager,
getParserArguments(),
filesToParse
fileRegister
));
Task::dispatch(taskGroup);
std::shared_ptr<std::mutex> storageMutex = std::make_shared<std::mutex>();
m_state = PROJECT_LOADED;
for (int i = 0; i < indexerThreadCount; i++)
{
taskParallel->addTask(std::make_shared<TaskParseCxx>(
m_storage.get(),
storageMutex,
fileRegister,
getParserArguments()
));
}
Task::dispatch(taskSequential);
}
void Project::logStats() const
@@ -219,7 +213,7 @@ void Project::loadStorage(const FilePath& path)
FilePath dbPath = FilePath(path).replaceExtension("coatidb");
if (!m_storage || path != m_projectSettingsFilepath || !dbPath.exists())
{
m_storage = std::make_shared<Storage>(dbPath);
m_storage = std::make_shared<PersistentStorage>(dbPath);
}
}
@@ -228,18 +222,22 @@ void Project::updateFileManager()
std::shared_ptr<ProjectSettings> projSettings = ProjectSettings::getInstance();
std::vector<FilePath> sourcePaths = projSettings->getAbsoluteSourcePaths();
std::vector<FilePath> headerPaths;
std::vector<FilePath> headerPaths = sourcePaths;
std::vector<std::string> sourceExtensions;
if (projSettings->getCompilationDatabasePath().exists())
{
headerPaths = sourcePaths;
sourcePaths = TaskParseCxx::getSourceFilesFromCDB(projSettings->getCompilationDatabasePath());
}
else
{
sourceExtensions = projSettings->getSourceExtensions();
}
std::vector<std::string> sourceExtensions = projSettings->getSourceExtensions();
std::vector<std::string> includeExtensions = projSettings->getHeaderExtensions();
std::vector<FilePath> excludePaths = projSettings->getAbsoluteExcludePaths();
m_fileManager.setPaths(sourcePaths, headerPaths, sourceExtensions, includeExtensions);
m_fileManager.setPaths(sourcePaths, headerPaths, excludePaths, sourceExtensions);
}
Parser::Arguments Project::getParserArguments() const
@@ -263,14 +261,12 @@ Parser::Arguments Project::getParserArguments() const
if (projSettings->getUseSourcePathsForHeaderSearch())
{
std::vector<FilePath> headerSearchSubPaths;
for (FilePath p : projSettings->getAbsoluteHeaderSearchPaths())
for (FilePath p : projSettings->getSourcePaths())
{
std::vector<FilePath> tempPaths = FileSystem::getSubDirectories(p);
headerSearchSubPaths.insert( headerSearchSubPaths.end(), tempPaths.begin(), tempPaths.end() );
utility::append(headerSearchSubPaths, FileSystem::getSubDirectories(p));
}
std::unique(headerSearchSubPaths.begin(),headerSearchSubPaths.end());
utility::append(args.systemHeaderSearchPaths, headerSearchSubPaths);
utility::append(args.systemHeaderSearchPaths, utility::unique(headerSearchSubPaths));
}
utility::append(args.frameworkSearchPaths, projSettings->getAbsoluteFrameworkSearchPaths());
+2 -4
View File
@@ -7,7 +7,7 @@
#include "data/parser/Parser.h"
class Storage;
class PersistentStorage;
class StorageAccessProxy;
class Project
@@ -31,8 +31,6 @@ public:
ProjectState load(const FilePath& projectSettingsFile);
ProjectState reload();
bool save(const FilePath& projectSettingsFile);
void clearStorage();
void logStats() const;
@@ -57,7 +55,7 @@ private:
FilePath m_projectSettingsFilepath;
FileManager m_fileManager;
std::shared_ptr<Storage> m_storage;
std::shared_ptr<PersistentStorage> m_storage;
};
#endif // PROJECT_H
+4
View File
@@ -38,6 +38,8 @@ ViewFactory* ComponentFactory::getViewFactory() const
std::shared_ptr<Component> ComponentFactory::createCodeComponent(ViewLayout* viewLayout)
{
std::shared_ptr<CodeView> view = m_viewFactory->createCodeView(viewLayout);
view->createOverlay();
std::shared_ptr<CodeController> controller = std::make_shared<CodeController>(m_storageAccess);
return std::make_shared<Component>(view, controller);
@@ -53,6 +55,8 @@ std::shared_ptr<Component> ComponentFactory::createFeatureComponent()
std::shared_ptr<Component> ComponentFactory::createGraphComponent(ViewLayout* viewLayout)
{
std::shared_ptr<View> view = m_viewFactory->createGraphView(viewLayout);
view->createOverlay();
std::shared_ptr<GraphController> controller = std::make_shared<GraphController>(m_storageAccess);
return std::make_shared<Component>(view, controller);
+14
View File
@@ -2,6 +2,7 @@
#include "component/controller/NetworkFactory.h"
#include "component/controller/Controller.h"
#include "component/view/CodeView.h"
#include "component/view/CompositeView.h"
#include "component/view/GraphView.h"
@@ -51,6 +52,19 @@ void ComponentManager::setup(ViewLayout* viewLayout)
m_components.push_back(featureComponent);
}
void ComponentManager::clearComponents()
{
for (std::shared_ptr<Component> component : m_components)
{
Controller* controller = component->getController<Controller>();
if (controller)
{
controller->clear();
}
}
}
void ComponentManager::refreshViews()
{
for (std::shared_ptr<Component> component : m_components)
+1
View File
@@ -23,6 +23,7 @@ public:
void setup(ViewLayout* viewLayout);
void clearComponents();
void refreshViews();
private:
+165 -136
View File
@@ -4,6 +4,7 @@
#include "utility/messaging/type/MessageStatus.h"
#include "utility/text/TextAccess.h"
#include "utility/tracing.h"
#include "utility/utility.h"
#include "utility/utilityString.h"
@@ -24,12 +25,16 @@ CodeController::~CodeController()
{
}
const uint CodeController::s_lineRadius = 2;
void CodeController::handleMessage(MessageActivateAll* message)
{
TRACE("code all");
CodeView* view = getView();
view->showOverlay();
std::vector<ErrorInfo> errors;
std::vector<CodeSnippetParams> snippets = getSnippetsForErrorLocations(&errors);
m_collection = m_storageAccess->getErrorTokenLocations(&errors);
std::vector<CodeSnippetParams> snippets = getSnippetsForCollection(m_collection);
StorageStats stats = m_storageAccess->getStorageStats();
CodeSnippetParams statsSnippet;
@@ -69,7 +74,7 @@ void CodeController::handleMessage(MessageActivateAll* message)
if (stats.errorCount.total > 0)
{
ss << "\tWarning: The analysis may be incomplete as long as it yields fatal errors.\n";
ss << "\tWarning: Indexing may be incomplete as long as it yields fatal errors.\n";
ss << "\tTry resolving them and refresh the project.\n";
ss << "\n";
}
@@ -78,7 +83,7 @@ void CodeController::handleMessage(MessageActivateAll* message)
snippets.insert(snippets.begin(), statsSnippet);
CodeView* view = getView();
view->clear();
view->setErrorInfos(errors);
view->showCodeSnippets(snippets, std::vector<Id>());
@@ -93,20 +98,25 @@ void CodeController::handleMessage(MessageActivateLocalSymbols* message)
void CodeController::handleMessage(MessageActivateTokens* message)
{
TRACE("code activate");
CodeView* view = getView();
view->setErrorInfos(std::vector<ErrorInfo>());
view->showOverlay();
if (!message->keepContent())
{
view->clear();
}
std::vector<Id> activeTokenIds = message->tokenIds;
Id declarationId = 0; // 0 means that no token is found.
if (!activeTokenIds.size())
{
return;
}
Id declarationId = 0; // 0 means that no token is found.
if (!message->isAggregation)
{
if (activeTokenIds.size() != 1)
{
view->clear();
return;
}
activeTokenIds = m_storageAccess->getActiveTokenIdsForId(activeTokenIds[0], &declarationId);
}
@@ -114,18 +124,17 @@ void CodeController::handleMessage(MessageActivateTokens* message)
{
view->showFirstActiveSnippet(activeTokenIds, message->isLast());
}
if (message->keepContent())
else if (message->keepContent())
{
view->showActiveTokenIds(activeTokenIds);
}
else
{
std::shared_ptr<TokenLocationCollection> collection = m_storageAccess->getTokenLocationsForTokenIds(activeTokenIds);
view->showCodeSnippets(getSnippetsForActiveTokenLocations(collection.get(), declarationId), activeTokenIds);
m_collection = m_storageAccess->getTokenLocationsForTokenIds(activeTokenIds);
view->showCodeSnippets(getSnippetsForActiveTokenLocations(m_collection.get(), declarationId), activeTokenIds);
size_t fileCount = collection->getTokenLocationFileCount();
size_t referenceCount = collection->getTokenLocationCount();
size_t fileCount = m_collection->getTokenLocationFileCount();
size_t referenceCount = m_collection->getTokenLocationCount();
std::stringstream ss;
ss << message->tokenIds.size() << ' ';
@@ -147,6 +156,8 @@ void CodeController::handleMessage(MessageActivateTokens* message)
void CodeController::handleMessage(MessageChangeFileView* message)
{
TRACE("code change file");
CodeView* view = getView();
switch (message->state)
@@ -158,14 +169,9 @@ void CodeController::handleMessage(MessageChangeFileView* message)
case MessageChangeFileView::FILE_SNIPPETS:
if (message->needsData)
{
if (message->showErrors)
{
view->addCodeSnippets(getSnippetsForFile(message->locationFile), false);
}
else
{
view->addCodeSnippets(getSnippetsForActiveTokenLocationsInFile(message->locationFile), false);
}
view->showOverlay();
view->addCodeSnippets(getSnippetsForFile(
m_collection->getTokenLocationFileByPath(message->filePath), !message->showErrors), false);
}
view->setFileState(message->filePath, CodeView::FILE_SNIPPETS);
break;
@@ -173,6 +179,8 @@ void CodeController::handleMessage(MessageChangeFileView* message)
case MessageChangeFileView::FILE_MAXIMIZED:
if (message->needsData)
{
view->showOverlay();
CodeSnippetParams params;
params.startLineNumber = 1;
params.refCount = -1;
@@ -184,14 +192,26 @@ void CodeController::handleMessage(MessageChangeFileView* message)
if (message->showErrors)
{
std::vector<ErrorInfo> errors;
TokenLocationCollection errorCollection = m_storageAccess->getErrorTokenLocations(&errors);
params.locationFile = std::make_shared<TokenLocationFile>(*errorCollection.findTokenLocationFileByPath(message->filePath));
params.locationFile = m_collection->getTokenLocationFileByPath(message->filePath);
params.locationFile->isWholeCopy = true;
}
else
{
params.locationFile = m_storageAccess->getTokenLocationsForFile(message->filePath.str());
std::shared_ptr<TokenLocationFile> file =
m_storageAccess->getTokenLocationsForFile(message->filePath.str());
TokenLocationFile* activeLocations = m_collection->findTokenLocationFileByPath(message->filePath);
if (activeLocations)
{
activeLocations->forEachTokenLocation(
[&file](TokenLocation* location)
{
file->addTokenLocationAsPlainCopy(location);
}
);
}
params.locationFile = file;
}
getView()->showCodeFile(params);
@@ -228,10 +248,16 @@ void CodeController::handleMessage(MessageScrollCode* message)
void CodeController::handleMessage(MessageShowErrors* message)
{
std::vector<ErrorInfo> errors;
std::vector<CodeSnippetParams> snippets = getSnippetsForErrorLocations(&errors);
TRACE("code errors");
CodeView* view = getView();
view->showOverlay();
std::vector<ErrorInfo> errors;
m_collection = m_storageAccess->getErrorTokenLocations(&errors);
std::vector<CodeSnippetParams> snippets = getSnippetsForCollection(m_collection);
view->clear();
view->setErrorInfos(errors);
view->showCodeSnippets(snippets, std::vector<Id>());
@@ -240,15 +266,22 @@ void CodeController::handleMessage(MessageShowErrors* message)
void CodeController::handleMessage(MessageSearchFullText* message)
{
TRACE("code fulltext");
CodeView* view = getView();
std::vector<CodeSnippetParams> snippets = getSnippetsForFullTextSearch(message->searchTerm);
view->showCodeSnippets(snippets, std::vector<Id>());
view->showOverlay();
view->clear();
m_collection = m_storageAccess->getFullTextSearchLocations(message->searchTerm, message->caseSensitive);
view->showCodeSnippets(getSnippetsForCollection(m_collection, true), std::vector<Id>());
showContents(message);
}
void CodeController::handleMessage(MessageShowScope* message)
{
TRACE("code scope");
std::shared_ptr<TokenLocationCollection> collection =
m_storageAccess->getTokenLocationsForLocationIds(std::vector<Id>(1, message->scopeLocationId));
@@ -259,7 +292,8 @@ void CodeController::handleMessage(MessageShowScope* message)
return;
}
std::vector<CodeSnippetParams> snippets = getSnippetsForActiveTokenLocations(collection.get(), 0);
std::vector<CodeSnippetParams> snippets =
getSnippetsForFile(collection->getTokenLocationFiles().begin()->second, true);
if (snippets.size() != 1)
{
LOG_ERROR("MessageShowScope didn't result in one single snippet to be created");
@@ -268,15 +302,21 @@ void CodeController::handleMessage(MessageShowScope* message)
if (message->showErrors)
{
std::vector<ErrorInfo> errors;
std::vector<CodeSnippetParams> errorSnippets = getSnippetsForErrorLocations(&errors);
for (const CodeSnippetParams& error : errorSnippets)
snippets[0].locationFile = m_collection->getTokenLocationFileByPath(snippets[0].locationFile->getFilePath());
}
else
{
TokenLocationFile* activeLocations =
m_collection->findTokenLocationFileByPath(snippets[0].locationFile->getFilePath());
if (activeLocations)
{
if (error.locationFile->getFilePath() == snippets[0].locationFile->getFilePath())
{
snippets[0].locationFile = error.locationFile;
}
std::shared_ptr<TokenLocationFile> file = snippets[0].locationFile;
activeLocations->forEachTokenLocation(
[&file](TokenLocation* location)
{
file->addTokenLocationAsPlainCopy(location);
}
);
}
}
@@ -290,6 +330,13 @@ CodeView* CodeController::getView()
return Controller::getView<CodeView>();
}
void CodeController::clear()
{
getView()->clear();
m_collection.reset();
}
void CodeController::showContents(MessageBase* message)
{
if (!message->isReplayed())
@@ -301,30 +348,42 @@ void CodeController::showContents(MessageBase* message)
std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocations(
const TokenLocationCollection* collection, Id declarationId
) const {
TRACE();
std::vector<CodeSnippetParams> snippets;
size_t definitionFileCount = 0;
size_t declarationFileCount = 0;
collection->forEachTokenLocationFile(
[&](std::shared_ptr<TokenLocationFile> file) -> void
{
bool isDeclarationFile = false;
bool isDefinitionFile = false;
file->forEachTokenLocation(
[&](TokenLocation* location)
{
if (location->getTokenId() == declarationId)
{
isDeclarationFile = true;
if (location->getType() == LOCATION_SCOPE)
{
isDefinitionFile = true;
}
}
}
);
if (declarationFileCount < 5 && (isDeclarationFile || collection->getTokenLocationFileCount() < 5 || file->isWholeCopy))
if (collection->getTokenLocationFileCount() < 5 || file->isWholeCopy ||
(isDefinitionFile && definitionFileCount < 3) ||
(!isDefinitionFile && isDeclarationFile && declarationFileCount < 3))
{
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForActiveTokenLocationsInFile(file);
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(file, true);
for (CodeSnippetParams& snippet : fileSnippets)
{
snippet.isDeclaration = isDeclarationFile;
snippet.isDefinition = isDefinitionFile;
}
utility::append(snippets, fileSnippets);
@@ -339,7 +398,11 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocation
snippets.push_back(params);
}
if (isDeclarationFile)
if (isDefinitionFile)
{
definitionFileCount++;
}
else if (isDeclarationFile)
{
declarationFileCount++;
}
@@ -353,43 +416,50 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocation
return snippets;
}
std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocationsInFile(
std::shared_ptr<TokenLocationFile> activeTokenLocations
) const {
std::shared_ptr<TokenLocationFile> fileLocations = m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str());
std::vector<CodeSnippetParams> CodeController::getSnippetsForCollection(
std::shared_ptr<TokenLocationCollection> collection, bool addTokenLocations
) const
{
std::vector<CodeSnippetParams> snippets;
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(activeTokenLocations, fileLocations);
if (!activeTokenLocations->isWholeCopy)
{
for (CodeSnippetParams& params : fileSnippets)
collection->forEachTokenLocationFile(
[&](std::shared_ptr<TokenLocationFile> file) -> void
{
params.locationFile = fileLocations->getFilteredByLines(params.startLineNumber, params.endLineNumber);
if (snippets.size() < 10)
{
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(file, addTokenLocations);
snippets.insert(snippets.end(), fileSnippets.begin(), fileSnippets.end());
}
else
{
CodeSnippetParams params;
params.locationFile = file;
params.refCount = file->getUnscopedStartTokenLocationCount();
params.isCollapsed = true;
snippets.push_back(params);
}
}
}
return fileSnippets;
}
std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
std::shared_ptr<TokenLocationFile> activeTokenLocations
) const
{
return getSnippetsForFile(
activeTokenLocations,
m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str())
);
addModificationTimes(snippets);
return snippets;
}
std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
std::shared_ptr<TokenLocationFile> activeTokenLocations,
const std::shared_ptr<TokenLocationFile> fileLocations
std::shared_ptr<TokenLocationFile> activeTokenLocations, bool addTokenLocations
) const
{
TRACE();
std::shared_ptr<TextAccess> textAccess = m_storageAccess->getFileContent(activeTokenLocations->getFilePath());
std::shared_ptr<TokenLocationFile> scopeLocations
= std::make_shared<TokenLocationFile>(activeTokenLocations->getFilePath().str());
std::shared_ptr<TokenLocationFile> fileLocations =
m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str());
fileLocations->forEachStartTokenLocation(
[&](TokenLocation* startLoc) -> void
{
@@ -445,14 +515,16 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
const int snippetExpandRange = ApplicationSettings::getInstance()->getCodeSnippetExpandRange();
std::vector<CodeSnippetParams> snippets;
std::shared_ptr<TokenLocationFile> file = m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str());
std::shared_ptr<TokenLocationFile> file =
m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str());
for (const SnippetMerger::Range& range: ranges)
{
CodeSnippetParams params;
params.locationFile = activeTokenLocations;
params.refCount = activeTokenLocations->getUnscopedStartTokenLocationCount();
params.startLineNumber = std::max<int>(1, range.start.row - (range.start.strong ? 0 : snippetExpandRange));
params.endLineNumber = std::min<int>(textAccess->getLineCount(), range.end.row + (range.end.strong ? 0 : snippetExpandRange));
params.endLineNumber =
std::min<int>(textAccess->getLineCount(), range.end.row + (range.end.strong ? 0 : snippetExpandRange));
std::shared_ptr<TokenLocationFile> tempFile = file->getFilteredByLines(params.startLineNumber, params.endLineNumber);
TokenLocationLine* firstUsedLine = nullptr;
@@ -509,6 +581,24 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
snippets.push_back(params);
}
if (addTokenLocations && !activeTokenLocations->isWholeCopy)
{
for (CodeSnippetParams& params : snippets)
{
std::shared_ptr<TokenLocationFile> lines =
fileLocations->getFilteredByLines(params.startLineNumber, params.endLineNumber);
params.locationFile->forEachTokenLocation(
[&lines](TokenLocation* location)
{
lines->addTokenLocationAsPlainCopy(location);
}
);
params.locationFile = lines;
}
}
return snippets;
}
@@ -589,69 +679,6 @@ std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope
return file;
}
std::vector<CodeSnippetParams> CodeController::getSnippetsForFullTextSearch(
const std::string& searchTerm) const
{
std::shared_ptr<TokenLocationCollection> collection =
m_storageAccess->getFullTextSearchLocations(searchTerm);
std::vector<CodeSnippetParams> snippets;
collection->forEachTokenLocationFile(
[&](std::shared_ptr<TokenLocationFile> file) -> void
{
//if (snippets.size() < 10)
{
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(file);
snippets.insert(snippets.end(), fileSnippets.begin(), fileSnippets.end());
}
//else
//{
//CodeSnippetParams params;
//params.locationFile = file;
//params.refCount = file->getUnscopedStartTokenLocationCount();
//params.isCollapsed = true;
//snippets.push_back(params);
//}
}
);
addModificationTimes(snippets);
return snippets;
}
std::vector<CodeSnippetParams> CodeController::getSnippetsForErrorLocations(
std::vector<ErrorInfo>* errors) const
{
TokenLocationCollection errorCollection = m_storageAccess->getErrorTokenLocations(errors);
std::vector<CodeSnippetParams> snippets;
errorCollection.forEachTokenLocationFile(
[&](std::shared_ptr<TokenLocationFile> file) -> void
{
if (snippets.size() < 10)
{
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(file);
snippets.insert(snippets.end(), fileSnippets.begin(), fileSnippets.end());
}
else
{
CodeSnippetParams params;
params.locationFile = file;
params.refCount = file->getUnscopedStartTokenLocationCount();
params.isCollapsed = true;
snippets.push_back(params);
}
}
);
addModificationTimes(snippets);
return snippets;
}
std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile* locationFile) const
{
std::string description = ProjectSettings::getInstance()->getDescription();
@@ -710,6 +737,8 @@ std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile
void CodeController::addModificationTimes(std::vector<CodeSnippetParams>& snippets) const
{
TRACE();
std::vector<FilePath> filePaths;
for (const CodeSnippetParams& snippet : snippets)
{
+13 -11
View File
@@ -23,6 +23,7 @@
#include "component/view/CodeView.h"
class StorageAccess;
class TokenLocation;
class TokenLocationCollection;
class TokenLocationFile;
@@ -45,8 +46,6 @@ public:
~CodeController();
private:
static const uint s_lineRadius;
virtual void handleMessage(MessageActivateAll* message);
virtual void handleMessage(MessageActivateLocalSymbols* message);
virtual void handleMessage(MessageActivateTokens* message);
@@ -60,27 +59,30 @@ private:
virtual void handleMessage(MessageShowScope* message);
CodeView* getView();
virtual void clear();
void showContents(MessageBase* message);
std::vector<CodeSnippetParams> getSnippetsForActiveTokenLocations(
const TokenLocationCollection* collection, Id declarationId) const;
std::vector<CodeSnippetParams> getSnippetsForActiveTokenLocationsInFile(
std::shared_ptr<TokenLocationFile>) const;
std::vector<CodeSnippetParams> getSnippetsForCollection(
std::shared_ptr<TokenLocationCollection> collection, bool addTokenLocations = false) const;
std::vector<CodeSnippetParams> getSnippetsForFile(
std::shared_ptr<TokenLocationFile> activeTokenLocations, std::shared_ptr<TokenLocationFile> fileLocations) const;
std::vector<CodeSnippetParams> getSnippetsForFile(std::shared_ptr<TokenLocationFile> file) const;
std::vector<CodeSnippetParams> getSnippetsForFullTextSearch(const std::string& searchTerm) const;
std::shared_ptr<SnippetMerger> buildMergerHierarchy(
TokenLocation* location, std::shared_ptr<TokenLocationFile> context, SnippetMerger& fileScopedMerger, std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const;
std::shared_ptr<TokenLocationFile> getTokenLocationOfParentScope(const TokenLocation* location, std::shared_ptr<TokenLocationFile> context) const;
std::shared_ptr<TokenLocationFile> file, bool addTokenLocations = false) const;
std::vector<CodeSnippetParams> getSnippetsForErrorLocations(std::vector<ErrorInfo>* errors) const;
std::shared_ptr<SnippetMerger> buildMergerHierarchy(
TokenLocation* location, std::shared_ptr<TokenLocationFile> context, SnippetMerger& fileScopedMerger,
std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const;
std::shared_ptr<TokenLocationFile> getTokenLocationOfParentScope(
const TokenLocation* location, std::shared_ptr<TokenLocationFile> context) const;
std::vector<std::string> getProjectDescription(TokenLocationFile* locationFile) const;
void addModificationTimes(std::vector<CodeSnippetParams>& snippets) const;
StorageAccess* m_storageAccess;
mutable std::shared_ptr<TokenLocationCollection> m_collection;
};
#endif // CODE_CONTROLLER_H
+7 -3
View File
@@ -11,13 +11,14 @@ public:
void setComponent(Component* component);
virtual void clear() = 0;
protected:
template <typename ViewType>
ViewType* getView() const;
ViewType* getView() const;
private:
Component* m_component;
};
@@ -25,8 +26,11 @@ template <typename ViewType>
ViewType* Controller::getView() const
{
if (m_component)
{
return m_component->getView<ViewType>();
return NULL;
}
return nullptr;
}
#endif // CONTROLLER_H
@@ -3,13 +3,16 @@
#include "data/access/StorageAccess.h"
#include "settings/ApplicationSettings.h"
#include "utility/messaging/type/MessageActivateAll.h"
#include "utility/messaging/type/MessageActivateTokens.h"
#include "utility/messaging/type/MessageChangeFileView.h"
#include "utility/messaging/type/MessageColorSchemeTest.h"
#include "utility/messaging/type/MessageRefresh.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/messaging/type/MessageStatus.h"
FeatureController::FeatureController(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
, m_activationTranslator(storageAccess)
{
}
@@ -17,49 +20,149 @@ FeatureController::~FeatureController()
{
}
void FeatureController::clear()
{
}
void FeatureController::handleMessage(MessageActivateEdge* message)
{
std::shared_ptr<MessageActivateTokens> m = m_activationTranslator.translateMessage(message);
if (m)
if (message->isAggregation())
{
m->dispatchImmediately();
// TODO: validate aggregationIds
MessageActivateTokens m(message, message->aggregationIds);
m.setKeepContent(false);
m.isAggregation = true;
m.dispatchImmediately();
}
else
{
Id edgeId = message->tokenId;
if (message->isReplayed())
{
edgeId = m_storageAccess->getIdForEdge(message->type, message->fromNameHierarchy, message->toNameHierarchy);
}
std::vector<Id> ids;
if (edgeId)
{
ids.push_back(edgeId);
}
MessageActivateTokens m(message, ids);
m.isEdge = true;
m.unknownNames = std::vector<std::string>(1, message->getFullName());
m.dispatchImmediately();
}
}
void FeatureController::handleMessage(MessageActivateFile* message)
{
std::shared_ptr<MessageActivateTokens> m = m_activationTranslator.translateMessage(message);
if (m)
Id fileId = m_storageAccess->getTokenIdForFileNode(message->filePath);
if (fileId)
{
m->dispatchImmediately();
MessageActivateTokens(message, std::vector<Id>(1, fileId)).dispatchImmediately();
}
else
{
MessageChangeFileView msg(
message->filePath,
MessageChangeFileView::FILE_MAXIMIZED,
true,
true
);
msg.setIsReplayed(message->isReplayed());
msg.setKeepContent(message->keepContent());
msg.dispatchImmediately();
}
}
void FeatureController::handleMessage(MessageActivateNodes* message)
{
std::shared_ptr<MessageActivateTokens> m = m_activationTranslator.translateMessage(message);
if (m)
std::vector<Id> nodeIds;
if (!message->isReplayed())
{
m->dispatchImmediately();
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
{
nodeIds.push_back(node.nodeId);
}
}
else
{
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
{
Id nodeId = m_storageAccess->getIdForNodeWithNameHierarchy(node.nameHierarchy);
if (nodeId > 0)
{
nodeIds.push_back(nodeId);
}
}
}
MessageActivateTokens m(message, nodeIds);
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
{
m.unknownNames.push_back(node.nameHierarchy.getQualifiedName());
}
m.dispatchImmediately();
}
void FeatureController::handleMessage(MessageSearch* message)
{
std::shared_ptr<MessageActivateTokens> m = m_activationTranslator.translateMessage(message);
if (m)
const std::vector<SearchMatch>& matches = message->getMatches();
for (const SearchMatch& match : matches)
{
m->dispatchImmediately();
if (match.searchType == SearchMatch::SEARCH_COMMAND)
{
SearchMatch::CommandType type = SearchMatch::getCommandType(match.getFullName());
switch (type)
{
case SearchMatch::COMMAND_ALL:
{
MessageActivateAll msg;
msg.setIsReplayed(message->isReplayed());
msg.dispatchImmediately();
return;
}
case SearchMatch::COMMAND_ERROR:
{
MessageShowErrors msg(ErrorCountInfo(-1, 0));
msg.setIsReplayed(message->isReplayed());
msg.dispatchImmediately();
return;
}
case SearchMatch::COMMAND_COLOR_SCHEME_TEST:
{
MessageColorSchemeTest().dispatchImmediately();
return;
}
}
}
}
std::vector<Id> tokenIds = m_storageAccess->getTokenIdsForMatches(matches);
MessageActivateTokens m(message, tokenIds);
for (const SearchMatch& match : matches)
{
m.unknownNames.push_back(match.text);
}
if (!message->isReplayed())
{
m.isFromSearch = true;
}
m.dispatchImmediately();
}
void FeatureController::handleMessage(MessageActivateTokenIds* message)
{
std::shared_ptr<MessageActivateTokens> m = m_activationTranslator.translateMessage(message);
if (m)
{
m->dispatchImmediately();
}
MessageActivateTokens(message, message->tokenIds).dispatchImmediately();
}
void FeatureController::handleMessage(MessageActivateTokenLocations* message)
@@ -119,8 +222,7 @@ void FeatureController::handleMessage(MessageZoom* message)
return;
}
// settings->setFontSize(std::max(settings->getFontSize() + (message->zoomIn ? 1 : -1), 5));
settings->setFontSize((settings->getFontSize() + (message->zoomIn ? 1 : -1)));
settings->setFontSize(fontSize + (message->zoomIn ? 1 : -1));
settings->save();
fontSize = settings->getFontSize();
@@ -3,7 +3,6 @@
#include <memory>
#include "component/controller/helper/ActivationTranslator.h"
#include "component/controller/Controller.h"
#include "utility/messaging/MessageListener.h"
@@ -35,6 +34,8 @@ public:
FeatureController(StorageAccess* storageAccess);
~FeatureController();
virtual void clear();
private:
virtual void handleMessage(MessageActivateEdge* message);
virtual void handleMessage(MessageActivateFile* message);
@@ -47,7 +48,6 @@ private:
virtual void handleMessage(MessageZoom* message);
StorageAccess* m_storageAccess;
ActivationTranslator m_activationTranslator;
};
#endif // FEATURE_CONTROLLER_H
File diff suppressed because it is too large Load Diff
+33 -24
View File
@@ -7,6 +7,7 @@
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageActivateAll.h"
#include "utility/messaging/type/MessageActivateTokens.h"
#include "utility/messaging/type/MessageColorSchemeTest.h"
#include "utility/messaging/type/MessageFlushUpdates.h"
#include "utility/messaging/type/MessageFocusIn.h"
#include "utility/messaging/type/MessageFocusOut.h"
@@ -17,12 +18,12 @@
#include "utility/messaging/type/MessageShowErrors.h"
#include "component/controller/Controller.h"
#include "component/controller/helper/DummyEdge.h"
#include "component/controller/helper/DummyNode.h"
#include "component/view/GraphView.h"
#include "data/graph/token_component/TokenComponentAccess.h"
#include "data/graph/token_component/TokenComponentAggregation.h"
struct DummyNode;
struct DummyEdge;
class Graph;
class Node;
class StorageAccess;
@@ -31,6 +32,7 @@ class GraphController
: public Controller
, public MessageListener<MessageActivateAll>
, public MessageListener<MessageActivateTokens>
, public MessageListener<MessageColorSchemeTest>
, public MessageListener<MessageFlushUpdates>
, public MessageListener<MessageFocusIn>
, public MessageListener<MessageFocusOut>
@@ -58,45 +60,52 @@ private:
GraphView* getView() const;
void clear();
virtual void clear();
void createDummyGraphForTokenIds(const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph);
DummyNode createDummyNodeTopDown(Node* node);
void createDummyGraphForTokenIdsAndSetActiveAndVisibility(
const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph);
std::shared_ptr<DummyNode> createDummyNodeTopDown(Node* node, Id parentId);
std::vector<Id> getExpandedNodeIds() const;
void setExpandedNodeIds(const std::vector<Id>& nodeIds);
void autoExpandActiveNode(const std::vector<Id>& activeTokenIds);
bool setActive(const std::vector<Id>& activeTokenIds);
void setVisibility(bool noActive);
void setActiveAndVisibility(const std::vector<Id>& activeTokenIds);
void setNodeActiveRecursive(DummyNode& node, const std::vector<Id>& activeTokenIds, bool* noActive) const;
void removeImplicitChildrenRecursive(DummyNode& node);
bool setNodeVisibilityRecursiveBottomUp(DummyNode& node, bool noActive) const;
void setNodeVisibilityRecursiveTopDown(DummyNode& node, bool parentExpanded) const;
void setNodeActiveRecursive(DummyNode* node, const std::vector<Id>& activeTokenIds, bool* noActive) const;
void removeImplicitChildrenRecursive(DummyNode* node);
bool setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool noActive) const;
void setNodeVisibilityRecursiveTopDown(DummyNode* node, bool parentExpanded) const;
void bundleNodes();
void bundleNodesAndEdgesMatching(std::function<bool(const DummyNode&)> matcher, size_t count, const std::string& name);
void bundleNodesMatching(std::list<DummyNode*>& nodes, std::function<bool(const DummyNode&)> matcher, const std::string& name);
bool isTypeNodeWithSingleAggregation(const DummyNode& node, TokenComponentAggregation::Direction direction) const;
bool isTypeNodeWithSingleInheritance(const DummyNode& node, bool isBase) const;
bool isUndefinedNode(const DummyNode& node, bool isUsed) const;
bool isTypeUserNode(const DummyNode& node) const;
void bundleNodesAndEdgesMatching(std::function<bool(const DummyNode::BundleInfo&)> matcher, size_t count, const std::string& name);
void bundleNodesMatching(std::list<std::shared_ptr<DummyNode>>& nodes, std::function<bool(const DummyNode*)> matcher, const std::string& name);
void bundleNodesByType();
void layoutNesting();
void layoutNestingRecursive(DummyNode& node) const;
void addExpandToggleNode(DummyNode& node) const;
void layoutToGrid(DummyNode& node) const;
void layoutNestingRecursive(DummyNode* node) const;
void addExpandToggleNode(DummyNode* node) const;
void layoutToGrid(DummyNode* node) const;
void layoutGraph();
void layoutGraph(bool sort = false);
DummyNode* findDummyNodeRecursive(std::vector<DummyNode>& nodes, Id tokenId) const;
DummyNode* findTopLevelDummyNodeRecursive(std::vector<DummyNode>& nodes, Id tokenId) const;
DummyNode* findDummyNodeAccessRecursive(std::vector<DummyNode>& nodes, Id parentId, TokenComponentAccess::AccessType type) const;
DummyNode* getDummyGraphNodeById(Id tokenId) const;
void buildGraph(MessageBase* message);
void buildGraph(MessageBase* message, bool animated = true);
void forEachDummyNodeRecursive(std::function<void(DummyNode*)> func);
void forEachDummyEdge(std::function<void(DummyEdge*)> func);
virtual void handleMessage(MessageColorSchemeTest* message);
StorageAccess* m_storageAccess;
std::vector<DummyNode> m_dummyNodes;
std::vector<DummyEdge> m_dummyEdges;
std::vector<std::shared_ptr<DummyNode>> m_dummyNodes;
std::vector<std::shared_ptr<DummyEdge>> m_dummyEdges;
std::map<Id, std::shared_ptr<DummyNode>> m_dummyGraphNodes;
std::vector<Id> m_activeNodeIds;
std::vector<Id> m_activeEdgeIds;
@@ -24,6 +24,10 @@ IDECommunicationController::~IDECommunicationController()
{
}
void IDECommunicationController::clear()
{
}
void IDECommunicationController::handleIncomingMessage(const std::string& message)
{
if (m_enabled == false)
@@ -20,6 +20,8 @@ public:
IDECommunicationController(StorageAccess* storageAccess);
virtual ~IDECommunicationController();
virtual void clear();
void handleIncomingMessage(const std::string& message);
bool getEnabled() const;
@@ -13,6 +13,10 @@ RefreshController::~RefreshController()
{
}
void RefreshController::clear()
{
}
void RefreshController::handleMessage(MessageAutoRefreshChanged* message)
{
m_autoRefreshEnabled = message->enabled;
@@ -17,6 +17,8 @@ public:
RefreshController();
virtual ~RefreshController();
virtual void clear();
private:
virtual void handleMessage(MessageAutoRefreshChanged* message);
virtual void handleMessage(MessageWindowFocus* message);
@@ -2,6 +2,7 @@
#include "component/view/SearchView.h"
#include "data/access/StorageAccess.h"
#include "utility/tracing.h"
SearchController::SearchController(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
@@ -12,27 +13,64 @@ SearchController::~SearchController()
{
}
void SearchController::handleMessage(MessageActivateAll* message)
{
SearchMatch match = SearchMatch::createCommand(SearchMatch::COMMAND_ALL);
getView()->setMatches(std::vector<SearchMatch>(1, match));
}
void SearchController::handleMessage(MessageActivateTokens* message)
{
if (!message->keepContent() && !message->isFromSearch)
if (!message->isFromSearch)
{
getView()->setMatches(m_storageAccess->getSearchMatchesForTokenIds(message->tokenIds));
if (!message->keepContent() && message->tokenIds.size())
{
getView()->setMatches(m_storageAccess->getSearchMatchesForTokenIds(message->tokenIds));
}
else if ((message->isReplayed() || message->unknownNames.size()) && !message->tokenIds.size())
{
std::vector<SearchMatch> matches;
for (const std::string& name : message->unknownNames)
{
matches.push_back(SearchMatch(name));
}
if (!matches.size())
{
matches.push_back(SearchMatch("<invalid>"));
}
getView()->setMatches(matches);
}
}
}
void SearchController::handleMessage(MessageFind* message)
{
getView()->setFocus();
if (message->findFulltext)
{
getView()->findFulltext();
}
else
{
getView()->setFocus();
}
}
void SearchController::handleMessage(MessageSearch* message)
{
const std::vector<SearchMatch>& matches = message->getMatches();
for (const SearchMatch& match : matches)
{
if (match.searchType == SearchMatch::SEARCH_COMMAND)
{
SearchMatch m = SearchMatch::createCommand(SearchMatch::getCommandType(match.getFullName()));
getView()->setMatches(std::vector<SearchMatch>(1, m));
return;
}
}
}
void SearchController::handleMessage(MessageSearchAutocomplete* message)
{
TRACE("search autocomplete");
LOG_INFO("autocomplete string: \"" + message->query + "\"");
getView()->setAutocompletionList(m_storageAccess->getAutocompletionMatches(message->query));
}
@@ -40,7 +78,10 @@ void SearchController::handleMessage(MessageSearchAutocomplete* message)
void SearchController::handleMessage(MessageSearchFullText* message)
{
LOG_INFO("fulltext string: \"" + message->searchTerm + "\"");
SearchMatch match("@" + message->searchTerm);
std::string prefix(message->caseSensitive ? 2 : 1, SearchMatch::FULLTEXT_SEARCH_CHARACTER);
SearchMatch match(prefix + message->searchTerm);
match.searchType = SearchMatch::SEARCH_FULLTEXT;
getView()->setMatches(std::vector<SearchMatch>(1, match));
}
@@ -54,3 +95,8 @@ SearchView* SearchController::getView()
{
return Controller::getView<SearchView>();
}
void SearchController::clear()
{
getView()->setMatches(std::vector<SearchMatch>());
}
@@ -3,9 +3,9 @@
#include "component/controller/Controller.h"
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageActivateAll.h"
#include "utility/messaging/type/MessageActivateTokens.h"
#include "utility/messaging/type/MessageFind.h"
#include "utility/messaging/type/MessageSearch.h"
#include "utility/messaging/type/MessageSearchAutocomplete.h"
#include "utility/messaging/type/MessageSearchFullText.h"
#include "utility/messaging/type/MessageShowErrors.h"
@@ -15,9 +15,9 @@ class SearchView;
class SearchController
: public Controller
, public MessageListener<MessageActivateAll>
, public MessageListener<MessageActivateTokens>
, public MessageListener<MessageFind>
, public MessageListener<MessageSearch>
, public MessageListener<MessageSearchAutocomplete>
, public MessageListener<MessageSearchFullText>
, public MessageListener<MessageShowErrors>
@@ -27,15 +27,17 @@ public:
~SearchController();
private:
virtual void handleMessage(MessageActivateAll* message);
virtual void handleMessage(MessageActivateTokens* message);
virtual void handleMessage(MessageFind* message);
virtual void handleMessage(MessageSearch* message);
virtual void handleMessage(MessageSearchAutocomplete* message);
virtual void handleMessage(MessageSearchFullText* message);
virtual void handleMessage(MessageShowErrors* message);
SearchView* getView();
virtual void clear();
StorageAccess* m_storageAccess;
};
@@ -18,6 +18,11 @@ StatusBarView* StatusBarController::getView()
return Controller::getView<StatusBarView>();
}
void StatusBarController::clear()
{
getView()->setErrorCount(ErrorCountInfo());
}
void StatusBarController::handleMessage(MessageClearErrorCount* message)
{
getView()->setErrorCount(ErrorCountInfo());
@@ -27,6 +27,8 @@ public:
StatusBarView* getView();
virtual void clear();
private:
virtual void handleMessage(MessageClearErrorCount* message);
virtual void handleMessage(MessageFinishedParsing* message);
@@ -9,7 +9,6 @@
#include "data/access/StorageAccess.h"
UndoRedoController::UndoRedoController(StorageAccess* storageAccess)
: m_activationTranslator(storageAccess)
{
m_iterator = m_list.end();
}
@@ -23,9 +22,19 @@ UndoRedoView* UndoRedoController::getView()
return Controller::getView<UndoRedoView>();
}
UndoRedoController::Command::Command(std::shared_ptr<MessageBase> message, Order order)
void UndoRedoController::clear()
{
m_list.clear();
m_iterator = m_list.begin();
getView()->setUndoButtonEnabled(false);
getView()->setRedoButtonEnabled(false);
}
UndoRedoController::Command::Command(std::shared_ptr<MessageBase> message, Order order, bool replayLastOnly)
: message(message)
, order(order)
, replayLastOnly(replayLastOnly)
{
}
@@ -64,7 +73,7 @@ void UndoRedoController::handleMessage(MessageActivateLocalSymbols* message)
return;
}
Command command(std::make_shared<MessageActivateLocalSymbols>(*message), Command::ORDER_VIEW);
Command command(std::make_shared<MessageActivateLocalSymbols>(*message), Command::ORDER_VIEW, true);
processCommand(command);
}
@@ -97,7 +106,7 @@ void UndoRedoController::handleMessage(MessageActivateTokenIds* message)
void UndoRedoController::handleMessage(MessageChangeFileView* message)
{
Command command(std::make_shared<MessageChangeFileView>(*message), Command::ORDER_ADAPT);
Command command(std::make_shared<MessageChangeFileView>(*message), Command::ORDER_VIEW);
processCommand(command);
}
@@ -133,21 +142,16 @@ void UndoRedoController::handleMessage(MessageGraphNodeBundleSplit* message)
void UndoRedoController::handleMessage(MessageGraphNodeExpand* message)
{
Command command(std::make_shared<MessageGraphNodeExpand>(*message), Command::ORDER_ADAPT);
Command command(std::make_shared<MessageGraphNodeExpand>(*message), Command::ORDER_VIEW);
processCommand(command);
}
void UndoRedoController::handleMessage(MessageGraphNodeMove* message)
{
Command command(std::make_shared<MessageGraphNodeMove>(*message), Command::ORDER_ADAPT);
Command command(std::make_shared<MessageGraphNodeMove>(*message), Command::ORDER_VIEW);
processCommand(command);
}
void UndoRedoController::handleMessage(MessageLoadProject* message)
{
clear();
}
void UndoRedoController::handleMessage(MessageRedo* message)
{
if (m_iterator == m_list.end())
@@ -181,7 +185,7 @@ void UndoRedoController::handleMessage(MessageRefresh* message)
return;
}
if (requiresActivateFallbackToken())
if (m_iterator == m_list.begin())
{
SearchMatch match = SearchMatch::createCommand(SearchMatch::COMMAND_ALL);
MessageSearch msg(std::vector<SearchMatch>(1, match));
@@ -203,7 +207,7 @@ void UndoRedoController::handleMessage(MessageScrollCode* message)
return;
}
Command command(std::make_shared<MessageScrollCode>(*message), Command::ORDER_VIEW);
Command command(std::make_shared<MessageScrollCode>(*message), Command::ORDER_VIEW, true);
processCommand(command);
}
@@ -233,29 +237,46 @@ void UndoRedoController::handleMessage(MessageSearchFullText* message)
void UndoRedoController::handleMessage(MessageShowScope* message)
{
Command command(std::make_shared<MessageShowScope>(*message), Command::ORDER_ADAPT);
Command command(std::make_shared<MessageShowScope>(*message), Command::ORDER_VIEW);
processCommand(command);
}
void UndoRedoController::handleMessage(MessageUndo* message)
{
if (!m_list.size() || std::prev(m_iterator) == m_list.begin())
if (!m_list.size())
{
return;
}
while (std::prev(m_iterator)->order == Command::ORDER_VIEW)
// return to last non view command
std::list<Command>::iterator it = m_iterator;
while (std::prev(it)->order == Command::ORDER_VIEW)
{
std::advance(m_iterator, -1);
std::advance(it, -1);
}
std::advance(m_iterator, -1);
std::advance(it, -1);
if (std::distance(m_list.begin(), m_iterator) <= 1)
// disable undo button if there is no non view command till the first command
std::list<Command>::iterator it2 = std::prev(it);
while (it2->order == Command::ORDER_VIEW)
{
std::advance(it2, -1);
}
if (it2 == m_list.begin())
{
getView()->setUndoButtonEnabled(false);
}
// abort if first command is reached
if (it == m_list.begin())
{
return;
}
getView()->setRedoButtonEnabled(true);
m_iterator = it;
replayCommands();
MessageFlushUpdates().dispatch();
@@ -282,13 +303,16 @@ void UndoRedoController::replayCommands(std::list<Command>::iterator it)
while (it != m_iterator)
{
m = it->message;
if (it->order != Command::ORDER_VIEW)
if (it->order != Command::ORDER_VIEW || it->replayLastOnly == false)
{
m->setIsReplayed(true);
m->setIsLast(it == std::prev(m_iterator));
m->dispatch();
viewCommands.clear();
if (it->order != Command::ORDER_VIEW)
{
viewCommands.clear();
}
}
else
{
@@ -323,6 +347,11 @@ void UndoRedoController::replayCommands(std::list<Command>::iterator it)
void UndoRedoController::processCommand(Command command)
{
if (command.order != Command::ORDER_ACTIVATE && m_iterator == m_list.begin())
{
return;
}
if (command.order == Command::ORDER_ACTIVATE && command.message->keepContent())
{
command.order = Command::ORDER_ADAPT;
@@ -366,15 +395,6 @@ void UndoRedoController::processCommand(Command command)
}
}
void UndoRedoController::clear()
{
m_list.clear();
m_iterator = m_list.end();
getView()->setUndoButtonEnabled(false);
getView()->setRedoButtonEnabled(false);
}
bool UndoRedoController::sameMessageTypeAsLast(MessageBase* message) const
{
if (!m_list.size() || m_list.begin() == m_iterator)
@@ -390,50 +410,38 @@ MessageBase* UndoRedoController::lastMessage() const
return std::prev(m_iterator)->message.get();
}
bool UndoRedoController::requiresActivateFallbackToken() const
void UndoRedoController::dump() const
{
if (m_iterator == m_list.begin())
std::cout << "Undo Redo Stack:\n\n";
std::list<Command>::const_iterator it = m_list.begin();
while (it != m_list.end())
{
return true;
switch (it->order)
{
case Command::ORDER_VIEW:
std::cout << "\t";
case Command::ORDER_ADAPT:
std::cout << "\t";
case Command::ORDER_ACTIVATE:
break;
}
std::cout << it->message->getType() << " " << it->replayLastOnly;
if (it == m_iterator)
{
std::cout << " <-";
}
std::cout << std::endl;
std::advance(it, 1);
}
std::list<Command>::iterator it = m_iterator;
do
if (m_list.end() == m_iterator)
{
std::advance(it, -1);
std::cout << " <-";
}
while (it != m_list.begin() && it->order != Command::ORDER_ACTIVATE);
return !checkCommandCausesTokenActivation(*it);
}
bool UndoRedoController::checkCommandCausesTokenActivation(const Command& command) const
{
MessageBase* commandMessage = command.message.get();
if (commandMessage)
{
std::shared_ptr<MessageActivateTokens> m;
std::string commandMessageTypeString = commandMessage->getType();
if (commandMessageTypeString == MessageActivateEdge::getStaticType())
{
m = m_activationTranslator.translateMessage(dynamic_cast<const MessageActivateEdge*>(commandMessage));
}
else if (commandMessageTypeString == MessageActivateFile::getStaticType())
{
m = m_activationTranslator.translateMessage(dynamic_cast<const MessageActivateFile*>(commandMessage));
}
else if (commandMessageTypeString == MessageActivateNodes::getStaticType())
{
MessageActivateNodes inputMessage(*dynamic_cast<MessageActivateNodes*>(commandMessage));
inputMessage.setIsReplayed(true);
m = m_activationTranslator.translateMessage(&inputMessage);
}
else if (commandMessageTypeString == MessageSearch::getStaticType())
{
m = m_activationTranslator.translateMessage(dynamic_cast<const MessageSearch*>(commandMessage));
}
return (m && m->tokenIds.size() > 0);
}
return false;
std::cout << std::endl;
}
@@ -15,7 +15,6 @@
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
#include "utility/messaging/type/MessageGraphNodeExpand.h"
#include "utility/messaging/type/MessageGraphNodeMove.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessageRedo.h"
#include "utility/messaging/type/MessageRefresh.h"
#include "utility/messaging/type/MessageScrollCode.h"
@@ -24,7 +23,6 @@
#include "utility/messaging/type/MessageShowScope.h"
#include "utility/messaging/type/MessageUndo.h"
#include "component/controller/helper/ActivationTranslator.h"
#include "component/controller/Controller.h"
class StorageAccess;
@@ -42,7 +40,6 @@ class UndoRedoController
, public MessageListener<MessageGraphNodeBundleSplit>
, public MessageListener<MessageGraphNodeExpand>
, public MessageListener<MessageGraphNodeMove>
, public MessageListener<MessageLoadProject>
, public MessageListener<MessageRedo>
, public MessageListener<MessageRefresh>
, public MessageListener<MessageScrollCode>
@@ -57,6 +54,8 @@ public:
UndoRedoView* getView();
virtual void clear();
private:
struct Command
{
@@ -67,10 +66,11 @@ private:
ORDER_VIEW
};
Command(std::shared_ptr<MessageBase> message, Order order);
Command(std::shared_ptr<MessageBase> message, Order order, bool replayLastOnly = false);
std::shared_ptr<MessageBase> message;
Order order;
bool replayLastOnly;
};
virtual void handleMessage(MessageActivateEdge* message);
@@ -83,7 +83,6 @@ private:
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
virtual void handleMessage(MessageGraphNodeExpand* message);
virtual void handleMessage(MessageGraphNodeMove* message);
virtual void handleMessage(MessageLoadProject* message);
virtual void handleMessage(MessageRedo* message);
virtual void handleMessage(MessageRefresh* message);
virtual void handleMessage(MessageScrollCode* message);
@@ -97,15 +96,10 @@ private:
void processCommand(Command command);
void clear();
bool sameMessageTypeAsLast(MessageBase* message) const;
MessageBase* lastMessage() const;
bool requiresActivateFallbackToken() const;
bool checkCommandCausesTokenActivation(const Command& command) const;
ActivationTranslator m_activationTranslator;
void dump() const;
std::list<Command> m_list;
std::list<Command>::iterator m_iterator;
@@ -1,140 +0,0 @@
#include "component/controller/helper/ActivationTranslator.h"
#include "data/access/StorageAccess.h"
#include "utility/messaging/type/MessageActivateAll.h"
#include "utility/messaging/type/MessageActivateEdge.h"
#include "utility/messaging/type/MessageActivateFile.h"
#include "utility/messaging/type/MessageActivateNodes.h"
#include "utility/messaging/type/MessageActivateTokenIds.h"
#include "utility/messaging/type/MessageActivateTokens.h"
#include "utility/messaging/type/MessageChangeFileView.h"
#include "utility/messaging/type/MessageSearch.h"
#include "utility/messaging/type/MessageShowErrors.h"
ActivationTranslator::ActivationTranslator(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
{
}
ActivationTranslator::~ActivationTranslator()
{
}
std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(const MessageActivateEdge* message) const
{
std::shared_ptr<MessageActivateTokens> m;
if (message->isAggregation())
{
const Id sourceId = m_storageAccess->getIdForNodeWithNameHierarchy(message->fromNameHierarchy);
const Id targetId = m_storageAccess->getIdForNodeWithNameHierarchy(message->toNameHierarchy);
m = std::make_shared<MessageActivateTokens>(message, m_storageAccess->getTokenIdsForAggregationEdge(sourceId, targetId));
m->setKeepContent(false);
m->isAggregation = true;
}
else
{
Id edgeId = message->tokenId;
if (message->isReplayed())
{
edgeId = m_storageAccess->getIdForEdge(message->type, message->fromNameHierarchy, message->toNameHierarchy);
}
if (edgeId)
{
m = std::make_shared<MessageActivateTokens>(message, std::vector<Id>(1, edgeId));
m->isEdge = true;
}
}
return m;
}
std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(const MessageActivateFile* message) const
{
Id fileId = m_storageAccess->getTokenIdForFileNode(message->filePath);
if (fileId == 0)
{
MessageChangeFileView msg(
message->filePath,
MessageChangeFileView::FILE_MAXIMIZED,
true,
false,
nullptr
);
msg.setIsReplayed(message->isReplayed());
msg.setKeepContent(message->keepContent());
msg.dispatch();
return nullptr;
}
return std::make_shared<MessageActivateTokens>(message, std::vector<Id>(1, fileId));
}
std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(const MessageActivateNodes* message) const
{
std::vector<Id> nodeIds;
if (!message->isReplayed())
{
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
{
nodeIds.push_back(node.nodeId);
}
}
else
{
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
{
Id nodeId = m_storageAccess->getIdForNodeWithNameHierarchy(node.nameHierarchy);
if (nodeId > 0)
{
nodeIds.push_back(nodeId);
}
}
}
std::shared_ptr<MessageActivateTokens> m;
m = std::make_shared<MessageActivateTokens>(message, nodeIds);
return m;
}
std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(const MessageActivateTokenIds* message) const
{
return std::make_shared<MessageActivateTokens>(message, message->tokenIds);
}
std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(const MessageSearch* message) const
{
const std::vector<SearchMatch>& matches = message->getMatches();
for (const SearchMatch& match : matches)
{
if (match.searchType == SearchMatch::SEARCH_COMMAND &&
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ALL))
{
MessageActivateAll msg;
msg.setIsReplayed(message->isReplayed());
msg.dispatchImmediately();
return nullptr;
}
else if (match.searchType == SearchMatch::SEARCH_COMMAND &&
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR))
{
MessageShowErrors msg(ErrorCountInfo(-1, 0));
msg.setIsReplayed(message->isReplayed());
msg.dispatchImmediately();
return nullptr;
}
}
std::vector<Id> tokenIds = m_storageAccess->getTokenIdsForMatches(matches);
std::shared_ptr<MessageActivateTokens> m = std::make_shared<MessageActivateTokens>(message, tokenIds);
if (!message->isReplayed())
{
m->isFromSearch = true;
}
return m;
}
@@ -1,30 +0,0 @@
#ifndef ACTIVATION_TRANSLATOR_H
#define ACTIVATION_TRANSLATOR_H
#include <memory>
class MessageActivateEdge;
class MessageActivateFile;
class MessageActivateNodes;
class MessageActivateTokenIds;
class MessageActivateTokens;
class MessageSearch;
class StorageAccess;
class ActivationTranslator
{
public:
ActivationTranslator(StorageAccess* storageAccess);
~ActivationTranslator();
std::shared_ptr<MessageActivateTokens> translateMessage(const MessageActivateEdge* message) const;
std::shared_ptr<MessageActivateTokens> translateMessage(const MessageActivateFile* message) const;
std::shared_ptr<MessageActivateTokens> translateMessage(const MessageActivateNodes* message) const;
std::shared_ptr<MessageActivateTokens> translateMessage(const MessageActivateTokenIds* message) const;
std::shared_ptr<MessageActivateTokens> translateMessage(const MessageSearch* message) const;
private:
StorageAccess* m_storageAccess;
};
#endif // ACTIVATION_TRANSLATOR_H
@@ -1,11 +1,11 @@
#include "component/controller/helper/BucketGrid.h"
#include "utility/utilityString.h"
#include "component/controller/helper/DummyEdge.h"
#include "component/controller/helper/DummyNode.h"
#include "component/view/GraphViewStyle.h"
const Edge::EdgeTypeMask BucketGrid::s_verticalEdgeMask = Edge::EDGE_INHERITANCE | Edge::EDGE_OVERRIDE;
Bucket::Bucket()
: i(0)
, j(0)
@@ -53,9 +53,30 @@ void Bucket::addNode(DummyNode* node)
m_height += node->size.y + GraphViewStyle::toGridGap(10);
}
void Bucket::sort()
{
std::sort(m_nodes.begin(), m_nodes.end(),
[](const DummyNode* a, const DummyNode* b) -> bool
{
if ((a->isGraphNode() && b->isGraphNode()) || (a->isBundleNode() && b->isBundleNode()))
{
return utility::toLowerCase(a->name) < utility::toLowerCase(b->name);
}
else if (a->isGraphNode())
{
return true;
}
else
{
return false;
}
}
);
}
void Bucket::preLayout(Vec2i viewSize)
{
int cols = m_height / viewSize.y + 1;
int cols = (viewSize.y > 0 ? (m_height / viewSize.y) : 0) + 1;
int x = 0;
int y = 0;
@@ -78,7 +99,7 @@ void Bucket::preLayout(Vec2i viewSize)
{
y = 0;
x += width + GraphViewStyle::toGridGap(25);
x += width + GraphViewStyle::toGridGap(30);
width = 0;
}
}
@@ -99,13 +120,6 @@ void Bucket::layout(int x, int y, int width, int height)
}
void BucketGrid::layout(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges, Vec2i viewSize)
{
BucketGrid grid(viewSize);
grid.createBuckets(nodes, edges);
grid.layoutBuckets();
}
BucketGrid::BucketGrid(Vec2i viewSize)
: m_viewSize(viewSize)
, m_i1(0)
@@ -116,19 +130,20 @@ BucketGrid::BucketGrid(Vec2i viewSize)
m_buckets[0][0] = Bucket(0, 0);
}
void BucketGrid::createBuckets(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges)
{
void BucketGrid::createBuckets(
std::vector<std::shared_ptr<DummyNode>>& nodes, const std::vector<std::shared_ptr<DummyEdge>>& edges
){
if (!nodes.size())
{
return;
}
bool activeNodeAdded = false;
for (DummyNode& node : nodes)
for (std::shared_ptr<DummyNode> node : nodes)
{
if (node.hasActiveSubNode() || !edges.size())
if (node->hasActiveSubNode() || !edges.size())
{
addNode(&node);
addNode(node.get());
activeNodeAdded = true;
}
}
@@ -140,13 +155,13 @@ void BucketGrid::createBuckets(std::vector<DummyNode>& nodes, const std::vector<
if (!activeNodeAdded)
{
addNode(&nodes[0]);
addNode(nodes[0].get());
}
std::vector<const DummyEdge*> remainingEdges;
for (const DummyEdge& edge : edges)
for (std::shared_ptr<DummyEdge> edge : edges)
{
remainingEdges.push_back(&edge);
remainingEdges.push_back(edge.get());
}
size_t i = 0;
@@ -157,11 +172,6 @@ void BucketGrid::createBuckets(std::vector<DummyNode>& nodes, const std::vector<
DummyNode* owner = findTopMostDummyNodeRecursive(nodes, edge->ownerId);
DummyNode* target = findTopMostDummyNodeRecursive(nodes, edge->targetId);
if (edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD)
{
std::swap(owner, target);
}
bool removeEdge = false;
if (!owner || !target)
{
@@ -169,7 +179,21 @@ void BucketGrid::createBuckets(std::vector<DummyNode>& nodes, const std::vector<
}
else
{
bool horizontal = edge->data ? !edge->data->isType(s_verticalEdgeMask) : true;
bool horizontal = !owner->bundleInfo.layoutVertical && !target->bundleInfo.layoutVertical;
if (!horizontal)
{
if ((owner->bundleInfo.layoutVertical && owner->bundleInfo.isReferenced) ||
(target->bundleInfo.layoutVertical && target->bundleInfo.isReferencing))
{
std::swap(owner, target);
}
}
else if (edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD)
{
std::swap(owner, target);
}
removeEdge = addNode(owner, target, horizontal);
}
@@ -189,6 +213,17 @@ void BucketGrid::createBuckets(std::vector<DummyNode>& nodes, const std::vector<
}
}
void BucketGrid::sortBuckets()
{
for (int j = m_j1; j <= m_j2; j++)
{
for (int i = m_i1; i <= m_i2; i++)
{
m_buckets[j][i].sort();
}
}
}
void BucketGrid::layoutBuckets()
{
std::map<int, int> widths;
@@ -240,18 +275,19 @@ void BucketGrid::layoutBuckets()
}
}
DummyNode* BucketGrid::findTopMostDummyNodeRecursive(std::vector<DummyNode>& nodes, Id tokenId, DummyNode* top)
{
for (DummyNode& node : nodes)
DummyNode* BucketGrid::findTopMostDummyNodeRecursive(
std::vector<std::shared_ptr<DummyNode>>& nodes, Id tokenId, DummyNode* top
){
for (std::shared_ptr<DummyNode> node : nodes)
{
DummyNode* t = (top ? top : &node);
DummyNode* t = (top ? top : node.get());
if (node.visible && node.tokenId == tokenId)
if (node->visible && node->tokenId == tokenId)
{
return t;
}
DummyNode* result = findTopMostDummyNodeRecursive(node.subNodes, tokenId, t);
DummyNode* result = findTopMostDummyNodeRecursive(node->subNodes, tokenId, t);
if (result != nullptr)
{
return result;
@@ -263,7 +299,7 @@ DummyNode* BucketGrid::findTopMostDummyNodeRecursive(std::vector<DummyNode>& nod
void BucketGrid::addNode(DummyNode* node)
{
Bucket* bucket = getBucket(0, 0);
Bucket* bucket = getBucket(node->layoutBucket.x, node->layoutBucket.y);
bucket->addNode(node);
}
@@ -274,7 +310,8 @@ bool BucketGrid::addNode(DummyNode* owner, DummyNode* target, bool horizontal)
if (!ownerBucket && !targetBucket)
{
return false;
ownerBucket = getBucket(0, 0);
ownerBucket->addNode(owner);
}
else if (ownerBucket && targetBucket)
{
@@ -23,6 +23,8 @@ public:
bool hasNode(DummyNode* node) const;
void addNode(DummyNode* node);
void sort();
void preLayout(Vec2i viewSize);
void layout(int x, int y, int width, int height);
@@ -40,17 +42,16 @@ private:
class BucketGrid
{
public:
static void layout(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges, Vec2i viewSize);
private:
static const Edge::EdgeTypeMask s_verticalEdgeMask;
BucketGrid(Vec2i viewSize);
void createBuckets(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges);
void createBuckets(
std::vector<std::shared_ptr<DummyNode>>& nodes,
const std::vector<std::shared_ptr<DummyEdge>>& edges);
void sortBuckets();
void layoutBuckets();
DummyNode* findTopMostDummyNodeRecursive(std::vector<DummyNode>& nodes, Id tokenId, DummyNode* top = nullptr);
private:
DummyNode* findTopMostDummyNodeRecursive(
std::vector<std::shared_ptr<DummyNode>>& nodes, Id tokenId, DummyNode* top = nullptr);
void addNode(DummyNode* node);
bool addNode(DummyNode* owner, DummyNode* target, bool horizontal);
+50 -16
View File
@@ -13,6 +13,23 @@ class Node;
struct DummyNode
{
public:
struct BundleInfo
{
BundleInfo()
: isActive(false)
, isDefined(false)
, layoutVertical(false)
, isReferenced(false)
, isReferencing(false)
{}
bool isActive;
bool isDefined;
bool layoutVertical;
bool isReferenced;
bool isReferencing;
};
DummyNode()
: visible(false)
, childVisible(false)
@@ -25,6 +42,7 @@ public:
, hasParent(true)
, accessType(TokenComponentAccess::ACCESS_NONE)
, invisibleSubNodeCount(0)
, layoutBucket(0, 0)
, bundledNodeCount(0)
{
}
@@ -56,9 +74,9 @@ public:
bool hasVisibleSubNode() const
{
for (const DummyNode& node : subNodes)
for (std::shared_ptr<DummyNode> node : subNodes)
{
if (node.visible)
if (node->visible)
{
return true;
}
@@ -74,9 +92,9 @@ public:
return true;
}
for (const DummyNode& node : subNodes)
for (std::shared_ptr<DummyNode> node : subNodes)
{
if (node.hasActiveSubNode())
if (node->hasActiveSubNode())
{
return true;
}
@@ -94,9 +112,9 @@ public:
count += 1;
}
for (const DummyNode& node : subNodes)
for (std::shared_ptr<DummyNode> node : subNodes)
{
count += node.getActiveSubNodeCount();
count += node->getActiveSubNodeCount();
}
return count;
@@ -109,9 +127,9 @@ public:
return true;
}
for (const DummyNode& node : subNodes)
for (std::shared_ptr<DummyNode> node : subNodes)
{
if (node.hasConnectedSubNode())
if (node->hasConnectedSubNode())
{
return true;
}
@@ -129,9 +147,9 @@ public:
count += 1;
}
for (const DummyNode& node : subNodes)
for (std::shared_ptr<DummyNode> node : subNodes)
{
count += node.getConnectedSubNodeCount();
count += node->getConnectedSubNodeCount();
}
return count;
@@ -146,9 +164,9 @@ public:
nodes.push_back(this);
}
for (const DummyNode& node : subNodes)
for (std::shared_ptr<DummyNode> node : subNodes)
{
utility::append(nodes, node.getConnectedSubNodes());
utility::append(nodes, node->getConnectedSubNodes());
}
return nodes;
@@ -157,9 +175,9 @@ public:
std::vector<const DummyNode*> getAllBundledNodes() const
{
std::vector<const DummyNode*> nodes;
for (const DummyNode& node : bundledNodes)
for (std::shared_ptr<DummyNode> node : bundledNodes)
{
utility::append(nodes, node.getConnectedSubNodes());
utility::append(nodes, node->getConnectedSubNodes());
}
return nodes;
}
@@ -174,6 +192,16 @@ public:
return bundledNodes.size();
}
void forEachDummyNodeRecursive(std::function<void(DummyNode*)> func)
{
func(this);
for (std::shared_ptr<DummyNode> node : subNodes)
{
node->forEachDummyNodeRecursive(func);
}
}
Vec2i position;
Vec2i size;
@@ -183,7 +211,7 @@ public:
Id topLevelAncestorId;
Id tokenId;
std::vector<DummyNode> subNodes;
std::vector<std::shared_ptr<DummyNode>> subNodes;
// GraphNode
const Node* data;
@@ -200,8 +228,14 @@ public:
// ExpandToggleNode
size_t invisibleSubNodeCount;
// Bundling
BundleInfo bundleInfo;
// Layout
Vec2i layoutBucket;
// BundleNode
std::vector<DummyNode> bundledNodes;
std::vector<std::shared_ptr<DummyNode>> bundledNodes;
size_t bundledNodeCount;
};
@@ -4,7 +4,6 @@
#include <map>
#include <queue>
#include "component/controller/helper/BucketGrid.h"
#include "component/controller/helper/DummyEdge.h"
#include "component/controller/helper/DummyNode.h"
#include "data/graph/Node.h"
@@ -64,11 +63,6 @@ void GraphLayouter::layoutSimpleRing(std::vector<DummyNode>& nodes)
}
}
void GraphLayouter::layoutBucket(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges, Vec2i viewSize)
{
BucketGrid::layout(nodes, edges, viewSize);
}
void GraphLayouter::layoutSpectralPrototype(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges)
{
if (nodes.size() < 2)
@@ -176,7 +170,7 @@ MatrixDynamicBase<int> GraphLayouter::buildLaplacianMatrix(
{
for(unsigned int i = 0; i < remainingNodes.front().subNodes.size(); i++)
{
remainingNodes.push(remainingNodes.front().subNodes[i]);
remainingNodes.push(*remainingNodes.front().subNodes[i].get());
}
}
@@ -16,8 +16,6 @@ public:
static void layoutSimpleRaster(std::vector<DummyNode>& nodes);
static void layoutSimpleRing(std::vector<DummyNode>& nodes);
static void layoutBucket(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges, Vec2i viewSize);
static void layoutSpectralPrototype(std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges);
private:
+4 -1
View File
@@ -18,7 +18,10 @@ public:
virtual std::string getName() const;
virtual void rebuildGraph(
std::shared_ptr<Graph> graph, const std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges) = 0;
std::shared_ptr<Graph> graph,
const std::vector<std::shared_ptr<DummyNode>>& nodes,
const std::vector<std::shared_ptr<DummyEdge>>& edges,
bool animated) = 0;
virtual void clear() = 0;
virtual void focusTokenIds(const std::vector<Id>& focusedTokenIds) = 0;
+2 -2
View File
@@ -436,8 +436,8 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
style.width = 2;
style.arrowLength = 7;
style.arrowWidth = 10;
style.originOffset.x = 22;
style.targetOffset.x = 22;
style.originOffset.x = 24;
style.targetOffset.x = 24;
style.originOffset.y = 0;
style.targetOffset.y = 0;
style.verticalOffset = 0;
+3
View File
@@ -16,7 +16,10 @@ public:
virtual std::string getName() const;
virtual void setMatches(const std::vector<SearchMatch>& matches) = 0;
virtual void setFocus() = 0;
virtual void findFulltext() = 0;
virtual void setAutocompletionList(const std::vector<SearchMatch>& autocompletionList) = 0;
protected:
+17 -2
View File
@@ -25,14 +25,29 @@ void View::addToLayout()
m_viewLayout->addView(this);
}
void View::setComponent(Component* component)
{
m_component = component;
}
ViewWidgetWrapper* View::getWidgetWrapper() const
{
return m_widgetWrapper.get();
}
void View::setComponent(Component* component)
void View::createOverlay()
{
m_component = component;
getWidgetWrapper()->createOverlay();
}
void View::showOverlay()
{
getWidgetWrapper()->showOverlay();
}
void View::hideOverlay()
{
getWidgetWrapper()->hideOverlay();
}
ViewLayout* View::getViewLayout() const
+4
View File
@@ -35,6 +35,10 @@ public:
ViewWidgetWrapper* getWidgetWrapper() const;
void createOverlay();
void showOverlay();
void hideOverlay();
protected:
template <typename ControllerType>
ControllerType* getController();
@@ -6,6 +6,10 @@ class ViewWidgetWrapper
public:
ViewWidgetWrapper();
virtual ~ViewWidgetWrapper();
virtual void createOverlay() = 0;
virtual void showOverlay() = 0;
virtual void hideOverlay() = 0;
};
#endif // VIEW_WIDGET_WRAPPER_H
@@ -10,8 +10,9 @@ CodeSnippetParams::CodeSnippetParams()
, locationFile()
, refCount(0)
, isActive(false)
, isDeclaration(false)
, isCollapsed(false)
, isDeclaration(false)
, isDefinition(false)
, reduced(false)
{
}
@@ -28,6 +29,16 @@ bool CodeSnippetParams::sort(const CodeSnippetParams& a, const CodeSnippetParams
return false;
}
// sort definitions
if (a.isDefinition && !b.isDefinition)
{
return true;
}
else if (!a.isDefinition && b.isDefinition)
{
return false;
}
// sort declarations
if (a.isDeclaration && !b.isDeclaration)
{
@@ -31,9 +31,11 @@ struct CodeSnippetParams
int refCount;
bool isActive;
bool isDeclaration;
bool isCollapsed;
bool isDeclaration;
bool isDefinition;
bool reduced;
};
+83 -275
View File
@@ -12,6 +12,65 @@ IntermediateStorage::~IntermediateStorage()
{
}
Id IntermediateStorage::addFile(const std::string& name, const std::string& filePath, const std::string& modificationTime)
{
std::shared_ptr<StorageFile> file = std::make_shared<StorageFile>(0, name, filePath, modificationTime);
std::string serialized = serialize(*(file.get()));
std::unordered_map<std::string, Id>::const_iterator it = m_fileNamesToIds.find(serialized);
if (it != m_fileNamesToIds.end())
{
Id id = it->second;
if (m_fileIdsToData[id]->filePath.size() == 0) // stored information is incomplete.
{
m_fileIdsToData[id]->filePath = filePath; // so we replace it.
}
if (m_fileIdsToData[id]->modificationTime.size() == 0) // stored information is incomplete.
{
m_fileIdsToData[id]->modificationTime = modificationTime; // so we replace it.
}
return id;
}
Id id = m_nextId++;
m_fileNamesToIds[serialized] = id;
m_fileIdsToData[id] = file;
return id;
}
Id IntermediateStorage::addNode(int type, const std::string& serializedName, int definitionType)
{
std::shared_ptr<StorageNode> node = std::make_shared<StorageNode>(0, type, serializedName, definitionType);
std::string serialized = serialize(*(node.get()));
std::unordered_map<std::string, Id>::const_iterator it = m_nodeNamesToIds.find(serialized);
if (it != m_nodeNamesToIds.end())
{
std::map<Id, std::shared_ptr<StorageNode>>::const_iterator it2 = m_nodeIdsToData.find(it->second);
std::shared_ptr<StorageNode> storageNode = it2->second;
if (storageNode->definitionType == 0)
{
if (definitionType > 0)
{
storageNode->definitionType = definitionType;
}
if (storageNode->type < type)
{
storageNode->type = type;
}
}
return it->second;
}
Id id = m_nextId++;
m_nodeNamesToIds[serialized] = id;
m_nodeIdsToData[id] = node;
return id;
}
Id IntermediateStorage::addEdge(int type, Id sourceId, Id targetId)
{
std::shared_ptr<StorageEdge> edge = std::make_shared<StorageEdge>(0, type, sourceId, targetId);
@@ -27,84 +86,6 @@ Id IntermediateStorage::addEdge(int type, Id sourceId, Id targetId)
m_edgeNamesToIds[serialized] = id;
m_edgeIdsToData[id] = edge;
if (type == Edge::EDGE_MEMBER)
{
m_nodeIdsToMemberEdgeIds[targetId] = id;
}
return id;
}
Id IntermediateStorage::addNode(int type, const NameHierarchy& nameHierarchy, int definitionType)
{
std::shared_ptr<StorageNode> node = std::make_shared<StorageNode>(0, type, NameHierarchy::serialize(nameHierarchy), definitionType);
std::string serialized = serialize(*(node.get()));
std::unordered_map<std::string, Id>::const_iterator it = m_nodeNamesToIds.find(serialized);
if (it != m_nodeNamesToIds.end())
{
// update stored information
if (definitionType > 0)
{
std::map<Id, std::shared_ptr<StorageNode>>::const_iterator it2 = m_nodeIdsToData.find(it->second);
std::shared_ptr<StorageNode> storageNode = it2->second;
if (storageNode->definitionType == 0)
{
storageNode->definitionType = definitionType;
if (storageNode->type < type)
{
storageNode->type = type;
}
}
}
return it->second;
}
Id id = m_nextId++;
m_nodeNamesToIds[serialized] = id;
m_nodeIdsToData[id] = node;
return id;
}
Id IntermediateStorage::addFile(const std::string& name, const std::string& filePath, const std::string& modificationTime)
{
std::shared_ptr<StorageFile> file = std::make_shared<StorageFile>(0, name, filePath, modificationTime);
std::string serialized = serialize(*(file.get()));
std::unordered_map<std::string, Id>::const_iterator it = m_fileNamesToIds.find(serialized);
if (it != m_fileNamesToIds.end())
{
Id id = it->second;
if (m_fileIdsToData[id]->filePath.size() == 0) // stored information is incomplete.
{
m_fileIdsToData[id] = file; // so we replace it.
}
return id;
}
Id id = m_nextId++;
m_fileNamesToIds[serialized] = id;
m_fileIdsToData[id] = file;
return id;
}
Id IntermediateStorage::addFile(const std::string& filePath)
{
std::shared_ptr<StorageFile> file = std::make_shared<StorageFile>(0, "", filePath, "");
std::string serialized = serialize(*(file.get()));
std::unordered_map<std::string, Id>::const_iterator it = m_fileNamesToIds.find(serialized);
if (it != m_fileNamesToIds.end())
{
return it->second;
}
Id id = m_nextId++;
m_fileNamesToIds[serialized] = id;
m_fileIdsToData[id] = file;
return id;
}
@@ -126,229 +107,48 @@ Id IntermediateStorage::addLocalSymbol(const std::string& name)
return id;
}
void IntermediateStorage::addSourceLocation(Id elementId, const ParseLocation& location, int type)
void IntermediateStorage::addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type)
{
Id fileNodeId = addFile(location.filePath.str());
m_sourceLocations.push_back(StorageSourceLocation(
0,
elementId,
fileNodeId,
location.startLineNumber,
location.startColumnNumber,
location.endLineNumber,
location.endColumnNumber,
startLine,
startCol,
endLine,
endCol,
type
));
}
void IntermediateStorage::addComponentAccess(Id nodeId, int type)
void IntermediateStorage::addComponentAccess(Id edgeId, int type)
{
std::unordered_map<Id, Id>::const_iterator it = m_nodeIdsToMemberEdgeIds.find(nodeId);
if (it != m_nodeIdsToMemberEdgeIds.end())
{
m_componentAccesses.push_back(StorageComponentAccess(it->second, type));
}
else
{
LOG_ERROR_STREAM(<< "Cannot assign access" << type << " to node id " << nodeId << " because it's not a child node.");
}
m_componentAccesses.push_back(StorageComponentAccess(edgeId, type));
}
void IntermediateStorage::addCommentLocation(const ParseLocation& location)
void IntermediateStorage::addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol)
{
Id fileNodeId = addFile(location.filePath.str());
m_commentLocations.push_back(StorageCommentLocation(
0,
fileNodeId,
location.startLineNumber,
location.startColumnNumber,
location.endLineNumber,
location.endColumnNumber
startLine,
startCol,
endLine,
endCol
));
}
void IntermediateStorage::addError(const std::string& message, bool fatal, const ParseLocation& location)
void IntermediateStorage::addError(const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol)
{
m_errors.push_back(StorageError(
message,
fatal,
location.filePath.str(),
location.startLineNumber,
location.startColumnNumber
filePath,
startLine,
startCol
));
}
void IntermediateStorage::transferToStorage(SqliteStorage& storage)
{
storage.beginTransaction();
std::unordered_map<Id, Id> clientIdToStorageId;
for (std::unordered_map<Id, std::shared_ptr<StorageFile>>::const_iterator it = m_fileIdsToData.begin(); it != m_fileIdsToData.end(); it++)
{
if (it->second->name.size() > 0)
{
Id fileNodeId = storage.getFileByPath(it->second->filePath).id;
if (fileNodeId == 0)
{
NameHierarchy nameHierarchy;
nameHierarchy.push(std::make_shared<NameElement>(it->second->name));
fileNodeId = storage.addFile(
NameHierarchy::serialize(nameHierarchy),
it->second->filePath,
it->second->modificationTime
);
}
clientIdToStorageId[it->first] = fileNodeId;
}
}
for (std::map<Id, std::shared_ptr<StorageNode>>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++)
{
StorageNode clientNode = *(it->second.get());
StorageNode storageNode = storage.getNodeBySerializedName(clientNode.serializedName);
Id storageNodeId = storageNode.id;
if (storageNodeId)
{
if (clientNode.definitionType > 0)
{
if (storageNode.definitionType == 0)
{
storage.setNodeDefinitionType(clientNode.definitionType, storageNode.id);
if(storageNode.type < clientNode.type)
{
storage.setNodeType(clientNode.type, storageNode.id);
}
}
}
}
else
{
storageNodeId = storage.addNode(clientNode.type, clientNode.serializedName, clientNode.definitionType);
}
clientIdToStorageId[it->first] = storageNodeId;
}
for (std::map<Id, std::shared_ptr<StorageEdge>>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++)
{
std::unordered_map<Id, Id>::const_iterator it2;
it2 = clientIdToStorageId.find(it->second->sourceNodeId);
if (it2 == clientIdToStorageId.end())
{
continue;
}
Id storageSourceId = it2->second;
it2 = clientIdToStorageId.find(it->second->targetNodeId);
if (it2 == clientIdToStorageId.end())
{
continue;
}
Id storageTargetId = it2->second;
Id edgeId = storage.getEdgeBySourceTargetType(storageSourceId, storageTargetId, it->second->type).id;
if (!edgeId)
{
edgeId = storage.addEdge(it->second->type, storageSourceId, storageTargetId);
}
clientIdToStorageId[it->first] = edgeId;
}
for (std::map<Id, std::shared_ptr<StorageLocalSymbol>>::const_iterator it = m_localSymbolIdsToData.begin(); it != m_localSymbolIdsToData.end(); it++)
{
StorageLocalSymbol clientLocalSymbol = *(it->second.get());
StorageLocalSymbol storageLocalSymbol = storage.getLocalSymbolByName(clientLocalSymbol.name);
Id storageLocalSymbolId = storageLocalSymbol.id;
if (storageLocalSymbolId == 0)
{
storageLocalSymbolId = storage.addLocalSymbol(clientLocalSymbol.name);
}
clientIdToStorageId[it->first] = storageLocalSymbolId;
}
for (size_t i = 0; i < m_sourceLocations.size(); i++)
{
StorageSourceLocation sourceLocation = m_sourceLocations[i];
std::unordered_map<Id, Id>::const_iterator it;
it = clientIdToStorageId.find(sourceLocation.elementId);
if (it == clientIdToStorageId.end())
{
continue;
}
Id storageElementId = it->second;
it = clientIdToStorageId.find(sourceLocation.fileNodeId);
if (it == clientIdToStorageId.end())
{
continue;
}
Id storageFileNodeId = it->second;
storage.addSourceLocation(
storageElementId,
storageFileNodeId,
sourceLocation.startLine,
sourceLocation.startCol,
sourceLocation.endLine,
sourceLocation.endCol,
sourceLocation.type
);
}
for (size_t i = 0; i < m_componentAccesses.size(); i++)
{
StorageComponentAccess componentAccess = m_componentAccesses[i];
std::unordered_map<Id, Id>::const_iterator it;
it = clientIdToStorageId.find(componentAccess.memberEdgeId);
if (it == clientIdToStorageId.end())
{
continue;
}
Id storageMemberEdgeId = it->second;
storage.addComponentAccess(storageMemberEdgeId, componentAccess.type);
}
for (size_t i = 0; i < m_commentLocations.size(); i++)
{
StorageCommentLocation commentLocation = m_commentLocations[i];
std::unordered_map<Id, Id>::const_iterator it;
it = clientIdToStorageId.find(commentLocation.fileNodeId);
if (it == clientIdToStorageId.end())
{
continue;
}
Id storageFileNodeId = it->second;
storage.addCommentLocation(
storageFileNodeId,
commentLocation.startLine,
commentLocation.startCol,
commentLocation.endLine,
commentLocation.endCol
);
}
for (size_t i = 0; i < m_errors.size(); i++)
{
StorageError error = m_errors[i];
storage.addError(
error.message,
error.fatal,
error.filePath,
error.lineNumber,
error.columnNumber
);
}
storage.commitTransaction();
}
void IntermediateStorage::forEachFile(std::function<void(const Id /*id*/, const StorageFile& /*data*/)> callback) const
{
for (std::unordered_map<Id, std::shared_ptr<StorageFile>>::const_iterator it = m_fileIdsToData.begin(); it != m_fileIdsToData.end(); it++)
@@ -373,6 +173,14 @@ void IntermediateStorage::forEachEdge(std::function<void(const Id /*id*/, const
}
}
void IntermediateStorage::forEachLocalSymbol(std::function<void(const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const
{
for (std::map<Id, std::shared_ptr<StorageLocalSymbol>>::const_iterator it = m_localSymbolIdsToData.begin(); it != m_localSymbolIdsToData.end(); it++)
{
callback(it->first, *(it->second.get()));
}
}
void IntermediateStorage::forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const
{
for (std::vector<StorageSourceLocation>::const_iterator it = m_sourceLocations.begin(); it != m_sourceLocations.end(); it++)
+20 -25
View File
@@ -2,40 +2,35 @@
#define INTERMEDIATE_STORAGE_H
#include <memory>
#include <string>
#include <map>
#include <unordered_map>
#include "utility/types.h"
#include "data/name/NameHierarchy.h"
#include "data/parser/ParseLocation.h"
#include "data/SqliteStorage.h"
#include "data/StorageTypes.h"
#include "data/Storage.h"
class IntermediateStorage
class IntermediateStorage: public Storage
{
public:
IntermediateStorage();
~IntermediateStorage();
Id addEdge(int type, Id sourceId, Id targetId);
Id addNode(int type, const NameHierarchy& nameHierarchy, int definitionType);
Id addFile(const std::string& name, const std::string& filePath, const std::string& modificationTime);
Id addFile(const std::string& filePath);
Id addLocalSymbol(const std::string& name);
void addSourceLocation(Id elementId, const ParseLocation& location, int type);
void addComponentAccess(Id nodeId , int type);
void addCommentLocation(const ParseLocation& location);
void addError(const std::string& message, bool fatal, const ParseLocation& location);
virtual ~IntermediateStorage();
void transferToStorage(SqliteStorage& storage); // TODO: remove this and use foreach-callbacks instead
virtual Id addFile(const std::string& name, const std::string& filePath, const std::string& modificationTime);
virtual Id addNode(int type, const std::string& serializedName, int definitionType);
virtual Id addEdge(int type, Id sourceId, Id targetId);
virtual Id addLocalSymbol(const std::string& name);
virtual void addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type);
virtual void addComponentAccess(Id edgeId , int type);
virtual void addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol);
virtual void addError(const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol);
void forEachFile(std::function<void(const Id /*id*/, const StorageFile& /*data*/)> callback) const;
void forEachNode(std::function<void(const Id /*id*/, const StorageNode& /*data*/)> callback) const;
void forEachEdge(std::function<void(const Id /*id*/, const StorageEdge& /*data*/)> callback) const;
void forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const;
void forEachComponentAccess(std::function<void(const StorageComponentAccess& /*data*/)> callback) const;
void forEachCommentLocation(std::function<void(const StorageCommentLocation& /*data*/)> callback) const;
void forEachError(std::function<void(const StorageError& /*data*/)> callback) const;
virtual void forEachFile(std::function<void(const Id /*id*/, const StorageFile& /*data*/)> callback) const;
virtual void forEachNode(std::function<void(const Id /*id*/, const StorageNode& /*data*/)> callback) const;
virtual void forEachEdge(std::function<void(const Id /*id*/, const StorageEdge& /*data*/)> callback) const;
virtual void forEachLocalSymbol(std::function<void(const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const;
virtual void forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const;
virtual void forEachComponentAccess(std::function<void(const StorageComponentAccess& /*data*/)> callback) const;
virtual void forEachCommentLocation(std::function<void(const StorageCommentLocation& /*data*/)> callback) const;
virtual void forEachError(std::function<void(const StorageError& /*data*/)> callback) const;
private:
std::string serialize(const StorageEdge& edge);
File diff suppressed because it is too large Load Diff
+157
View File
@@ -0,0 +1,157 @@
#ifndef PERSISTENT_STORAGE_H
#define PERSISTENT_STORAGE_H
#include <memory>
#include <vector>
#include "utility/file/FilePath.h"
#include "data/access/StorageAccess.h"
#include "data/fulltextsearch/FullTextSearchIndex.h"
#include "data/graph/token_component/TokenComponentAccess.h"
#include "data/location/TokenLocationCollection.h"
#include "data/parser/ParserClient.h"
#include "data/parser/ParseLocation.h"
#include "data/search/SearchIndex.h"
#include "data/HierarchyCache.h"
#include "data/SqliteStorage.h"
#include "data/Storage.h"
#include "data/parser/ParserClientImpl.h"
class PersistentStorage
: public Storage
, public StorageAccess
{
public:
PersistentStorage(const FilePath& dbPath);
virtual ~PersistentStorage();
virtual Id addFile(const std::string& name, const std::string& filePath, const std::string& modificationTime);
virtual Id addNode(int type, const std::string& serializedName, int definitionType);
virtual Id addEdge(int type, Id sourceId, Id targetId);
virtual Id addLocalSymbol(const std::string& name);
virtual void addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type);
virtual void addComponentAccess(Id edgeId , int type);
virtual void addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol);
virtual void addError(const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol);
virtual void forEachFile(std::function<void(const Id /*id*/, const StorageFile& /*data*/)> callback) const;
virtual void forEachNode(std::function<void(const Id /*id*/, const StorageNode& /*data*/)> callback) const;
virtual void forEachEdge(std::function<void(const Id /*id*/, const StorageEdge& /*data*/)> callback) const;
virtual void forEachLocalSymbol(std::function<void(const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const;
virtual void forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const;
virtual void forEachComponentAccess(std::function<void(const StorageComponentAccess& /*data*/)> callback) const;
virtual void forEachCommentLocation(std::function<void(const StorageCommentLocation& /*data*/)> callback) const;
virtual void forEachError(std::function<void(const StorageError& /*data*/)> callback) const;
virtual void startInjection();
virtual void finishInjection();
FilePath getDbFilePath() const;
Version getVersion() const;
void init();
void clear();
void clearCaches();
std::set<FilePath> getDependingFilePaths(const std::set<FilePath>& filePaths);
std::set<FilePath> getDependingFilePaths(const FilePath& filePath);
void clearFileElements(const std::vector<FilePath>& filePaths);
std::vector<FileInfo> getInfoOnAllFiles() const;
void logStats() const;
void startParsing();
void finishParsing();
void optimizeMemory();
// StorageAccess implementation
virtual Id getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const;
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
virtual NameHierarchy getNameHierarchyForNodeWithId(Id nodeId) const;
virtual Node::NodeType getNodeTypeForNodeWithId(Id nodeId) const;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm, bool caseSensitive) const;
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& elementIds) const;
virtual std::shared_ptr<Graph> getGraphForAll() const;
virtual std::shared_ptr<Graph> getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId, Id* declarationId) const;
virtual std::vector<Id> getNodeIdsForLocationIds(const std::vector<Id>& locationIds) const;
virtual std::vector<Id> getLocalSymbolIdsForLocationIds(const std::vector<Id>& locationIds) const;
virtual std::vector<Id> getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const;
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds
) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(
const std::vector<Id>& locationIds
) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
virtual FileInfo getFileInfoForFilePath(const FilePath& filePath) const;
virtual std::vector<FileInfo> getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const;
virtual ErrorCountInfo getErrorCount() const;
virtual StorageStats getStorageStats() const;
private:
Id getFileNodeId(const FilePath& filePath) const;
FilePath getFileNodePath(Id fileId) const;
Id getLastVisibleParentNodeId(const Id nodeId) const;
std::vector<Id> getAllChildNodeIds(const Id nodeId) const;
void addNodesToGraph(const std::vector<Id>& nodeIds, Graph* graph) const;
void addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) const;
void addNodesWithChildrenAndEdgesToGraph(
const std::vector<Id>& nodeIds,
const std::vector<Id>& edgeIds, Graph* graph
) const;
void addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const;
void addComponentAccessToGraph(Graph* graph) const;
void buildSearchIndex();
void buildFilePathMaps();
void buildFullTextSearchIndex() const;
void buildHierarchyCache();
void log(std::string type, std::string str, const ParseLocation& location) const;
int m_preInjectionErrorCount;
SearchIndex m_commandIndex;
SearchIndex m_elementIndex;
mutable FullTextSearchIndex m_fullTextSearchIndex;
SqliteStorage m_sqliteStorage;
mutable std::map <FilePath, Id> m_fileNodeIds;
mutable std::map <Id, FilePath> m_fileNodePaths;
HierarchyCache m_hierarchyCache;
};
#endif // PERSISTENT_STORAGE_H
File diff suppressed because it is too large Load Diff
+40 -23
View File
@@ -42,9 +42,7 @@ public:
Id addFile(const std::string& serializedName, const std::string& filePath, const std::string& modificationTime);
Id addLocalSymbol(const std::string& name);
Id addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type);
Id addComponentAccess(Id memberEdgeId, int type);
Id addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol);
Id addError(const std::string& message, bool fatal, const std::string& filePath, uint lineNumber, uint columnNumber);
@@ -54,9 +52,6 @@ public:
void removeErrorsInFiles(const std::vector<FilePath>& filePaths);
StorageNode getFirstNode() const;
std::vector<StorageNode> getAllNodes() const;
bool isEdge(Id elementId) const;
bool isNode(Id elementId) const;
bool isFile(Id elementId) const;
@@ -84,10 +79,9 @@ public:
StorageFile getFileById(const Id id) const;
StorageFile getFileByPath(const FilePath& filePath) const;
std::vector<Id> getAllFileIds() const;
std::vector<StorageFile> getFilesByPaths(const std::vector<FilePath>& filePaths) const;
std::vector<StorageFile> getAllFiles() const;
std::shared_ptr<TextAccess> getFileContentByPath(const std::string& filePath) const;
std::shared_ptr<TextAccess> getFileContentById(Id fileId) const;
void setNodeType(int type, Id nodeId);
void setNodeDefinitionType(int definitionType, Id nodeId);
@@ -102,13 +96,22 @@ public:
StorageComponentAccess getComponentAccessByMemberEdgeId(Id memberEdgeId) const;
std::vector<StorageComponentAccess> getComponentAccessByMemberEdgeIds(const std::vector<Id>& memberEdgeIds) const;
void optimizeMemory() const;
std::vector<ParseLocation> getFullTextSearch(const std::string& searchTerm) const;
void optimizeFTSTable() const;
std::vector<StorageCommentLocation> getCommentLocationsInFile(const FilePath& filePath) const;
std::vector<StorageError> getAllErrors() const;
std::vector<StorageError> getFatalErrors() const;
std::vector<StorageFile> getAllFiles() const;
std::vector<StorageNode> getAllNodes() const;
std::vector<StorageEdge> getAllEdges() const;
std::vector<StorageLocalSymbol> getAllLocalSymbols() const;
std::vector<StorageSourceLocation> getAllSourceLocations() const;
std::vector<StorageComponentAccess> getAllComponentAccesses() const;
std::vector<StorageCommentLocation> getAllCommentLocations() const;
std::vector<StorageError> getAllErrors() const;
int getNodeCount() const;
int getEdgeCount() const;
int getFileCount() const;
@@ -124,26 +127,40 @@ private:
std::string getMetaValue(const std::string& key) const;
void insertOrUpdateMetaValue(const std::string& key, const std::string& value);
StorageFile getFirstFile(const std::string& query) const;
std::vector<StorageFile> getAllFiles(const std::string& query) const;
StorageSourceLocation getFirstSourceLocation(const std::string& query) const;
std::vector<StorageEdge> getAllEdges(const std::string& query) const;
std::vector<StorageNode> getAllNodes(const std::string& query) const;
StorageNode getFirstNode(const std::string& query) const;
template <typename ResultType>
std::vector<ResultType> getAll(const std::string& query) const;
template <typename ResultType>
ResultType getFirstResult(const std::string& query) const;
ResultType getFirst(const std::string& query) const
{
std::vector<ResultType> results = getAll<ResultType>(query + " LIMIT 1");
if (results.size() > 0)
{
return results[0];
}
return ResultType();
}
mutable CppSQLite3DB m_database;
FilePath m_dbFilePath;
};
template <typename ResultType>
ResultType SqliteStorage::getFirstResult(const std::string& query) const
{
CppSQLite3Query q = m_database.execQuery(query.c_str());
return q.getIntField(0, 0);
}
template <>
std::vector<StorageFile> SqliteStorage::getAll<StorageFile>(const std::string& query) const;
template <>
std::vector<StorageEdge> SqliteStorage::getAll<StorageEdge>(const std::string& query) const;
template <>
std::vector<StorageNode> SqliteStorage::getAll<StorageNode>(const std::string& query) const;
template <>
std::vector<StorageLocalSymbol> SqliteStorage::getAll<StorageLocalSymbol>(const std::string& query) const;
template <>
std::vector<StorageSourceLocation> SqliteStorage::getAll<StorageSourceLocation>(const std::string& query) const;
template <>
std::vector<StorageComponentAccess> SqliteStorage::getAll<StorageComponentAccess>(const std::string& query) const;
template <>
std::vector<StorageCommentLocation> SqliteStorage::getAll<StorageCommentLocation>(const std::string& query) const;
template <>
std::vector<StorageError> SqliteStorage::getAll<StorageError>(const std::string& query) const;
#endif // SQLITE_STORAGE_H
+148 -1110
View File
File diff suppressed because it is too large Load Diff
+26 -114
View File
@@ -1,128 +1,40 @@
#ifndef STORAGE_H
#define STORAGE_H
#include <memory>
#include <vector>
#include <functional>
#include <string>
#include "utility/file/FilePath.h"
#include "data/name/NameHierarchy.h"
#include "data/StorageTypes.h"
#include "utility/types.h"
#include "data/access/StorageAccess.h"
#include "data/graph/token_component/TokenComponentAccess.h"
#include "data/location/TokenLocationCollection.h"
#include "data/parser/ParserClient.h"
#include "data/parser/ParseLocation.h"
#include "data/search/SearchIndex.h"
#include "data/HierarchyCache.h"
#include "data/SqliteStorage.h"
#include "data/parser/ParserClientImpl.h"
class Storage: public StorageAccess
class Storage
{
public:
Storage(const FilePath& dbPath);
Storage();
virtual ~Storage();
FilePath getDbFilePath() const;
Version getVersion() const;
virtual Id addFile(const std::string& name, const std::string& filePath, const std::string& modificationTime) = 0;
virtual Id addNode(int type, const std::string& serializedName, int definitionType) = 0;
virtual Id addEdge(int type, Id sourceId, Id targetId) = 0;
virtual Id addLocalSymbol(const std::string& name) = 0;
virtual void addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type) = 0;
virtual void addComponentAccess(Id edgeId , int type) = 0;
virtual void addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol) = 0;
virtual void addError(const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol) = 0;
void init();
void clear();
void clearCaches();
virtual void forEachFile(std::function<void(const Id /*id*/, const StorageFile& /*data*/)> callback) const = 0;
virtual void forEachNode(std::function<void(const Id /*id*/, const StorageNode& /*data*/)> callback) const = 0;
virtual void forEachEdge(std::function<void(const Id /*id*/, const StorageEdge& /*data*/)> callback) const = 0;
virtual void forEachLocalSymbol(std::function<void(const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const = 0;
virtual void forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const = 0;
virtual void forEachComponentAccess(std::function<void(const StorageComponentAccess& /*data*/)> callback) const = 0;
virtual void forEachCommentLocation(std::function<void(const StorageCommentLocation& /*data*/)> callback) const = 0;
virtual void forEachError(std::function<void(const StorageError& /*data*/)> callback) const = 0;
std::set<FilePath> getDependingFilePaths(const std::set<FilePath>& filePaths);
std::set<FilePath> getDependingFilePaths(const FilePath& filePath);
void clearFileElements(const std::vector<FilePath>& filePaths);
void removeUnusedNames();
std::vector<FileInfo> getInfoOnAllFiles() const;
void logStats() const;
void startParsing();
void finishParsing();
void injectData(std::shared_ptr<IntermediateStorage> injectedStorage);
// StorageAccess implementation
virtual Id getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const;
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
virtual Id getIdForFirstNode() const;
virtual NameHierarchy getNameHierarchyForNodeWithId(Id nodeId) const;
virtual Node::NodeType getNodeTypeForNodeWithId(Id nodeId) const;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(const std::string& searchTerm) const;
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& elementIds) const;
virtual std::shared_ptr<Graph> getGraphForAll() const;
virtual std::shared_ptr<Graph> getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<Id> getActiveTokenIdsForId(Id tokenId, Id* declarationId) const;
virtual std::vector<Id> getNodeIdsForLocationIds(const std::vector<Id>& locationIds) const;
virtual std::vector<Id> getLocalSymbolIdsForLocationIds(const std::vector<Id>& locationIds) const;
virtual std::vector<Id> getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const;
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds
) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(
const std::vector<Id>& locationIds
) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const;
virtual TokenLocationCollection getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
virtual FileInfo getFileInfoForFilePath(const FilePath& filePath) const;
virtual std::vector<FileInfo> getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const;
virtual ErrorCountInfo getErrorCount() const;
virtual StorageStats getStorageStats() const;
private:
Id getFileNodeId(const FilePath& filePath) const;
FilePath getFileNodePath(Id fileId) const;
Id getLastVisibleParentNodeId(const Id nodeId) const;
std::vector<Id> getAllChildNodeIds(const Id nodeId) const;
void addNodesToGraph(const std::vector<Id>& nodeIds, Graph* graph) const;
void addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) const;
void addNodesWithChildrenAndEdgesToGraph(
const std::vector<Id>& nodeIds,
const std::vector<Id>& edgeIds, Graph* graph
) const;
void addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const;
void addComponentAccessToGraph(Graph* graph) const;
void buildSearchIndex();
void buildHierarchyCache();
void optimizeFTSTable();
void log(std::string type, std::string str, const ParseLocation& location) const;
SearchIndex m_commandIndex;
SearchIndex m_elementIndex;
SqliteStorage m_sqliteStorage;
mutable std::map <FilePath, Id> m_fileNodeIds;
HierarchyCache m_hierarchyCache;
virtual void startInjection();
virtual void finishInjection();
void inject(Storage* injected);
};
#endif // STORAGE_H
+52
View File
@@ -9,6 +9,13 @@
struct StorageEdge
{
StorageEdge()
: id(0)
, type(0)
, sourceNodeId(0)
, targetNodeId(0)
{}
StorageEdge(Id id, int type, Id sourceNodeId, Id targetNodeId)
: id(id)
, type(type)
@@ -45,6 +52,13 @@ struct StorageNode
struct StorageFile
{
StorageFile()
: id(0)
, name("")
, filePath("")
, modificationTime("")
{}
StorageFile(Id id, const std::string& name, const std::string& filePath, const std::string& modificationTime)
: id(id)
, name(name)
@@ -60,6 +74,11 @@ struct StorageFile
struct StorageLocalSymbol
{
StorageLocalSymbol()
: id(0)
, name("")
{}
StorageLocalSymbol(Id id, const std::string& name)
: id(id)
, name(name)
@@ -71,6 +90,17 @@ struct StorageLocalSymbol
struct StorageSourceLocation
{
StorageSourceLocation()
: id(0)
, elementId(0)
, fileNodeId(0)
, startLine(-1)
, startCol(-1)
, endLine(-1)
, endCol(-1)
, type(0)
{}
StorageSourceLocation(Id id, Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type)
: id(id)
, elementId(elementId)
@@ -94,6 +124,11 @@ struct StorageSourceLocation
struct StorageComponentAccess
{
StorageComponentAccess()
: memberEdgeId(0)
, type(0)
{}
StorageComponentAccess(Id memberEdgeId, int type)
: memberEdgeId(memberEdgeId)
, type(type)
@@ -105,6 +140,15 @@ struct StorageComponentAccess
struct StorageCommentLocation
{
StorageCommentLocation()
: id(0)
, fileNodeId(0)
, startLine(-1)
, startCol(-1)
, endLine(-1)
, endCol(-1)
{}
StorageCommentLocation(Id id, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol)
: id(id)
, fileNodeId(fileNodeId)
@@ -124,6 +168,14 @@ struct StorageCommentLocation
struct StorageError
{
StorageError()
: message("")
, fatal(0)
, filePath("")
, lineNumber(-1)
, columnNumber(-1)
{}
StorageError(const std::string& message, bool fatal, const std::string& filePath, uint lineNumber, uint columnNumber)
: message(message)
, fatal(fatal)
+4 -4
View File
@@ -1,10 +1,10 @@
#include "data/TaskCleanStorage.h"
#include "data/Storage.h"
#include "data/PersistentStorage.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/utility.h"
TaskCleanStorage::TaskCleanStorage(Storage* storage, const std::vector<FilePath>& filePaths)
TaskCleanStorage::TaskCleanStorage(PersistentStorage* storage, const std::vector<FilePath>& filePaths)
: m_storage(storage)
, m_filePaths(filePaths)
, m_fileCount(filePaths.size())
@@ -33,8 +33,8 @@ Task::TaskState TaskCleanStorage::update()
if (m_fileCount)
{
MessageStatus("Cleaning up names (ESC to quit)", false, true).dispatch();
m_storage->removeUnusedNames();
MessageStatus("Clearing caches (ESC to quit)", false, true).dispatch();
m_storage->clearCaches();
}
return Task::STATE_FINISHED;
+3 -3
View File
@@ -7,14 +7,14 @@
#include "utility/scheduling/Task.h"
#include "utility/TimePoint.h"
class Storage;
class PersistentStorage;
class TaskCleanStorage
: public Task
{
public:
TaskCleanStorage(
Storage* storage,
PersistentStorage* storage,
const std::vector<FilePath>& filePaths
);
@@ -26,7 +26,7 @@ public:
virtual void revert();
private:
Storage* m_storage;
PersistentStorage* m_storage;
std::vector<FilePath> m_filePaths;
const size_t m_fileCount;
+2 -5
View File
@@ -32,13 +32,11 @@ public:
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const = 0;
virtual Id getIdForFirstNode() const = 0;
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const = 0;
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const = 0;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm) const = 0;
const std::string& searchTerm, bool caseSensitive) const = 0;
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const = 0;
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const = 0;
@@ -52,7 +50,6 @@ public:
virtual std::vector<Id> getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const = 0;
virtual Id getTokenIdForFileNode(const FilePath& filePath) const = 0;
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const = 0;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds) const = 0;
@@ -62,7 +59,7 @@ public:
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber) const = 0;
virtual TokenLocationCollection getErrorTokenLocations(std::vector<ErrorInfo>* errors) const = 0;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const = 0;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const = 0;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const = 0;
+4 -24
View File
@@ -54,16 +54,6 @@ Id StorageAccessProxy::getIdForEdge(
return 0;
}
Id StorageAccessProxy::getIdForFirstNode() const
{
if (hasSubject())
{
return m_subject->getIdForFirstNode();
}
return 0;
}
Node::NodeType StorageAccessProxy::getNodeTypeForNodeWithId(Id id) const
{
if (hasSubject())
@@ -94,11 +84,11 @@ std::vector<SearchMatch> StorageAccessProxy::getAutocompletionMatches(const std:
}
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getFullTextSearchLocations(
const std::string &searchTerm) const
const std::string &searchTerm, bool caseSensitive) const
{
if (hasSubject())
{
return m_subject->getFullTextSearchLocations(searchTerm);
return m_subject->getFullTextSearchLocations(searchTerm, caseSensitive);
}
return std::make_shared<TokenLocationCollection>();
@@ -184,16 +174,6 @@ Id StorageAccessProxy::getTokenIdForFileNode(const FilePath& filePath) const
return 0;
}
std::vector<Id> StorageAccessProxy::getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const
{
if (hasSubject())
{
return m_subject->getTokenIdsForAggregationEdge(sourceId, targetId);
}
return std::vector<Id>();
}
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds) const
{
@@ -238,14 +218,14 @@ std::shared_ptr<TokenLocationFile> StorageAccessProxy::getTokenLocationsForLines
return std::make_shared<TokenLocationFile>("");
}
TokenLocationCollection StorageAccessProxy::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
{
if (hasSubject())
{
return m_subject->getErrorTokenLocations(errors);
}
return TokenLocationCollection();
return std::make_shared<TokenLocationCollection>();
}
std::shared_ptr<TokenLocationFile> StorageAccessProxy::getCommentLocationsInFile(const FilePath& filePath) const
+3 -5
View File
@@ -17,12 +17,11 @@ public:
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
virtual Id getIdForFirstNode() const;
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const;
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(const std::string& searchTerm) const;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm, bool caseSensitive) const;
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const;
@@ -36,7 +35,6 @@ public:
virtual std::vector<Id> getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const;
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const;
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds
@@ -49,7 +47,7 @@ public:
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const;
virtual TokenLocationCollection getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual std::shared_ptr<TokenLocationFile> getCommentLocationsInFile(const FilePath& filePath) const;
virtual std::shared_ptr<TextAccess> getFileContent(const FilePath& filePath) const;
@@ -0,0 +1,48 @@
#include "data/fulltextsearch/FullTextSearchIndex.h"
#include <limits>
#include "utility/logging/logging.h"
#include "utility/tracing.h"
#include "utility/utility.h"
void FullTextSearchIndex::addFile(Id fileId, const std::string& file)
{
if( file.empty() )
{
LOG_ERROR("empty file not added to fulltextsearch index");
}
if ( file.size() >= std::numeric_limits<int>::max() )
{
LOG_ERROR("file too big not added to fulltextsearch index");
}
FullTextSearchFile fts_file(fileId, SuffixArray(file));
m_files.push_back(fts_file);
}
std::vector<FullTextSearchResult> FullTextSearchIndex::searchForTerm(const std::string& term) const
{
TRACE();
std::vector<FullTextSearchResult> ret;
FullTextSearchResult hit;
for (auto f : m_files)
{
hit.fileId = f.fileId;
hit.positions = f.array.searchForTerm(term);
ret.push_back(hit);
}
return ret;
}
size_t FullTextSearchIndex::fileCount() const
{
return m_files.size();
}
void FullTextSearchIndex::clear()
{
m_files.clear();
}
@@ -0,0 +1,44 @@
#ifndef FULLTEXTSEARCH_INDEX_H
#define FULLTEXTSEARCH_INDEX_H
#include <vector>
#include <unordered_map>
#include "data/fulltextsearch/SuffixArray.h"
#include "utility/types.h"
class StorageAccess;
// contains all fulltextsearch results of one file
struct FullTextSearchResult
{
Id fileId;
std::vector<int> positions;
};
struct FullTextSearchFile
{
FullTextSearchFile(Id fileId, SuffixArray array)
: fileId(fileId)
, array(array)
{
};
Id fileId;
SuffixArray array;
};
class FullTextSearchIndex
{
public:
void addFile(Id fileId, const std::string& file);
std::vector<FullTextSearchResult> searchForTerm(const std::string& term) const;
size_t fileCount() const;
void clear();
private:
std::vector<FullTextSearchFile> m_files;
};
#endif // FULLTEXTSEARCH_INDEX_H
+182
View File
@@ -0,0 +1,182 @@
#include "SuffixArray.h"
#include <iostream>
#include <algorithm>
struct suffix
{
int index;
int rank[2];
};
int SuffixArray::cmp(struct suffix a, struct suffix b)
{
return (a.rank[0] == b.rank[0])? (a.rank[1] < b.rank[1] ?1: 0):
(a.rank[0] < b.rank[0] ?1: 0);
}
SuffixArray::SuffixArray(const std::string& text)
: m_text(text)
{
std::transform(m_text.begin(), m_text.end(), m_text.begin(), ::tolower);
m_array = buildSuffixArray();
m_lcp = buildLCP();
}
void SuffixArray::printArray() const
{
std::cout << "Suffix Array : \n";
printArr(m_array);
}
void SuffixArray::printLCP() const
{
std::cout << "\nLCP Array : \n";
printArr(m_lcp);
}
std::vector<int> SuffixArray::buildLCP()
{
int n = m_array.size();
std::vector<int> lcp(n, 0);
std::vector<int> invSuff(n, 0);
for (int i=0; i < n; i++)
{
invSuff[m_array[i]] = i;
}
int k = 0;
for (int i=0; i<n; i++)
{
if (invSuff[i] == n-1)
{
k = 0;
continue;
}
int j = m_array[invSuff[i]+1];
while (i+k<n && j+k<n && m_text[i+k]==m_text[j+k])
{
k++;
}
lcp[invSuff[i]] = k;
if (k>0)
{
k--;
}
}
return lcp;
}
std::vector<int> SuffixArray::searchForTerm(const std::string& searchTerm) const
{
std::string term = searchTerm;
std::transform(term.begin(), term.end(), term.begin(), ::tolower);
int termLength = term.length();
int l = 0;
int r = m_text.length()-1;
int m;
std::vector<int> matches;
int compareResult;
while (l+1 < r)
{
m = (l+r+1)/2;
compareResult = term.compare(m_text.substr(m_array[m], termLength));
if( compareResult < 0)
{
r = m;
}
else if (compareResult > 0)
{
l = m;
}
else
{
matches.push_back(m_array[m]);
for (int lower = m-1; m_lcp[lower] >= termLength; lower--)
{
matches.push_back(m_array[lower]);
}
for (int higher = m+1; m_lcp[higher-1] >= termLength; higher++)
{
matches.push_back(m_array[higher]);
}
break;
}
}
std::sort(matches.begin(), matches.end());
return matches;
}
std::vector<int> SuffixArray::buildSuffixArray()
{
int n = m_text.length();
std::vector<suffix> suffixes;
suffixes.reserve(n);
suffix s;
for (int i = 0; i < n; i++)
{
s.index = i;
s.rank[0] = m_text[i] - 'a';
s.rank[1] = ((i+1) < n)? (m_text[i + 1] - 'a'): -1;
suffixes.push_back(s);
}
std::sort(suffixes.begin(), suffixes.end(), SuffixArray::cmp);
std::vector<int> ind (n,0);
for (int k = 4; k < 2*n; k = k*2)
{
int rank = 0;
int prev_rank = suffixes[0].rank[0];
suffixes[0].rank[0] = rank;
ind[suffixes[0].index] = 0;
for (int i = 1; i < n; i++)
{
if (suffixes[i].rank[0] == prev_rank &&
suffixes[i].rank[1] == suffixes[i-1].rank[1])
{
prev_rank = suffixes[i].rank[0];
suffixes[i].rank[0] = rank;
}
else
{
prev_rank = suffixes[i].rank[0];
suffixes[i].rank[0] = ++rank;
}
ind[suffixes[i].index] = i;
}
for (int i = 0; i < n; i++)
{
int nextindex = suffixes[i].index + k/2;
suffixes[i].rank[1] = (nextindex < n)?
suffixes[ind[nextindex]].rank[0]: -1;
}
std::sort(suffixes.begin(), suffixes.end(), cmp);
}
std::vector<int>suffixArr;
for (int i = 0; i < n; i++)
{
suffixArr.push_back(suffixes[i].index);
}
return suffixArr;
}
+36
View File
@@ -0,0 +1,36 @@
#ifndef SUFFIX_ARRAY_H
#define SUFFIX_ARRAY_H
#include <vector>
#include <string>
#include <iostream>
class SuffixArray
{
public:
SuffixArray(const std::string& text);
std::vector<int> searchForTerm(const std::string& searchTerm) const;
static int cmp(struct suffix a, struct suffix b);
void printArray() const;
void printLCP() const;
private:
template <typename T>
void printArr(std::vector<T>arr) const
{
for (size_t i = 0; i < arr.size(); i++)
{
std::cout << arr[i] << " ";
}
std::cout << std::endl;
}
std::vector<int> buildLCP();
std::vector<int> buildSuffixArray();
std::vector<int> m_array;
std::vector<int> m_lcp;
std::string m_text;
};
#endif // SUFFIX_ARRAY_H
+4 -3
View File
@@ -309,15 +309,16 @@ void Node::forEachChildNode(std::function<void(Node*)> func) const
);
}
void Node::forEachChildNodeRecursive(std::function<void(Node*)> func) const
void Node::forEachNodeRecursive(std::function<void(const Node*)> func) const
{
func(this);
forEachEdgeOfType(Edge::EDGE_MEMBER,
[func, this](Edge* e)
{
if (this != e->getTo())
{
func(e->getTo());
e->getTo()->forEachChildNode(func);
e->getTo()->forEachNodeRecursive(func);
}
}
);
+1 -1
View File
@@ -86,7 +86,7 @@ public:
void forEachEdge(std::function<void(Edge*)> func) const;
void forEachEdgeOfType(Edge::EdgeTypeMask mask, std::function<void(Edge*)> func) const;
void forEachChildNode(std::function<void(Node*)> func) const;
void forEachChildNodeRecursive(std::function<void(Node*)> func) const;
void forEachNodeRecursive(std::function<void(const Node*)> func) const;
bool hasReferences() const;
@@ -9,7 +9,7 @@ class TokenComponentAccess
: public TokenComponent
{
public:
enum AccessType : int
enum AccessType : int // todo: use normal numbers here. not 2^x
{
ACCESS_PUBLIC = 0x1,
ACCESS_PROTECTED = 0x2,
+6 -2
View File
@@ -10,8 +10,10 @@ int locationTypeToInt(LocationType type)
return 1;
case LOCATION_LOCAL_SYMBOL:
return 2;
case LOCATION_FULLTEXTSEARCH_MATCH:
case LOCATION_FULLTEXT:
return 3;
case LOCATION_ERROR:
return 4;
}
}
@@ -26,7 +28,9 @@ LocationType intToLocationType(int value)
case 2:
return LOCATION_LOCAL_SYMBOL;
case 3:
return LOCATION_FULLTEXTSEARCH_MATCH;
return LOCATION_FULLTEXT;
case 4:
return LOCATION_ERROR;
}
return LOCATION_TOKEN;
}
+2 -1
View File
@@ -6,7 +6,8 @@ enum LocationType
LOCATION_TOKEN,
LOCATION_SCOPE,
LOCATION_LOCAL_SYMBOL,
LOCATION_FULLTEXTSEARCH_MATCH
LOCATION_FULLTEXT,
LOCATION_ERROR
};
int locationTypeToInt(LocationType type);
+1 -1
View File
@@ -184,7 +184,7 @@ bool TokenLocation::isScopeTokenLocation() const
bool TokenLocation::isFullTextSearchMatch() const
{
return m_type == LOCATION_FULLTEXTSEARCH_MATCH;
return m_type == LOCATION_FULLTEXT;
}
std::ostream& operator<<(std::ostream& ostream, const TokenLocation& location)

Some files were not shown because too many files have changed in this diff Show More