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
205 changed files with 4136 additions and 1525 deletions
+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
@@ -40,6 +40,10 @@
<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>
+46 -35
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,46 +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>
<fulltextmatch>
<fulltext>
<normal>
<border>transparent</border>
<fill>#80FFFF00</fill>
<text>#000000</text>
<fill>#C2AFEF</fill>
<text>#3D3D3D</text>
</normal>
<focus>
<border>transparent</border>
<fill>#FFFFFF00</fill>
<text>#000000</text>
</focus>
<active>
<border>transparent</border>
<fill>#FFFFFF00</fill>
<text>#000000</text>
</active>
</fulltextmatch>
</fulltext>
</selection>
</snippet>
</code>
@@ -277,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>
+37 -35
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,33 +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>
<fulltextmatch>
<fulltext>
<normal>
<border>transparent</border>
<fill>#80FFFF00</fill>
<fill>#C7C7E2</fill>
<text>#000000</text>
</normal>
<focus>
<border>transparent</border>
<fill>#FFFFFF00</fill>
<text>#000000</text>
</focus>
<active>
<border>transparent</border>
<fill>#FFFFFF00</fill>
<text>#000000</text>
</active>
</fulltextmatch>
</fulltext>
</selection>
</snippet>
</code>
+58 -34
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,46 +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>
<fulltextmatch>
<fulltext>
<normal>
<border>transparent</border>
<fill>#80FFFF00</fill>
<text>#000000</text>
<fill>#207EA8</fill>
<text>#F7F7F7</text>
</normal>
<focus>
<border>transparent</border>
<fill>#FFFFFF00</fill>
<text>#000000</text>
</focus>
<active>
<border>transparent</border>
<fill>#FFFFFF00</fill>
<text>#000000</text>
</active>
</fulltextmatch>
</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

+4
View File
@@ -25,6 +25,10 @@
margin-left: 20px;
}
#description {
font-size: 12pt;
}
#label {
font-size: 12pt;
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"
//------------------------------------------------------------------------------
@@ -2,6 +2,8 @@
<config>
<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>
@@ -30,6 +30,8 @@
<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>
+2 -4
View File
@@ -53,7 +53,5 @@ 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: Can't create TokenLocation with wrong boundaries.
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
SolutionParserVisualStudio.cpp INFO: Found 24 additional include paths
SolutionParserVisualStudio.cpp INFO: Found 450 code files
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
+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"
+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!"
+1 -1
View File
@@ -73,7 +73,7 @@ Task::TaskState TaskParseCxx::update()
}
std::stringstream ss;
ss << "analyzing files (ESC to quit): [";
ss << "indexing files (ESC to quit): [";
ss << fileRegister->getParsedSourceFilesCount() << "/";
ss << fileRegister->getSourceFilesCount() << "] ";
ss << sourcePath.str();
+1 -1
View File
@@ -51,7 +51,7 @@ void TaskParseWrapper::exit()
void TaskParseWrapper::interrupt()
{
MessageStatus("analyzing files interrupted", false, true).dispatch();
MessageStatus("indexing files interrupted", false, true).dispatch();
m_child->interrupt();
}
@@ -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();
+3 -1
View File
@@ -234,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
@@ -254,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
@@ -316,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
+26 -47
View File
@@ -91,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)
@@ -142,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();
@@ -152,19 +120,28 @@ void Project::parseCode()
utility::append(updatedFilePaths, m_storage->getDependingFilePaths(updatedFilePaths));
utility::append(updatedFilePaths, m_storage->getDependingFilePaths(removedFilePaths));
std::shared_ptr<TaskGroupSequential> taskSequential = std::make_shared<TaskGroupSequential>();
std::vector<FilePath> filesToClean;
filesToClean.insert(filesToClean.end(), removedFilePaths.begin(), removedFilePaths.end());
filesToClean.insert(filesToClean.end(), updatedFilePaths.begin(), updatedFilePaths.end());
taskSequential->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());
std::shared_ptr<FileRegister> fileRegister = std::make_shared<FileRegister>(&m_fileManager);
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>();
@@ -177,7 +154,7 @@ void Project::parseCode()
std::shared_ptr<std::mutex> storageMutex = std::make_shared<std::mutex>();
for (int i = 0; i < ApplicationSettings::getInstance()->getIndexerThreadCount(); i++)
for (int i = 0; i < indexerThreadCount; i++)
{
taskParallel->addTask(std::make_shared<TaskParseCxx>(
m_storage.get(),
@@ -188,8 +165,6 @@ void Project::parseCode()
}
Task::dispatch(taskSequential);
m_state = PROJECT_LOADED;
}
void Project::logStats() const
@@ -249,14 +224,20 @@ void Project::updateFileManager()
std::vector<FilePath> sourcePaths = projSettings->getAbsoluteSourcePaths();
std::vector<FilePath> headerPaths = sourcePaths;
std::vector<std::string> sourceExtensions;
if (projSettings->getCompilationDatabasePath().exists())
{
sourcePaths = TaskParseCxx::getSourceFilesFromCDB(projSettings->getCompilationDatabasePath());
}
else
{
sourceExtensions = projSettings->getSourceExtensions();
}
std::vector<std::string> sourceExtensions = projSettings->getSourceExtensions();
std::vector<FilePath> excludePaths = projSettings->getAbsoluteExcludePaths();
m_fileManager.setPaths(sourcePaths, headerPaths, sourceExtensions);
m_fileManager.setPaths(sourcePaths, headerPaths, excludePaths, sourceExtensions);
}
Parser::Arguments Project::getParserArguments() const
@@ -280,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
View File
@@ -31,8 +31,6 @@ public:
ProjectState load(const FilePath& projectSettingsFile);
ProjectState reload();
bool save(const FilePath& projectSettingsFile);
void clearStorage();
void logStats() const;
+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:
+149 -146
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,17 +266,22 @@ void CodeController::handleMessage(MessageShowErrors* message)
void CodeController::handleMessage(MessageSearchFullText* message)
{
CodeView* view = getView();
view->setErrorInfos(std::vector<ErrorInfo>());
TRACE("code fulltext");
std::vector<CodeSnippetParams> snippets = getSnippetsForFullTextSearch(message->searchTerm, message->caseSensitive);
view->showCodeSnippets(snippets, std::vector<Id>());
CodeView* view = getView();
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));
@@ -261,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");
@@ -270,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);
}
);
}
}
@@ -292,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())
@@ -303,6 +348,8 @@ 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;
@@ -331,7 +378,7 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocation
(isDefinitionFile && definitionFileCount < 3) ||
(!isDefinitionFile && isDeclarationFile && declarationFileCount < 3))
{
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForActiveTokenLocationsInFile(file);
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(file, true);
for (CodeSnippetParams& snippet : fileSnippets)
{
@@ -369,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
{
@@ -461,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;
@@ -525,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;
}
@@ -605,79 +679,6 @@ std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope
return file;
}
std::vector<CodeSnippetParams> CodeController::getSnippetsForFullTextSearch(
const std::string& searchTerm, bool caseSensitive) const
{
std::shared_ptr<TokenLocationCollection> collection =
m_storageAccess->getFullTextSearchLocations(searchTerm, caseSensitive);
std::vector<CodeSnippetParams> snippets;
snippets.reserve(collection->getTokenLocationFileCount());
collection->forEachTokenLocationFile(
[&](std::shared_ptr<TokenLocationFile> file) -> void
{
//CodeSnippetParams params;
//params.locationFile = file;
//params.startLineNumber = 1;
//std::shared_ptr<TextAccess> textAccess = m_storageAccess->getFileContent(file->getFilePath());
//params.code = textAccess->getText();
//snippets.push_back(params);
//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();
@@ -736,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, bool caseSensitive) 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
@@ -6,6 +6,7 @@
#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"
@@ -19,6 +20,10 @@ FeatureController::~FeatureController()
{
}
void FeatureController::clear()
{
}
void FeatureController::handleMessage(MessageActivateEdge* message)
{
if (message->isAggregation())
@@ -61,9 +66,15 @@ void FeatureController::handleMessage(MessageActivateFile* message)
}
else
{
MessageActivateTokens m(message, std::vector<Id>());
m.unknownNames.push_back(message->filePath.fileName());
m.dispatchImmediately();
MessageChangeFileView msg(
message->filePath,
MessageChangeFileView::FILE_MAXIMIZED,
true,
true
);
msg.setIsReplayed(message->isReplayed());
msg.setKeepContent(message->keepContent());
msg.dispatchImmediately();
}
}
@@ -104,21 +115,34 @@ void FeatureController::handleMessage(MessageSearch* message)
for (const SearchMatch& match : matches)
{
if (match.searchType == SearchMatch::SEARCH_COMMAND &&
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ALL))
if (match.searchType == SearchMatch::SEARCH_COMMAND)
{
MessageActivateAll msg;
msg.setIsReplayed(message->isReplayed());
msg.dispatchImmediately();
return;
}
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;
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;
}
}
}
}
@@ -34,6 +34,8 @@ public:
FeatureController(StorageAccess* storageAccess);
~FeatureController();
virtual void clear();
private:
virtual void handleMessage(MessageActivateEdge* message);
virtual void handleMessage(MessageActivateFile* message);
+330 -10
View File
@@ -3,6 +3,7 @@
#include <set>
#include "utility/logging/logging.h"
#include "utility/tracing.h"
#include "utility/utility.h"
#include "utility/utilityString.h"
@@ -23,10 +24,14 @@ GraphController::~GraphController()
void GraphController::handleMessage(MessageActivateAll* message)
{
TRACE("graph all");
getView()->showOverlay();
m_activeNodeIds.clear();
m_activeEdgeIds.clear();
createDummyGraphForTokenIds(std::vector<Id>(), m_storageAccess->getGraphForAll());
createDummyGraphForTokenIdsAndSetActiveAndVisibility(std::vector<Id>(), m_storageAccess->getGraphForAll());
bundleNodesByType();
@@ -38,6 +43,10 @@ void GraphController::handleMessage(MessageActivateAll* message)
void GraphController::handleMessage(MessageActivateTokens* message)
{
TRACE("graph activate");
getView()->showOverlay();
if (message->isEdge || message->keepContent())
{
m_activeEdgeIds = message->tokenIds;
@@ -66,7 +75,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
std::shared_ptr<Graph> graph = m_storageAccess->getGraphForActiveTokenIds(tokenIds);
createDummyGraphForTokenIds(tokenIds, graph);
createDummyGraphForTokenIdsAndSetActiveAndVisibility(tokenIds, graph);
if (m_activeNodeIds.size() == 1)
{
@@ -186,11 +195,14 @@ void GraphController::clear()
m_activeEdgeIds.clear();
m_graph.reset();
getView()->clear();
}
void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph)
{
TRACE();
GraphView* view = getView();
if (!view)
{
@@ -198,8 +210,6 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
return;
}
std::vector<Id> expandedNodeIds = getExpandedNodeIds();
m_dummyEdges.clear();
m_dummyGraphNodes.clear();
@@ -241,14 +251,22 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
m_dummyNodes = dummyNodes;
m_graph = graph;
}
void GraphController::createDummyGraphForTokenIdsAndSetActiveAndVisibility(
const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph
){
std::vector<Id> expandedNodeIds = getExpandedNodeIds();
createDummyGraphForTokenIds(tokenIds, graph);
bool noActive = setActive(tokenIds);
autoExpandActiveNode(tokenIds);
setExpandedNodeIds(expandedNodeIds);
setVisibility(noActive);
m_graph = graph;
}
std::shared_ptr<DummyNode> GraphController::createDummyNodeTopDown(Node* node, Id parentId)
@@ -360,6 +378,8 @@ void GraphController::autoExpandActiveNode(const std::vector<Id>& activeTokenIds
bool GraphController::setActive(const std::vector<Id>& activeTokenIds)
{
TRACE();
bool noActive = activeTokenIds.size() == 0;
if (activeTokenIds.size() > 0)
{
@@ -400,6 +420,8 @@ bool GraphController::setActive(const std::vector<Id>& activeTokenIds)
void GraphController::setVisibility(bool noActive)
{
TRACE();
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
{
removeImplicitChildrenRecursive(node.get());
@@ -410,6 +432,8 @@ void GraphController::setVisibility(bool noActive)
void GraphController::setActiveAndVisibility(const std::vector<Id>& activeTokenIds)
{
TRACE();
setVisibility(setActive(activeTokenIds));
}
@@ -518,6 +542,8 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa
void GraphController::bundleNodes()
{
TRACE();
// evaluate top level nodes
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
{
@@ -713,7 +739,9 @@ void GraphController::bundleNodesAndEdgesMatching(
}
DummyNode* firstNode = bundleNode->bundledNodes[0].get();
bundleNode->tokenId = firstNode->data->getId();
// Use token Id of first node and make first bit 1
bundleNode->tokenId = ~(~size_t(0) >> 1) + firstNode->data->getId();
bundleNode->bundleInfo.layoutVertical = firstNode->bundleInfo.layoutVertical;
bundleNode->bundleInfo.isReferenced = firstNode->bundleInfo.isReferenced;
bundleNode->bundleInfo.isReferencing = firstNode->bundleInfo.isReferencing;
@@ -800,7 +828,8 @@ void GraphController::bundleNodesMatching(
nodes.erase(matchedNodes[i]);
}
bundleNode->tokenId = bundleNode->bundledNodes[0]->data->getId();
// Use token Id of first node and make first bit 1
bundleNode->tokenId = ~(~size_t(0) >> 1) + bundleNode->bundledNodes[0]->data->getId();
m_dummyNodes.push_back(bundleNode);
}
@@ -816,6 +845,8 @@ void GraphController::bundleNodesMatching(
void GraphController::bundleNodesByType()
{
TRACE();
std::vector<std::shared_ptr<DummyNode>> oldNodes = m_dummyNodes;
m_dummyNodes.clear();
@@ -863,6 +894,8 @@ void GraphController::bundleNodesByType()
void GraphController::layoutNesting()
{
TRACE();
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
{
layoutNestingRecursive(node.get());
@@ -1095,6 +1128,8 @@ void GraphController::layoutToGrid(DummyNode* node) const
void GraphController::layoutGraph(bool sort)
{
TRACE();
BucketGrid grid(getView()->getViewSize());
grid.createBuckets(m_dummyNodes, m_dummyEdges);
@@ -1117,10 +1152,295 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const
return nullptr;
}
void GraphController::buildGraph(MessageBase* message)
void GraphController::buildGraph(MessageBase* message, bool animated)
{
if (!message->isReplayed())
{
getView()->rebuildGraph(m_graph, m_dummyNodes, m_dummyEdges);
getView()->rebuildGraph(m_graph, m_dummyNodes, m_dummyEdges, animated);
}
}
void GraphController::forEachDummyNodeRecursive(std::function<void(DummyNode*)> func)
{
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
{
node->forEachDummyNodeRecursive(func);
}
}
void GraphController::forEachDummyEdge(std::function<void(DummyEdge*)> func)
{
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
{
func(edge.get());
}
}
void GraphController::handleMessage(MessageColorSchemeTest* message)
{
clear();
std::shared_ptr<Graph> graph = std::make_shared<Graph>();
std::function<void(Id, Node::NodeType)> createNodes(
[&](Id id, Node::NodeType type)
{
std::string name = Node::getTypeString(type);
graph->createNode(id + 1, type, NameHierarchy(name), true);
graph->createNode(id + 2, type, NameHierarchy("focused " + name), true);
graph->createNode(id + 3, type, NameHierarchy("active " + name), true);
graph->createNode(id + 4, type, NameHierarchy("undefined " + name), true);
graph->createNode(id + 5, type, NameHierarchy("undefined focused " + name), true);
graph->createNode(id + 6, type, NameHierarchy("undefined active " + name), true);
}
);
createNodes( 0, Node::NODE_FUNCTION);
createNodes(10, Node::NODE_GLOBAL_VARIABLE);
createNodes(20, Node::NODE_UNDEFINED);
createNodes(30, Node::NODE_TYPE);
createNodes(40, Node::NODE_TYPEDEF);
createNodes(50, Node::NODE_NAMESPACE);
createNodes(60, Node::NODE_FILE);
createNodes(70, Node::NODE_MACRO);
std::function<Node*(Node*, Id, Node::NodeType, std::string, TokenComponentAccess::AccessType)> createChild(
[&](Node* parent, Id id, Node::NodeType type, std::string name, TokenComponentAccess::AccessType access)
{
Node* node = graph->createNode(id + 1000, type, NameHierarchy(name), true);
Edge* edge = graph->createEdge(id + 10000, Edge::EDGE_MEMBER, parent, node);
if (access != TokenComponentAccess::ACCESS_NONE)
{
edge->addComponentAccess(std::make_shared<TokenComponentAccess>(access));
}
return node;
}
);
std::function<void(Id, std::string)> createEnum(
[&](Id id, std::string name)
{
Node* enumNode = graph->createNode(id, Node::NODE_ENUM,
NameHierarchy(name + Node::getTypeString(Node::NODE_ENUM)), true);
createChild(enumNode, id + 10, Node::NODE_ENUM_CONSTANT, name + Node::getTypeString(Node::NODE_ENUM_CONSTANT),
TokenComponentAccess::ACCESS_NONE);
}
);
createEnum(101, "");
createEnum(102, "focused ");
createEnum(103, "active ");
createEnum(104, "undefined ");
createEnum(105, "undefined focused ");
createEnum(106, "undefined active ");
std::function<void(Id, Node::NodeType, std::string)> createClass(
[&](Id id, Node::NodeType type, std::string name)
{
Node* classNode = graph->createNode(id, type, NameHierarchy(name + Node::getTypeString(type)), true);
if (type == Node::NODE_CLASS)
{
createChild(classNode, id, Node::NODE_TEMPLATE_PARAMETER_TYPE, name + "temp_param",
TokenComponentAccess::ACCESS_TEMPLATE);
}
createChild(classNode, id + 10, Node::NODE_METHOD, name + "method", TokenComponentAccess::ACCESS_PUBLIC);
if (type == Node::NODE_CLASS)
{
createChild(classNode, id + 30, Node::NODE_METHOD, name + "method",
TokenComponentAccess::ACCESS_PROTECTED);
}
createChild(classNode, id + 60, Node::NODE_FIELD, name + "field", TokenComponentAccess::ACCESS_PRIVATE);
}
);
std::function<void(Id, Node::NodeType)> createClasses(
[&](Id id, Node::NodeType type)
{
createClass(id + 1, type, "");
createClass(id + 2, type, "focused ");
createClass(id + 3, type, "active ");
createClass(id + 4, type, "undefined ");
createClass(id + 5, type, "undefined focused ");
createClass(id + 6, type, "undefined active ");
}
);
createClasses(200, Node::NODE_STRUCT);
createClasses(300, Node::NODE_CLASS);
std::function<void(Id, Edge::EdgeType, Node::NodeType, Node::NodeType, std::string)> createEdge(
[&](Id id, Edge::EdgeType type, Node::NodeType origin, Node::NodeType target, std::string name)
{
Node* originNode;
if (origin == Node::NODE_METHOD)
{
Node* classNode = graph->createNode(id + 101, Node::NODE_CLASS,
NameHierarchy(name + Node::getTypeString(Node::NODE_CLASS)), true);
originNode = createChild(classNode, id + 111, Node::NODE_METHOD, name + Edge::getTypeString(type),
TokenComponentAccess::ACCESS_PUBLIC);
}
else
{
originNode = graph->createNode(id + 1, origin, NameHierarchy(name + Edge::getTypeString(type)), true);
}
Node* targetNode;
if (target == Node::NODE_METHOD)
{
Node* classNode = graph->createNode(id + 201, Node::NODE_CLASS,
NameHierarchy(name + Node::getTypeString(Node::NODE_CLASS)), true);
targetNode = createChild(classNode, id + 211, Node::NODE_METHOD, name + Edge::getTypeString(type),
TokenComponentAccess::ACCESS_PUBLIC);
}
else
{
targetNode = graph->createNode(id + 11, target, NameHierarchy(name + Edge::getTypeString(type)), true);
}
Edge* edge = graph->createEdge(id, type, originNode, targetNode);
if (type == Edge::EDGE_AGGREGATION)
{
std::shared_ptr<TokenComponentAggregation> agg = std::make_shared<TokenComponentAggregation>();
for (Id i = 1; i < 11; i++)
{
agg->addAggregationId(i, true);
}
edge->addComponentAggregation(agg);
}
}
);
std::function<void(Id, Edge::EdgeType, Node::NodeType, Node::NodeType)> createEdges(
[&](Id id, Edge::EdgeType type, Node::NodeType origin, Node::NodeType target)
{
createEdge(id, type, origin, target, "");
createEdge(id + 1000, type, origin, target, "focused ");
createEdge(id + 2000, type, origin, target, "active ");
}
);
createEdges( 100000, Edge::EDGE_CALL, Node::NODE_FUNCTION, Node::NODE_FUNCTION);
createEdges( 200000, Edge::EDGE_USAGE, Node::NODE_GLOBAL_VARIABLE, Node::NODE_GLOBAL_VARIABLE);
createEdges( 300000, Edge::EDGE_TYPE_USAGE, Node::NODE_FUNCTION, Node::NODE_TYPE);
createEdges( 400000, Edge::EDGE_TYPE_OF, Node::NODE_GLOBAL_VARIABLE, Node::NODE_TYPE);
createEdges( 500000, Edge::EDGE_TYPEDEF_OF, Node::NODE_TYPEDEF, Node::NODE_TYPE);
createEdges( 600000, Edge::EDGE_AGGREGATION, Node::NODE_TYPE, Node::NODE_TYPE);
createEdges( 700000, Edge::EDGE_INCLUDE, Node::NODE_FILE, Node::NODE_FILE);
createEdges( 800000, Edge::EDGE_MACRO_USAGE, Node::NODE_MACRO, Node::NODE_MACRO);
createEdges( 900000, Edge::EDGE_INHERITANCE, Node::NODE_CLASS, Node::NODE_CLASS);
createEdges(1000000, Edge::EDGE_OVERRIDE, Node::NODE_METHOD, Node::NODE_METHOD);
createEdges(1100000, Edge::EDGE_TEMPLATE_ARGUMENT, Node::NODE_TYPE, Node::NODE_TYPE);
createEdges(1200000, Edge::EDGE_TEMPLATE_DEFAULT_ARGUMENT, Node::NODE_TYPE, Node::NODE_TYPE);
createEdges(1300000, Edge::EDGE_TEMPLATE_SPECIALIZATION_OF, Node::NODE_TYPE, Node::NODE_TYPE);
createEdges(1400000, Edge::EDGE_TEMPLATE_MEMBER_SPECIALIZATION_OF, Node::NODE_METHOD, Node::NODE_METHOD);
std::vector<Id> focusedTokenIds;
std::vector<Id> activeTokenIds;
graph->forEachNode(
[&](Node* node)
{
Id id = node->getId();
if (id % 10 < 4)
{
node->setExplicit(true);
}
if (id % 10 == 2 || id % 10 == 5)
{
focusedTokenIds.push_back(id);
}
else if (id % 10 == 3 || id % 10 == 6)
{
activeTokenIds.push_back(id);
}
}
);
graph->forEachEdge(
[&](Edge* edge)
{
Id id = edge->getId();
if (id % 10000 == 1000)
{
focusedTokenIds.push_back(id);
}
else if (id % 10000 == 2000)
{
activeTokenIds.push_back(id);
}
}
);
createDummyGraphForTokenIds(std::vector<Id>(), graph);
for (size_t i = 0; i < 2; i++)
{
std::shared_ptr<DummyNode> bundleNode = std::make_shared<DummyNode>();
bundleNode->tokenId = 10000001 + i;
bundleNode->name = "bundle";
if (i == 1)
{
bundleNode->name = "focused bundle";
focusedTokenIds.push_back(bundleNode->tokenId);
}
bundleNode->bundledNodes.push_back(std::make_shared<DummyNode>());
bundleNode->bundledNodeCount = 123;
m_dummyNodes.push_back(bundleNode);
}
forEachDummyNodeRecursive(
[](DummyNode* node)
{
node->visible = true;
if (node->subNodes.size())
{
node->expanded = true;
node->childVisible = true;
}
}
);
forEachDummyEdge(
[](DummyEdge* edge)
{
edge->visible = true;
edge->active = true;
}
);
setActive(activeTokenIds);
layoutNesting();
for (size_t i = 0; i < m_dummyNodes.size(); i++)
{
DummyNode* node = m_dummyNodes[i].get();
node->layoutBucket.x = i % 6 + 1;
node->layoutBucket.y = (i / 6) + 1;
}
BucketGrid grid(Vec2i(0, 0));
grid.createBuckets(m_dummyNodes, std::vector<std::shared_ptr<DummyEdge>>());
grid.layoutBuckets();
buildGraph(message, false);
getView()->focusTokenIds(focusedTokenIds);
}
+11 -2
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"
@@ -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,9 +60,11 @@ private:
GraphView* getView() const;
void clear();
virtual void clear();
void createDummyGraphForTokenIds(const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph);
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;
@@ -89,7 +93,12 @@ private:
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;
@@ -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,12 +13,6 @@ 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->isFromSearch)
@@ -47,11 +42,35 @@ void SearchController::handleMessage(MessageActivateTokens* message)
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));
}
@@ -59,12 +78,10 @@ void SearchController::handleMessage(MessageSearchAutocomplete* message)
void SearchController::handleMessage(MessageSearchFullText* message)
{
LOG_INFO("fulltext string: \"" + message->searchTerm + "\"");
std::string prefix = "@";
if (message->caseSensitive)
{
prefix += "@";
}
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));
}
@@ -78,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);
@@ -22,6 +22,15 @@ UndoRedoView* UndoRedoController::getView()
return Controller::getView<UndoRedoView>();
}
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)
@@ -143,11 +152,6 @@ void UndoRedoController::handleMessage(MessageGraphNodeMove* message)
processCommand(command);
}
void UndoRedoController::handleMessage(MessageLoadProject* message)
{
clear();
}
void UndoRedoController::handleMessage(MessageRedo* message)
{
if (m_iterator == m_list.end())
@@ -239,23 +243,40 @@ void UndoRedoController::handleMessage(MessageShowScope* message)
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();
@@ -326,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;
@@ -369,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)
@@ -392,3 +409,39 @@ MessageBase* UndoRedoController::lastMessage() const
{
return std::prev(m_iterator)->message.get();
}
void UndoRedoController::dump() const
{
std::cout << "Undo Redo Stack:\n\n";
std::list<Command>::const_iterator it = m_list.begin();
while (it != m_list.end())
{
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);
}
if (m_list.end() == m_iterator)
{
std::cout << " <-";
}
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"
@@ -41,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>
@@ -56,6 +54,8 @@ public:
UndoRedoView* getView();
virtual void clear();
private:
struct Command
{
@@ -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,11 +96,11 @@ private:
void processCommand(Command command);
void clear();
bool sameMessageTypeAsLast(MessageBase* message) const;
MessageBase* lastMessage() const;
void dump() const;
std::list<Command> m_list;
std::list<Command>::iterator m_iterator;
};
@@ -76,7 +76,7 @@ void Bucket::sort()
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;
@@ -299,7 +299,7 @@ DummyNode* BucketGrid::findTopMostDummyNodeRecursive(
void BucketGrid::addNode(DummyNode* node)
{
Bucket* bucket = getBucket(0, 0);
Bucket* bucket = getBucket(node->layoutBucket.x, node->layoutBucket.y);
bucket->addNode(node);
}
@@ -310,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)
{
@@ -42,6 +42,7 @@ public:
, hasParent(true)
, accessType(TokenComponentAccess::ACCESS_NONE)
, invisibleSubNodeCount(0)
, layoutBucket(0, 0)
, bundledNodeCount(0)
{
}
@@ -191,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;
@@ -220,6 +231,9 @@ public:
// Bundling
BundleInfo bundleInfo;
// Layout
Vec2i layoutBucket;
// BundleNode
std::vector<std::shared_ptr<DummyNode>> bundledNodes;
size_t bundledNodeCount;
+2 -1
View File
@@ -20,7 +20,8 @@ public:
virtual void rebuildGraph(
std::shared_ptr<Graph> graph,
const std::vector<std::shared_ptr<DummyNode>>& nodes,
const std::vector<std::shared_ptr<DummyEdge>>& edges) = 0;
const std::vector<std::shared_ptr<DummyEdge>>& edges,
bool animated) = 0;
virtual void clear() = 0;
virtual void focusTokenIds(const std::vector<Id>& focusedTokenIds) = 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
+98 -23
View File
@@ -3,16 +3,18 @@
#include <sstream>
#include <queue>
#include "utility/Cache.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageClearErrorCount.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/text/TextAccess.h"
#include "utility/TimePoint.h"
#include "utility/tracing.h"
#include "utility/utility.h"
#include "utility/utilityString.h"
#include "utility/Version.h"
#include "utility/Cache.h"
#include "utility/utilityString.h"
#include "data/graph/token_component/TokenComponentAggregation.h"
@@ -30,6 +32,7 @@ PersistentStorage::PersistentStorage(const FilePath& dbPath)
{
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ALL)));
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR)));
// m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_COLOR_SCHEME_TEST)));
m_commandIndex.finishSetup();
}
@@ -102,7 +105,8 @@ Id PersistentStorage::addLocalSymbol(const std::string& name)
return localSymbolId;
}
void PersistentStorage::addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type)
void PersistentStorage::addSourceLocation(
Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type)
{
m_sqliteStorage.addSourceLocation(
elementId,
@@ -131,7 +135,8 @@ void PersistentStorage::addCommentLocation(Id fileNodeId, uint startLine, uint s
);
}
void PersistentStorage::addError(const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol)
void PersistentStorage::addError(
const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol)
{
m_sqliteStorage.addError(
message,
@@ -166,7 +171,8 @@ void PersistentStorage::forEachEdge(std::function<void(const Id /*id*/, const St
}
}
void PersistentStorage::forEachLocalSymbol(std::function<void(const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const
void PersistentStorage::forEachLocalSymbol(std::function<void(
const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const
{
for (StorageLocalSymbol& localSymbol: m_sqliteStorage.getAllLocalSymbols())
{
@@ -217,12 +223,13 @@ void PersistentStorage::finishInjection()
{
m_sqliteStorage.commitTransaction();
ErrorCountInfo errorCount = getErrorCount();
if (m_preInjectionErrorCount != -1 &&
m_preInjectionErrorCount != getErrorCount().total)
m_preInjectionErrorCount != errorCount.total)
{
MessageShowErrors msg(getErrorCount());
MessageShowErrors msg(errorCount);
msg.setSendAsTask(false);
msg.dispatch();
msg.dispatchImmediately();
}
m_preInjectionErrorCount = -1;
}
@@ -260,6 +267,8 @@ void PersistentStorage::clearCaches()
std::set<FilePath> PersistentStorage::getDependingFilePaths(const std::set<FilePath>& filePaths)
{
TRACE();
std::set<FilePath> dependingFilePaths;
for (const FilePath& filePath: filePaths)
{
@@ -290,6 +299,8 @@ std::set<FilePath> PersistentStorage::getDependingFilePaths(const FilePath& file
void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths)
{
TRACE();
std::vector<Id> fileNodeIds;
for (const FilePath& path : filePaths)
@@ -308,6 +319,8 @@ void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths
std::vector<FileInfo> PersistentStorage::getInfoOnAllFiles() const
{
TRACE();
std::vector<FileInfo> fileInfos;
std::vector<StorageFile> storageFiles = m_sqliteStorage.getAllFiles();
@@ -329,6 +342,8 @@ std::vector<FileInfo> PersistentStorage::getInfoOnAllFiles() const
void PersistentStorage::logStats() const
{
TRACE();
std::stringstream ss;
StorageStats stats = getStorageStats();
@@ -344,7 +359,7 @@ void PersistentStorage::logStats() const
ss << "\t" << stats.errorCount.total << " Errors\n";
ss << "\t" << stats.errorCount.fatal << " Fatal Errors\n";
LOG_WARNING(ss.str());
LOG_INFO(ss.str());
}
void PersistentStorage::startParsing()
@@ -356,6 +371,8 @@ void PersistentStorage::startParsing()
void PersistentStorage::finishParsing()
{
TRACE();
buildSearchIndex();
buildFilePathMaps();
buildHierarchyCache();
@@ -363,6 +380,8 @@ void PersistentStorage::finishParsing()
void PersistentStorage::optimizeMemory()
{
TRACE();
m_sqliteStorage.optimizeMemory();
}
@@ -394,11 +413,19 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
const std::string& searchTerm, bool caseSensitive
) const
{
TRACE();
if (m_fullTextSearchIndex.fileCount() == 0)
{
MessageStatus("Building fulltext search index", false, true).dispatch();
buildFullTextSearchIndex();
}
MessageStatus(
std::string("Searching fulltext (case-") + (caseSensitive ? "sensitive" : "insensitive") + "): " + searchTerm,
false, true
).dispatch();
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
std::vector<FullTextSearchResult> hits = m_fullTextSearchIndex.searchForTerm(searchTerm);
@@ -450,7 +477,7 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
if ( addHit )
{
collection->addTokenLocation(
i,
collection->getTokenLocationCount(),
0,
filepath,
location.startLineNumber,
@@ -462,11 +489,20 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
}
}
MessageStatus(
std::to_string(collection->getTokenLocationCount()) + " results in " +
std::to_string(collection->getTokenLocationFileCount()) + " files for fulltext search (case-" +
(caseSensitive ? "sensitive" : "insensitive") + "): " + searchTerm,
false, false
).dispatch();
return collection;
}
std::vector<SearchMatch> PersistentStorage::getAutocompletionMatches(const std::string& query) const
{
TRACE();
std::vector<SearchResult> commandResults = m_commandIndex.search(query, 0);
const size_t maxResultCount = 100;
@@ -620,6 +656,8 @@ std::vector<SearchMatch> PersistentStorage::getSearchMatchesForTokenIds(const st
std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
{
TRACE();
std::shared_ptr<Graph> graph = std::make_shared<Graph>();
std::vector<Id> tokenIds;
@@ -640,6 +678,8 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(const std::vector<Id>& tokenIds) const
{
TRACE();
std::shared_ptr<Graph> g = std::make_shared<Graph>();
Graph* graph = g.get();
@@ -757,6 +797,8 @@ std::vector<Id> PersistentStorage::getActiveTokenIdsForId(Id tokenId, Id* declar
std::vector<Id> PersistentStorage::getNodeIdsForLocationIds(const std::vector<Id>& locationIds) const
{
TRACE();
std::set<Id> edgeIds;
std::set<Id> nodeIds;
std::set<Id> implicitNodeIds;
@@ -847,8 +889,11 @@ Id PersistentStorage::getTokenIdForFileNode(const FilePath& filePath) const
return m_sqliteStorage.getFileByPath(filePath.str()).id;
}
std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsForTokenIds(const std::vector<Id>& tokenIds) const
std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds) const
{
TRACE();
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
std::vector<Id> fileIds;
@@ -869,9 +914,7 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsFor
for (Id fileId: fileIds)
{
StorageFile storageFile = m_sqliteStorage.getFileById(fileId);
collection->addTokenLocationFileAsPlainCopy(
m_sqliteStorage.getTokenLocationsForFile(storageFile.filePath).get()
);
collection->addTokenLocationFile(m_sqliteStorage.getTokenLocationsForFile(storageFile.filePath));
}
std::vector<StorageSourceLocation> locations = m_sqliteStorage.getTokenLocationsForElementIds(nonFileIds);
@@ -902,6 +945,8 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsFor
const std::vector<Id>& locationIds
) const
{
TRACE();
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
for (size_t i = 0; i < locationIds.size(); i++)
@@ -923,28 +968,33 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsFor
std::shared_ptr<TokenLocationFile> PersistentStorage::getTokenLocationsForFile(const std::string& filePath) const
{
std::shared_ptr<TokenLocationFile> locationFile = m_sqliteStorage.getTokenLocationsForFile(filePath);
locationFile->isWholeCopy = true;
return locationFile;
TRACE();
return m_sqliteStorage.getTokenLocationsForFile(filePath);
}
std::shared_ptr<TokenLocationFile> PersistentStorage::getTokenLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
) const
{
return m_sqliteStorage.getTokenLocationsForFile(filePath)->getFilteredByLines(firstLineNumber, lastLineNumber);
TRACE();
return getTokenLocationsForFile(filePath)->getFilteredByLines(firstLineNumber, lastLineNumber);
}
TokenLocationCollection PersistentStorage::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
std::shared_ptr<TokenLocationCollection> PersistentStorage::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
{
TokenLocationCollection errorCollection;
TRACE();
std::shared_ptr<TokenLocationCollection> errorCollection = std::make_shared<TokenLocationCollection>();
std::vector<StorageError> storageErrors = m_sqliteStorage.getAllErrors();
for (size_t i = 0; i < storageErrors.size(); i++)
{
const StorageError& error = storageErrors[i];
errorCollection.addTokenLocation(
i, i, error.filePath, error.lineNumber, error.columnNumber, error.lineNumber, error.columnNumber);
errorCollection->addTokenLocation(
i, i, error.filePath, error.lineNumber, error.columnNumber, error.lineNumber, error.columnNumber
)->setType(LOCATION_ERROR);
errors->push_back(ErrorInfo(error.message, error.filePath, i, error.fatal));
}
@@ -953,6 +1003,8 @@ TokenLocationCollection PersistentStorage::getErrorTokenLocations(std::vector<Er
std::shared_ptr<TokenLocationFile> PersistentStorage::getCommentLocationsInFile(const FilePath& filePath) const
{
TRACE();
std::shared_ptr<TokenLocationFile> file = std::make_shared<TokenLocationFile>(filePath);
std::vector<StorageCommentLocation> storageLocations = m_sqliteStorage.getCommentLocationsInFile(filePath);
@@ -1001,6 +1053,8 @@ ErrorCountInfo PersistentStorage::getErrorCount() const
StorageStats PersistentStorage::getStorageStats() const
{
TRACE();
StorageStats stats;
stats.nodeCount = m_sqliteStorage.getNodeCount();
@@ -1067,6 +1121,8 @@ std::vector<Id> PersistentStorage::getAllChildNodeIds(const Id nodeId) const
void PersistentStorage::addNodesToGraph(const std::vector<Id>& nodeIds, Graph* graph) const
{
TRACE();
if (nodeIds.size() == 0)
{
return;
@@ -1111,6 +1167,8 @@ void PersistentStorage::addNodesToGraph(const std::vector<Id>& nodeIds, Graph* g
void PersistentStorage::addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) const
{
TRACE();
if (edgeIds.size() == 0)
{
return;
@@ -1137,6 +1195,8 @@ void PersistentStorage::addNodesWithChildrenAndEdgesToGraph(
const std::vector<Id>& nodeIds, const std::vector<Id>& edgeIds, Graph* graph
) const
{
TRACE();
std::set<Id> parentNodeIds;
for (Id nodeId : nodeIds)
@@ -1169,6 +1229,8 @@ void PersistentStorage::addNodesWithChildrenAndEdgesToGraph(
void PersistentStorage::addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const
{
TRACE();
struct EdgeInfo
{
Id edgeId;
@@ -1261,6 +1323,8 @@ void PersistentStorage::addAggregationEdgesToGraph(const Id nodeId, Graph* graph
void PersistentStorage::addComponentAccessToGraph(Graph* graph) const
{
TRACE();
std::vector<Id> memberEdgeIds;
graph->forEachEdge(
@@ -1288,15 +1352,22 @@ void PersistentStorage::addComponentAccessToGraph(Graph* graph) const
void PersistentStorage::buildSearchIndex()
{
for (StorageNode node: m_sqliteStorage.getAllNodes())
TRACE();
for (StorageNode node : m_sqliteStorage.getAllNodes())
{
m_elementIndex.addNode(node.id, NameHierarchy::deserialize(node.serializedName));
if (intToDefinitionType(node.definitionType) != DEFINITION_IMPLICIT)
{
m_elementIndex.addNode(node.id, NameHierarchy::deserialize(node.serializedName));
}
}
m_elementIndex.finishSetup();
}
void PersistentStorage::buildFilePathMaps()
{
TRACE();
for (StorageFile file: m_sqliteStorage.getAllFiles())
{
m_fileNodeIds.emplace(file.filePath, file.id);
@@ -1306,6 +1377,8 @@ void PersistentStorage::buildFilePathMaps()
void PersistentStorage::buildFullTextSearchIndex() const
{
TRACE();
for (StorageFile file : m_sqliteStorage.getAllFiles())
{
m_fullTextSearchIndex.addFile(file.id, m_sqliteStorage.getFileContentById(file.id)->getText());
@@ -1314,6 +1387,8 @@ void PersistentStorage::buildFullTextSearchIndex() const
void PersistentStorage::buildHierarchyCache()
{
TRACE();
std::vector<StorageEdge> memberEdges = m_sqliteStorage.getEdgesByType(Edge::typeToInt(Edge::EDGE_MEMBER));
Cache<Id, Node::NodeType> nodeTypeCache([this](Id id){
+1 -1
View File
@@ -104,7 +104,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;
+5 -1
View File
@@ -223,6 +223,8 @@ Id SqliteStorage::addError(const std::string& message, bool fatal, const std::st
return q.getIntField(0, -1);
}
stmt.finalize();
stmt = m_database.compileStatement((
"INSERT INTO error(message, fatal, file_path, line_number, column_number) "
"VALUES (?, " + std::to_string(fatal) + ", '" + filePath +
@@ -504,6 +506,8 @@ std::shared_ptr<TokenLocationFile> SqliteStorage::getTokenLocationsForFile(const
loc->setType(intToLocationType(location.type));
}
ret->isWholeCopy = true;
return ret;
}
@@ -661,7 +665,7 @@ void SqliteStorage::setupTables()
);
// TODO: move to createIndexesForAnalysis() or prepareForAnalysis
m_database.execDML( // used for checking for duplicates during code analysis
m_database.execDML( // used for checking for duplicates during code analysis
"CREATE INDEX IF NOT EXISTS edge_multipart_index ON edge(type, source_node_id, target_node_id);"
);
+3
View File
@@ -5,6 +5,7 @@
#include "data/graph/Edge.h"
#include "data/StorageTypes.h"
#include "utility/logging/logging.h"
#include "utility/tracing.h"
Storage::Storage()
{
@@ -26,6 +27,8 @@ void Storage::finishInjection()
void Storage::inject(Storage* injected)
{
TRACE();
startInjection();
std::unordered_map<Id, Id> injectedIdToOwnId;
+1 -1
View File
@@ -33,7 +33,7 @@ Task::TaskState TaskCleanStorage::update()
if (m_fileCount)
{
MessageStatus("Cleaning up names (ESC to quit)", false, true).dispatch();
MessageStatus("Clearing caches (ESC to quit)", false, true).dispatch();
m_storage->clearCaches();
}
+1 -1
View File
@@ -59,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;
+2 -2
View File
@@ -218,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
+1 -1
View File
@@ -47,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;
@@ -1,8 +1,9 @@
#include "data/fulltextsearch/FullTextSearchIndex.h"
#include <limits>
#include "utility/utility.h"
#include "utility/logging/logging.h"
#include "utility/tracing.h"
#include "utility/utility.h"
void FullTextSearchIndex::addFile(Id fileId, const std::string& file)
{
@@ -22,6 +23,8 @@ void FullTextSearchIndex::addFile(Id fileId, const std::string& file)
std::vector<FullTextSearchResult> FullTextSearchIndex::searchForTerm(const std::string& term) const
{
TRACE();
std::vector<FullTextSearchResult> ret;
FullTextSearchResult hit;
for (auto f : m_files)
+4
View File
@@ -12,6 +12,8 @@ int locationTypeToInt(LocationType type)
return 2;
case LOCATION_FULLTEXT:
return 3;
case LOCATION_ERROR:
return 4;
}
}
@@ -27,6 +29,8 @@ LocationType intToLocationType(int value)
return LOCATION_LOCAL_SYMBOL;
case 3:
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_FULLTEXT
LOCATION_FULLTEXT,
LOCATION_ERROR
};
int locationTypeToInt(LocationType type);
@@ -22,6 +22,22 @@ const TokenLocationCollection::TokenLocationFileMapType& TokenLocationCollection
return m_files;
}
const std::map<Id, TokenLocation*>& TokenLocationCollection::getTokenLocations() const
{
return m_locations;
}
std::shared_ptr<TokenLocationFile> TokenLocationCollection::getTokenLocationFileByPath(const FilePath& filePath) const
{
std::map<FilePath, std::shared_ptr<TokenLocationFile>>::const_iterator it = m_files.find(filePath);
if (it != m_files.end())
{
return it->second;
}
return nullptr;
}
size_t TokenLocationCollection::getTokenLocationFileCount() const
{
return m_files.size();
@@ -39,11 +55,6 @@ size_t TokenLocationCollection::getTokenLocationLineCount() const
return count;
}
const std::map<Id, TokenLocation*>& TokenLocationCollection::getTokenLocations() const
{
return m_locations;
}
size_t TokenLocationCollection::getTokenLocationCount() const
{
return m_locations.size();
@@ -56,13 +67,21 @@ TokenLocation* TokenLocationCollection::addTokenLocation(
{
if (startLineNumber > endLineNumber || (startLineNumber == endLineNumber && startColumnNumber > endColumnNumber))
{
LOG_ERROR("Can't create TokenLocation with wrong boundaries.");
LOG_ERROR_STREAM(<< "TokenLocation has wrong boundaries: "<< filePath.str() << " "
<< startLineNumber << ":" << startColumnNumber << " "
<< endLineNumber << ":" << endColumnNumber);
return nullptr;
}
TokenLocation* location = findTokenLocationById(locationId);
if (location)
{
return location;
}
TokenLocationFile* file = createTokenLocationFile(filePath);
TokenLocation* location =
file->addTokenLocation(locationId, tokenId, startLineNumber, startColumnNumber, endLineNumber, endColumnNumber);
location = file->addTokenLocation(
locationId, tokenId, startLineNumber, startColumnNumber, endLineNumber, endColumnNumber);
m_locations.emplace(location->getId(), location);
return location;
@@ -87,6 +106,37 @@ void TokenLocationCollection::removeTokenLocation(TokenLocation* location)
}
}
TokenLocationFile* TokenLocationCollection::addTokenLocationFile(std::shared_ptr<TokenLocationFile> locationFile)
{
TokenLocationFile* file = findTokenLocationFileByPath(locationFile->getFilePath());
if (file)
{
LOG_ERROR("TokenLocationFile with same path already exists.");
return file;
}
m_files.emplace(locationFile->getFilePath(), locationFile);
locationFile->forEachTokenLocation(
[this, &file](TokenLocation* tokenLocation) -> void
{
m_locations.emplace(tokenLocation->getId(), tokenLocation);
}
);
return locationFile.get();
}
void TokenLocationCollection::removeTokenLocationFile(TokenLocationFile* file)
{
file->forEachTokenLocation(
[&](TokenLocation* location)
{
m_locations.erase(location->getId());
}
);
m_files.erase(file->getFilePath());
}
TokenLocation* TokenLocationCollection::findTokenLocationById(Id id) const
{
std::map<Id, TokenLocation*>::const_iterator it = m_locations.find(id);
@@ -101,16 +151,11 @@ TokenLocation* TokenLocationCollection::findTokenLocationById(Id id) const
TokenLocationFile* TokenLocationCollection::findTokenLocationFileByPath(const FilePath& filePath) const
{
std::map<FilePath, std::shared_ptr<TokenLocationFile>>::const_iterator it = m_files.find(filePath);
if (it != m_files.end())
{
return it->second.get();
}
return nullptr;
return getTokenLocationFileByPath(filePath).get();
}
void TokenLocationCollection::forEachTokenLocationFile(std::function<void(std::shared_ptr<TokenLocationFile>)> func) const
void TokenLocationCollection::forEachTokenLocationFile(
std::function<void(std::shared_ptr<TokenLocationFile>)> func) const
{
for (const TokenLocationFilePairType& file : m_files)
{
@@ -134,18 +179,6 @@ void TokenLocationCollection::forEachTokenLocation(std::function<void(TokenLocat
}
}
void TokenLocationCollection::removeTokenLocationFile(TokenLocationFile* file)
{
file->forEachTokenLocation(
[&](TokenLocation* location)
{
m_locations.erase(location->getId());
}
);
m_files.erase(file->getFilePath());
}
TokenLocationFile* TokenLocationCollection::addTokenLocationFileAsPlainCopy(const TokenLocationFile* locationFile)
{
TokenLocationFile* file = createTokenLocationFile(locationFile->getFilePath());
@@ -156,7 +189,6 @@ TokenLocationFile* TokenLocationCollection::addTokenLocationFileAsPlainCopy(cons
m_locations.emplace(copy->getId(), copy);
}
);
file->isWholeCopy = true;
return file;
}
@@ -24,11 +24,12 @@ public:
~TokenLocationCollection();
const TokenLocationFileMapType& getTokenLocationFiles() const;
size_t getTokenLocationFileCount() const;
size_t getTokenLocationLineCount() const;
const std::map<Id, TokenLocation*>& getTokenLocations() const;
std::shared_ptr<TokenLocationFile> getTokenLocationFileByPath(const FilePath& filePath) const;
size_t getTokenLocationFileCount() const;
size_t getTokenLocationLineCount() const;
size_t getTokenLocationCount() const;
TokenLocation* addTokenLocation(
@@ -37,6 +38,9 @@ public:
unsigned int endLineNumber, unsigned int endColumnNumber);
void removeTokenLocation(TokenLocation* location);
TokenLocationFile* addTokenLocationFile(std::shared_ptr<TokenLocationFile> locationFile);
void removeTokenLocationFile(TokenLocationFile* file);
TokenLocation* findTokenLocationById(Id id) const;
TokenLocationFile* findTokenLocationFileByPath(const FilePath& filePath) const;
@@ -44,8 +48,6 @@ public:
void forEachTokenLocationLine(std::function<void(TokenLocationLine*)> func) const;
void forEachTokenLocation(std::function<void(TokenLocation*)> func) const;
void removeTokenLocationFile(TokenLocationFile* file);
TokenLocationFile* addTokenLocationFileAsPlainCopy(const TokenLocationFile* locationFile);
TokenLocation* addTokenLocationAsPlainCopy(const TokenLocation* location);
+34 -7
View File
@@ -57,14 +57,41 @@ TokenLocation* TokenLocationFile::addTokenLocation(
unsigned int endLineNumber, unsigned int endColumnNumber)
{
TokenLocationLine* line = createTokenLocationLine(startLineNumber);
TokenLocation* start = line->addStartTokenLocation(locationId, tokenId, startColumnNumber);
if (startLineNumber != endLineNumber)
// Check if a TokenLocation with the same start and end was already added.
TokenLocation* start = nullptr;
line->forEachStartTokenLocation(
[&](TokenLocation* startLocation)
{
if (start)
{
return;
}
TokenLocation* endLocation = startLocation->getEndTokenLocation();
if (startLocation->getTokenId() == tokenId &&
startLocation->getColumnNumber() == startColumnNumber &&
endLocation &&
endLocation->getLineNumber() == endLineNumber &&
endLocation->getColumnNumber() == endColumnNumber)
{
start = startLocation;
}
}
);
if (!start)
{
line = createTokenLocationLine(endLineNumber);
}
start = line->addStartTokenLocation(locationId, tokenId, startColumnNumber);
line->addEndTokenLocation(start, endColumnNumber);
if (startLineNumber != endLineNumber)
{
line = createTokenLocationLine(endLineNumber);
}
line->addEndTokenLocation(start, endColumnNumber);
}
return start;
}
@@ -128,7 +155,7 @@ void TokenLocationFile::forEachEndTokenLocation(std::function<void(TokenLocation
TokenLocation* TokenLocationFile::addTokenLocationAsPlainCopy(const TokenLocation* location)
{
unsigned int lineNumber = location->getTokenLocationLine()->getLineNumber();
unsigned int lineNumber = location->getLineNumber();
TokenLocationLine* line = createTokenLocationLine(lineNumber);
// Check whether this location was already added or if the other TokenLocation was added.
@@ -144,7 +171,7 @@ TokenLocation* TokenLocationFile::addTokenLocationAsPlainCopy(const TokenLocatio
else
{
// Look for the other location in it's line.
unsigned int otherLineNumber = location->getOtherTokenLocation()->getTokenLocationLine()->getLineNumber();
unsigned int otherLineNumber = location->getOtherTokenLocation()->getLineNumber();
if (lineNumber != otherLineNumber)
{
TokenLocationLine* otherLine = findTokenLocationLine(otherLineNumber);
+9 -1
View File
@@ -21,7 +21,7 @@ std::string NameHierarchy::serialize(NameHierarchy nameHierarchy)
NameHierarchy NameHierarchy::deserialize(const std::string& serializedName)
{
NameHierarchy nameHierarchy;
std::vector<std::string> serializedNameElements = utility::splitToVector(serializedName, "\n");
for (size_t i = 0; i < serializedNameElements.size(); i++)
{
@@ -46,6 +46,14 @@ NameHierarchy::NameHierarchy(const std::string& name)
push(std::make_shared<NameElement>(name));
}
NameHierarchy::NameHierarchy(const std::vector<std::string>& names)
{
for (const std::string& name : names)
{
push(std::make_shared<NameElement>(name));
}
}
NameHierarchy::~NameHierarchy()
{
}
+1
View File
@@ -15,6 +15,7 @@ public:
NameHierarchy();
NameHierarchy(const std::string& name);
NameHierarchy(const std::vector<std::string>& names);
~NameHierarchy();
void push(std::shared_ptr<NameElement> element);
+22 -1
View File
@@ -29,8 +29,9 @@ std::string SearchMatch::getSearchTypeName(SearchType type)
return "command";
case SEARCH_OPERATOR:
return "operator";
case SEARCH_FULLTEXT:
return "fulltext";
}
}
std::string SearchMatch::searchMatchesToString(const std::vector<SearchMatch>& matches)
@@ -62,11 +63,31 @@ std::string SearchMatch::getCommandName(CommandType type)
return "overview";
case COMMAND_ERROR:
return "error";
case COMMAND_COLOR_SCHEME_TEST:
return "color_scheme_test";
}
return "none";
}
SearchMatch::CommandType SearchMatch::getCommandType(const std::string& name)
{
if (name == "overview")
{
return COMMAND_ALL;
}
else if (name == "error")
{
return COMMAND_ERROR;
}
else if (name == "color_scheme_test")
{
return COMMAND_COLOR_SCHEME_TEST;
}
return COMMAND_ALL;
}
SearchMatch::SearchMatch()
: typeName("")
, searchType(SEARCH_NONE)
+7 -2
View File
@@ -16,13 +16,15 @@ struct SearchMatch
SEARCH_NONE,
SEARCH_TOKEN,
SEARCH_COMMAND,
SEARCH_OPERATOR
SEARCH_OPERATOR,
SEARCH_FULLTEXT
};
enum CommandType
{
COMMAND_ALL,
COMMAND_ERROR
COMMAND_ERROR,
COMMAND_COLOR_SCHEME_TEST
};
static void log(const std::vector<SearchMatch>& matches, const std::string& query);
@@ -32,6 +34,9 @@ struct SearchMatch
static SearchMatch createCommand(CommandType type);
static std::string getCommandName(CommandType type);
static CommandType getCommandType(const std::string& name);
static const char FULLTEXT_SEARCH_CHARACTER = '?';
SearchMatch();
SearchMatch(const std::string& query);
+10
View File
@@ -153,6 +153,16 @@ void ApplicationSettings::setIndexerThreadCount(const int count)
setValue<int>("application/indexer_thread_count", count);
}
int ApplicationSettings::getWindowBaseWidth() const
{
return getValue<int>("application/window_base_width", 500);
}
int ApplicationSettings::getWindowBaseHeight() const
{
return getValue<int>("application/window_base_height", 500);
}
int ApplicationSettings::getCodeTabWidth() const
{
return getValue<int>("code/tab_width", 4);
+3
View File
@@ -50,6 +50,9 @@ public:
int getIndexerThreadCount() const;
void setIndexerThreadCount(const int count);
int getWindowBaseWidth() const;
int getWindowBaseHeight() const;
// code
int getCodeTabWidth() const;
void setCodeTabWidth(int codeTabWidth);
+34 -2
View File
@@ -21,6 +21,11 @@ std::string ColorScheme::getColor(const std::string& key) const
return getValue<std::string>(key, "");
}
std::string ColorScheme::getColor(const std::string& key, const std::string& defaultColor) const
{
return getValue<std::string>(key, defaultColor);
}
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const
{
return getNodeTypeColor(Node::getTypeString(type), key, state);
@@ -85,9 +90,10 @@ std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState
return color;
}
std::string ColorScheme::getSearchTypeColor(const std::string& searchTypeName, const std::string& state) const
std::string ColorScheme::getSearchTypeColor(
const std::string& searchTypeName, const std::string& key, const std::string& state) const
{
std::string path = "search/query/" + searchTypeName + "/" + state;
std::string path = "search/query/" + searchTypeName + "/" + state + "/" + key;
return getValue<std::string>(path, "#FFFFFF");
}
@@ -96,6 +102,31 @@ std::string ColorScheme::getSyntaxColor(const std::string& key) const
return getValue<std::string>("code/snippet/syntax/" + key, "#FFFFFF");
}
std::string ColorScheme::getCodeSelectionTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const
{
disableWarnings();
std::string color = getValue<std::string>("code/snippet/selection/" + typeStr + "/" + stateToString(state) + "/" + key, "");
if (!color.size() && state == ACTIVE)
{
color = getValue<std::string>("code/snippet/selection/" + typeStr + "/" + stateToString(FOCUS) + "/" + key, "");
}
if (!color.size() && state != NORMAL)
{
color = getValue<std::string>("code/snippet/selection/" + typeStr + "/" + stateToString(NORMAL) + "/" + key, "");
}
if (!color.size())
{
color = "transparent";
}
enableWarnings();
return color;
}
ColorScheme::ColorScheme()
{
}
@@ -106,6 +137,7 @@ std::string ColorScheme::stateToString(ColorState state)
{
case NORMAL: return "normal";
case FOCUS: return "focus";
case ACTIVE: return "active";
}
return "";
+6 -2
View File
@@ -12,13 +12,15 @@ public:
enum ColorState
{
NORMAL,
FOCUS
FOCUS,
ACTIVE
};
static std::shared_ptr<ColorScheme> getInstance();
virtual ~ColorScheme();
std::string getColor(const std::string& key) const;
std::string getColor(const std::string& key, const std::string& defaultColor) const;
std::string getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const;
std::string getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const;
@@ -26,9 +28,11 @@ public:
std::string getEdgeTypeColor(Edge::EdgeType type, ColorState state) const;
std::string getEdgeTypeColor(const std::string& typeStr, ColorState state) const;
std::string getSearchTypeColor(const std::string& searchTypeName, const std::string& state = "normal") const;
std::string getSearchTypeColor(const std::string& searchTypeName, const std::string& key, const std::string& state = "normal") const;
std::string getSyntaxColor(const std::string& key) const;
std::string getCodeSelectionTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const;
protected:
ColorScheme();
ColorScheme(const ColorScheme&) = delete;
+19 -5
View File
@@ -44,6 +44,7 @@ bool ProjectSettings::operator==(const ProjectSettings& other) const
utility::isPermutation<FilePath>(getSourcePaths(), other.getSourcePaths()) &&
utility::isPermutation<FilePath>(getHeaderSearchPaths(), other.getHeaderSearchPaths()) &&
utility::isPermutation<FilePath>(getFrameworkSearchPaths(), other.getFrameworkSearchPaths()) &&
utility::isPermutation<FilePath>(getExcludePaths(), other.getExcludePaths()) &&
utility::isPermutation<std::string>(getCompilerFlags(), other.getCompilerFlags()) &&
utility::isPermutation<std::string>(getSourceExtensions(), other.getSourceExtensions());
}
@@ -156,11 +157,6 @@ bool ProjectSettings::setSourceExtensions(const std::vector<std::string> &source
return setValues("source/extensions/source_extensions", sourceExtensions);
}
bool ProjectSettings::isUseSourcePathsForHeaderSearchDefined() const
{
return isValueDefined("source/use_source_paths_for_header_search");
}
bool ProjectSettings::getUseSourcePathsForHeaderSearch() const
{
return getValue<bool>("source/use_source_paths_for_header_search", false);
@@ -171,6 +167,24 @@ bool ProjectSettings::setUseSourcePathsForHeaderSearch(bool useSourcePathsForHea
return setValue<bool>("source/use_source_paths_for_header_search", useSourcePathsForHeaderSearch);
}
std::vector<FilePath> ProjectSettings::getExcludePaths() const
{
return getPathValues("source/exclude_paths/exclude_path");
}
std::vector<FilePath> ProjectSettings::getAbsoluteExcludePaths() const
{
std::vector<FilePath> paths = getExcludePaths();
expandPaths(paths);
makePathsAbsolute(paths);
return paths;
}
bool ProjectSettings::setExcludePaths(const std::vector<FilePath>& excludePaths)
{
return setPathValues("source/exclude_paths/exclude_path", excludePaths);
}
FilePath ProjectSettings::getVisualStudioSolutionPath() const
{
return FilePath(getValue<std::string>("source/build_file_path/vs_solution_path", ""));
+4 -4
View File
@@ -44,16 +44,16 @@ public:
std::vector<std::string> getCompilerFlags() const;
bool setCompilerFlags(const std::vector<std::string>& compilerFlags);
std::vector<std::string> getHeaderExtensions() const;
std::vector<std::string> getSourceExtensions() const;
bool setHeaderExtensions(const std::vector<std::string>& headerExtensions);
bool setSourceExtensions(const std::vector<std::string>& sourceExtensions);
bool isUseSourcePathsForHeaderSearchDefined() const;
bool getUseSourcePathsForHeaderSearch() const;
bool setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch);
std::vector<FilePath> getExcludePaths() const;
std::vector<FilePath> getAbsoluteExcludePaths() const;
bool setExcludePaths(const std::vector<FilePath>& excludePaths);
FilePath getVisualStudioSolutionPath() const;
bool setVisualStudioSolutionPath(const FilePath& visualStudioSolutionPath);
+10
View File
@@ -24,6 +24,11 @@ TimePoint::TimePoint(std::string s)
}
}
TimePoint TimePoint::now()
{
return TimePoint(boost::posix_time::microsec_clock::local_time());
}
std::string TimePoint::toString() const
{
std::stringstream stream;
@@ -32,4 +37,9 @@ std::string TimePoint::toString() const
stream.imbue(std::locale(std::locale::classic(), facet));
stream << m_time;
return stream.str();
}
size_t TimePoint::deltaMS(const TimePoint& other) const
{
return (m_time - other.m_time).total_milliseconds();
}
+5 -1
View File
@@ -11,6 +11,8 @@ public:
//TimePoint(time_t t);
TimePoint(std::string s);
static TimePoint now();
std::string toString() const;
inline bool operator==(const TimePoint& rhs){ return m_time == rhs.m_time; }
@@ -20,7 +22,9 @@ public:
inline bool operator<=(const TimePoint& rhs){ return m_time <= rhs.m_time; }
inline bool operator>=(const TimePoint& rhs){ return m_time >= rhs.m_time; }
inline float operator-(const TimePoint& rhs){ return (m_time - rhs.m_time).total_milliseconds() / 1000.0f; }
inline float operator-(const TimePoint& rhs){ return deltaMS(rhs) / 1000.0f; }
size_t deltaMS(const TimePoint& other) const;
private:
boost::posix_time::ptime m_time;
+38 -4
View File
@@ -23,10 +23,12 @@ const std::vector<FilePath>& FileManager::getSourcePaths() const
void FileManager::setPaths(
std::vector<FilePath> sourcePaths,
std::vector<FilePath> headerPaths,
std::vector<FilePath> excludePaths,
std::vector<std::string> sourceExtensions
){
m_sourcePaths = sourcePaths;
m_headerPaths = headerPaths;
m_excludePaths = excludePaths;
m_sourceExtensions = sourceExtensions;
}
@@ -45,7 +47,7 @@ void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
for (std::map<FilePath, FileInfo>::iterator it = m_files.begin(); it != m_files.end(); it++)
{
const FilePath& filePath = it->first;
if (filePath.exists() && !hasSourceExtension(filePath))
if (filePath.exists() && !hasSourceFilePath(filePath))
{
FileInfo fileInfo = FileSystem::getFileInfoForPath(filePath);
@@ -61,10 +63,19 @@ void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
}
}
m_sourceFiles.clear();
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions);
for (FileInfo fileInfo: fileInfos)
{
const FilePath& filePath = fileInfo.path;
if (isExcluded(filePath))
{
continue;
}
m_sourceFiles.insert(filePath);
std::map<FilePath, FileInfo>::iterator it = m_files.find(filePath);
if (it != m_files.end())
{
@@ -105,11 +116,16 @@ std::set<FilePath> FileManager::getRemovedFilePaths() const
bool FileManager::hasFilePath(const FilePath& filePath) const
{
if (m_files.find(filePath) != m_files.end())
if (hasSourceFilePath(filePath))
{
return true;
}
if (isExcluded(filePath))
{
return false;
}
for (FilePath path : m_headerPaths)
{
if (path == filePath || path.contains(filePath))
@@ -121,9 +137,14 @@ bool FileManager::hasFilePath(const FilePath& filePath) const
return false;
}
bool FileManager::hasSourceExtension(const FilePath& filePath) const
bool FileManager::hasSourceFilePath(const FilePath& filePath) const
{
return filePath.hasExtension(m_sourceExtensions);
if (m_sourceFiles.find(filePath) != m_sourceFiles.end())
{
return true;
}
return false;
}
const FileInfo FileManager::getFileInfo(const FilePath& filePath) const
@@ -137,3 +158,16 @@ const FileInfo FileManager::getFileInfo(const FilePath& filePath) const
return it->second;
}
bool FileManager::isExcluded(const FilePath& filePath) const
{
for (FilePath path : m_excludePaths)
{
if (path == filePath || path.contains(filePath))
{
return true;
}
}
return false;
}
+7 -2
View File
@@ -18,6 +18,7 @@ public:
void setPaths(
std::vector<FilePath> sourcePaths,
std::vector<FilePath> headerPaths,
std::vector<FilePath> excludePaths,
std::vector<std::string> sourceExtensions
);
@@ -28,22 +29,26 @@ public:
std::set<FilePath> getRemovedFilePaths() const;
virtual bool hasFilePath(const FilePath& filePath) const;
virtual bool hasSourceExtension(const FilePath& filePath) const;
virtual bool hasSourceFilePath(const FilePath& filePath) const;
virtual const FileInfo getFileInfo(const FilePath& filePath) const;
private:
bool isExcluded(const FilePath& filePath) const;
std::map<FilePath, FileInfo> m_files;
std::vector<FilePath> m_sourcePaths;
std::vector<FilePath> m_headerPaths;
std::vector<FilePath> m_excludePaths;
std::vector<std::string> m_sourceExtensions;
std::vector<std::string> m_includeExtensions;
std::set<FilePath> m_addedFiles;
std::set<FilePath> m_updatedFiles;
std::set<FilePath> m_removedFiles;
std::set<FilePath> m_sourceFiles;
};
#endif // FILE_MANAGER_H
+35 -29
View File
@@ -3,8 +3,9 @@
#include "utility/file/FileManager.h"
#include "utility/file/FileSystem.h"
FileRegister::FileRegister(const FileManager* fileManager)
FileRegister::FileRegister(const FileManager* fileManager, bool randomizeParseOrder)
: m_fileManager(fileManager)
, m_randomizeParseOrder(randomizeParseOrder)
{
}
@@ -18,7 +19,7 @@ void FileRegister::setFilePaths(const std::vector<FilePath>& filePaths)
{
FilePath path = p.exists() ? p.absolute() : p;
if (m_fileManager->hasSourceExtension(path))
if (m_fileManager->hasSourceFilePath(path))
{
m_sourceFilePaths.emplace(path, STATE_UNPARSED);
}
@@ -98,53 +99,58 @@ bool FileRegister::fileIsParsed(const FilePath& filePath) const
bool FileRegister::sourceFileIsParsed(const FilePath& filePath) const
{
std::lock_guard<std::mutex> lock(m_sourceFileMutex);
std::map<FilePath, ParseState>::const_iterator it = m_sourceFilePaths.find(filePath);
if (it == m_sourceFilePaths.end())
{
std::lock_guard<std::mutex> lock(m_sourceFileMutex);
std::map<FilePath, ParseState>::const_iterator it = m_sourceFilePaths.find(filePath);
if (it == m_sourceFilePaths.end())
{
return false;
}
if (it->second == STATE_PARSED)
{
return true;
}
return false;
}
if (it->second == STATE_PARSED)
{
return true;
}
return false;
}
bool FileRegister::includeFileIsParsed(const FilePath& filePath) const
{
std::lock_guard<std::mutex> lock(m_includeFileMutex);
std::map<FilePath, ParseState>::const_iterator it = m_includeFilePaths.find(filePath);
if (it == m_includeFilePaths.end())
{
std::lock_guard<std::mutex> lock(m_includeFileMutex);
std::map<FilePath, ParseState>::const_iterator it = m_includeFilePaths.find(filePath);
if (it == m_includeFilePaths.end())
{
return false;
}
if (it->second == STATE_PARSED)
{
return true;
}
return false;
}
if (it->second == STATE_PARSED)
{
return true;
}
return false;
}
FilePath FileRegister::consumeSourceFile()
{
std::lock_guard<std::mutex> lock(m_consumeFileMutex);
std::vector<FilePath> paths = getUnparsedSourceFilePaths();
FilePath path;
if (paths.size())
{
path = paths[rand() % paths.size()];
if (m_randomizeParseOrder)
{
path = paths[rand() % paths.size()];
}
else
{
path = paths[0];
}
std::lock_guard<std::mutex> lock(m_sourceFileMutex);
m_sourceFilePaths[path] = STATE_PARSING;
+4 -2
View File
@@ -17,7 +17,7 @@ class FileManager;
class FileRegister
{
public:
explicit FileRegister(const FileManager* fileManager);
explicit FileRegister(const FileManager* fileManager, bool randomizeParseOrder);
void setFilePaths(const std::vector<FilePath>& filePaths);
@@ -49,6 +49,7 @@ private:
};
const FileManager* m_fileManager;
bool m_randomizeParseOrder;
mutable std::unordered_map<std::string, bool> m_projectFiles;
mutable std::mutex m_projectFilesMutex;
@@ -64,7 +65,8 @@ private:
mutable std::mutex m_sourceFileMutex;
mutable std::mutex m_includeFileMutex;
mutable std::mutex m_threadFileMutex;
mutable std::mutex m_fileManagerMutex;
std::mutex m_consumeFileMutex;
};
#endif // FILE_REGISTER_H
+65 -41
View File
@@ -81,7 +81,8 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
it.pop();
continue;
}
if (boost::filesystem::is_regular_file(*it) && hasExtension(it->path().string(), fileExtensions))
if (boost::filesystem::is_regular_file(*it) &&
(!fileExtensions.size() || hasExtension(it->path().string(), fileExtensions)))
{
std::time_t t = boost::filesystem::last_write_time(*it);
boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t);
@@ -89,7 +90,7 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
}
}
}
else if (path.exists() && path.hasExtension(fileExtensions))
else if (path.exists() && (!fileExtensions.size() || path.hasExtension(fileExtensions)))
{
std::time_t t = boost::filesystem::last_write_time(path.path());
boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t);
@@ -115,14 +116,72 @@ std::string FileSystem::getTimeStringNow() // TODO: move to utility
return boost::posix_time::to_iso_string(boost::posix_time::second_clock::universal_time());
}
bool FileSystem::exists(const std::string& path)
bool FileSystem::exists(const FilePath& path)
{
return boost::filesystem::exists(boost::filesystem::path(path));
return boost::filesystem::exists(path.path());
}
bool FileSystem::remove(const std::string& path)
bool FileSystem::remove(const FilePath& path)
{
return boost::filesystem::remove(path);
return boost::filesystem::remove(path.path());
}
bool FileSystem::rename(const FilePath& from, const FilePath& to)
{
if (!from.exists() || to.exists())
{
return false;
}
boost::filesystem::rename(from.path(), to.path());
return true;
}
bool FileSystem::copyFile(const FilePath& from, const FilePath& to)
{
if (!from.exists() || to.exists())
{
return false;
}
boost::filesystem::copy_file(boost::filesystem::path(from.path()), boost::filesystem::path(to.path()));
return true;
}
bool FileSystem::copy_directory(const FilePath& from, const FilePath& to)
{
if (!from.exists() || to.exists())
{
return false;
}
boost::filesystem::copy_directory(boost::filesystem::path(from.path()),boost::filesystem::path(to.path()));
return true;
}
void FileSystem::createDirectory(const FilePath& path)
{
boost::filesystem::create_directories(path.str());
}
std::vector<FilePath> FileSystem::getSubDirectories(const FilePath &path)
{
std::vector<FilePath> v;
if (!path.exists())
{
return v;
}
for (boost::filesystem::recursive_directory_iterator end, dir(path.str()); dir != end; dir++)
{
if (boost::filesystem::is_directory(dir->path()))
{
v.push_back(FilePath(dir->path()));
}
}
return v;
}
std::string FileSystem::fileName(const std::string& path)
@@ -168,38 +227,3 @@ bool FileSystem::equivalent(const std::string& pathA, const std::string& pathB)
return boost::filesystem::path(pathA).compare(boost::filesystem::path(pathB)) == 0;
}
void FileSystem::createDirectory(const FilePath& path)
{
boost::filesystem::create_directories(path.str());
}
bool FileSystem::copy_directory(const FilePath& from, const FilePath& to)
{
if(!from.exists() || to.exists())
{
return false;
}
boost::filesystem::copy_directory(boost::filesystem::path(from.str()),boost::filesystem::path(to.str()));
return true;
}
std::vector<FilePath> FileSystem::getSubDirectories(const FilePath &path)
{
std::vector<FilePath> v;
if (!path.exists())
{
return v;
}
for (boost::filesystem::recursive_directory_iterator end, dir(path.str()); dir != end; dir++)
{
if (boost::filesystem::is_directory(dir->path()))
{
v.push_back(FilePath(dir->path()));
}
}
return v;
}
+7 -4
View File
@@ -23,15 +23,18 @@ public:
static TimePoint getLastWriteTime(const FilePath& filePath);
static std::string getTimeStringNow();
static bool exists(const FilePath& path);
static bool remove(const FilePath& path);
static bool rename(const FilePath& from, const FilePath& to);
static bool copyFile(const FilePath& from, const FilePath& to);
static bool copy_directory(const FilePath& from, const FilePath& to);
static void createDirectory(const FilePath& path);
static std::vector<FilePath> getSubDirectories(const FilePath& path);
static bool exists(const std::string& path);
static std::string fileName(const std::string& path);
static std::string absoluteFilePath(const std::string& path);
static bool remove(const std::string& path);
static bool copy_directory(const FilePath& from, const FilePath& to);
static std::string extension(const std::string& path);
static std::string filePathWithoutExtension(const std::string& path);
+7 -7
View File
@@ -13,21 +13,21 @@
{ \
LogManager::getInstance()->logInfo(__str__, __FILE__, __FUNCTION__, __LINE__); \
} \
while(0) \
while(0)
#define LOG_WARNING(__str__) \
do \
{ \
LogManager::getInstance()->logWarning(__str__, __FILE__, __FUNCTION__, __LINE__); \
} \
while(0) \
while(0)
#define LOG_ERROR(__str__) \
do \
{ \
LogManager::getInstance()->logError(__str__, __FILE__, __FUNCTION__, __LINE__); \
} \
while(0) \
while(0)
#define LOG_INFO_STREAM(__s__) \
do \
@@ -36,7 +36,7 @@
__ss__ __s__; \
LogManager::getInstance()->logInfo(__ss__.str(), __FILE__, __FUNCTION__, __LINE__); \
} \
while(0) \
while(0)
#define LOG_WARNING_STREAM(__s__) \
do \
@@ -45,7 +45,7 @@
__ss__ __s__; \
LogManager::getInstance()->logWarning(__ss__.str(), __FILE__, __FUNCTION__, __LINE__); \
} \
while(0) \
while(0)
#define LOG_ERROR_STREAM(__s__) \
do \
@@ -54,7 +54,7 @@
__ss__ __s__; \
LogManager::getInstance()->logError(__ss__.str(), __FILE__, __FUNCTION__, __LINE__); \
} \
while(0) \
while(0)
#define LOG_INFO_STREAM_BARE(__s__) \
do \
@@ -63,6 +63,6 @@
__ss__ __s__; \
LogManager::getInstance()->logInfo(__ss__.str(), "", "", 0); \
} \
while(0) \
while(0)
#endif // LOGGING_H
-12
View File
@@ -11,7 +11,6 @@ public:
: m_isReplayed(false)
, m_sendAsTask(true)
, m_keepContent(false)
, m_cancelled(false)
, m_isLast(true)
, m_isLogged(true)
{
@@ -74,16 +73,6 @@ public:
return m_keepContent;
}
void cancel()
{
m_cancelled = true;
}
bool cancelled()
{
return m_cancelled;
}
virtual void print(std::ostream& os) const = 0;
std::string str() const
@@ -98,7 +87,6 @@ private:
bool m_isReplayed;
bool m_sendAsTask;
bool m_keepContent;
bool m_cancelled;
bool m_isLast;
bool m_isLogged;
};
+1 -6
View File
@@ -253,11 +253,6 @@ void MessageQueue::sendMessage(std::shared_ptr<MessageBase> message)
listener->handleMessageBase(message.get());
m_listenersMutex.lock();
}
if (message->cancelled())
{
break;
}
}
}
@@ -277,7 +272,7 @@ void MessageQueue::sendMessageAsTask(std::shared_ptr<MessageBase> message, bool
[listenerId, message]()
{
MessageListenerBase* listener = MessageQueue::getInstance()->getListenerById(listenerId);
if (listener && !message->cancelled())
if (listener)
{
listener->handleMessageBase(message.get());
}
@@ -1,11 +1,10 @@
#ifndef MESSAGE_CHANGE_FILE_VIEW_H
#define MESSAGE_CHANGE_FILE_VIEW_H
#include "utility/file/FilePath.h"
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "data/location/TokenLocationFile.h"
class MessageChangeFileView
: public Message<MessageChangeFileView>
{
@@ -21,14 +20,12 @@ public:
const FilePath filePath,
FileState state,
bool needsData,
bool showErrors,
std::shared_ptr<TokenLocationFile> locationFile
bool showErrors
)
: filePath(filePath)
, state(state)
, needsData(needsData)
, showErrors(showErrors)
, locationFile(locationFile)
{
}
@@ -57,8 +54,6 @@ public:
bool needsData;
bool showErrors;
std::shared_ptr<TokenLocationFile> locationFile;
};
#endif // MESSAGE_CHANGE_FILE_VIEW_H
@@ -0,0 +1,20 @@
#ifndef MESSAGE_COLOR_SCHEME_TEST_H
#define MESSAGE_COLOR_SCHEME_TEST_H
#include "utility/messaging/Message.h"
class MessageColorSchemeTest
: public Message<MessageColorSchemeTest>
{
public:
MessageColorSchemeTest()
{
}
static const std::string getStaticType()
{
return "MessageColorSchemeTest";
}
};
#endif // MESSAGE_COLOR_SCHEME_TEST_H
+6 -2
View File
@@ -4,10 +4,12 @@
#include "utility/messaging/Message.h"
#include "utility/types.h"
class MessageFind: public Message<MessageFind>
class MessageFind
: public Message<MessageFind>
{
public:
MessageFind()
MessageFind(bool fulltext = false)
: findFulltext(fulltext)
{
}
@@ -15,6 +17,8 @@ public:
{
return "MessageFind";
}
bool findFulltext;
};
#endif // MESSAGE_FIND_H

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