From 078feca0044f48d0a18685cfb83a1e21085d0f74 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Mon, 18 Nov 2019 17:07:20 +0100 Subject: [PATCH] src: applied clang-format --- src/lib/app/Application.cpp | 62 +- src/lib/app/Application.h | 9 +- src/lib/app/LanguagePackage.h | 2 +- src/lib/app/LanguagePackageManager.cpp | 4 +- src/lib/app/LanguagePackageManager.h | 2 +- src/lib/app/UpdateChecker.h | 2 +- src/lib/app/paths/AppPath.cpp | 2 +- src/lib/app/paths/AppPath.h | 2 +- src/lib/app/paths/ResourcePaths.h | 2 +- src/lib/app/paths/UserPaths.h | 2 +- src/lib/component/Component.cpp | 6 +- src/lib/component/Component.h | 2 +- src/lib/component/ComponentFactory.cpp | 17 +- src/lib/component/ComponentFactory.h | 5 +- src/lib/component/ComponentManager.cpp | 97 +- src/lib/component/ComponentManager.h | 2 +- src/lib/component/NetworkFactory.cpp | 8 +- src/lib/component/NetworkFactory.h | 5 +- src/lib/component/Tab.cpp | 8 +- src/lib/component/Tab.h | 7 +- src/lib/component/TabId.h | 2 +- .../controller/ActivationController.cpp | 71 +- .../controller/ActivationController.h | 6 +- .../controller/BookmarkController.cpp | 81 +- .../component/controller/BookmarkController.h | 22 +- .../component/controller/CodeController.cpp | 549 ++-- src/lib/component/controller/CodeController.h | 37 +- src/lib/component/controller/Controller.cpp | 11 +- src/lib/component/controller/Controller.h | 4 +- .../controller/CustomTrailController.cpp | 8 +- .../controller/CustomTrailController.h | 6 +- .../component/controller/ErrorController.cpp | 17 +- .../component/controller/ErrorController.h | 6 +- .../component/controller/GraphController.cpp | 702 ++--- .../component/controller/GraphController.h | 21 +- .../controller/IDECommunicationController.cpp | 68 +- .../controller/IDECommunicationController.h | 6 +- .../controller/RefreshController.cpp | 12 +- .../component/controller/RefreshController.h | 5 +- .../controller/ScreenSearchController.cpp | 8 +- .../controller/ScreenSearchController.h | 2 +- .../component/controller/SearchController.cpp | 10 +- .../component/controller/SearchController.h | 4 +- .../controller/StatusBarController.cpp | 4 +- .../controller/StatusBarController.h | 4 +- .../component/controller/StatusController.cpp | 12 +- .../component/controller/StatusController.h | 4 +- .../component/controller/TabsController.cpp | 49 +- src/lib/component/controller/TabsController.h | 7 +- .../controller/TooltipController.cpp | 50 +- .../component/controller/TooltipController.h | 22 +- .../controller/UndoRedoController.cpp | 86 +- .../component/controller/UndoRedoController.h | 6 +- .../controller/helper/ActivationListener.cpp | 8 +- .../controller/helper/ActivationListener.h | 4 +- .../controller/helper/BucketLayouter.cpp | 95 +- .../controller/helper/BucketLayouter.h | 2 +- .../controller/helper/ControllerProxy.h | 25 +- .../component/controller/helper/DummyEdge.h | 4 +- .../component/controller/helper/DummyNode.h | 87 +- .../controller/helper/ListLayouter.cpp | 29 +- .../controller/helper/ListLayouter.h | 11 +- .../helper/NetworkProtocolHelper.cpp | 40 +- .../controller/helper/NetworkProtocolHelper.h | 23 +- .../helper/ScreenSearchInterfaces.h | 2 +- .../controller/helper/SnippetMerger.cpp | 40 +- .../controller/helper/SnippetMerger.h | 21 +- .../controller/helper/TrailLayouter.cpp | 98 +- .../controller/helper/TrailLayouter.h | 2 +- .../component/view/BookmarkButtonsView.cpp | 4 +- src/lib/component/view/BookmarkButtonsView.h | 2 +- src/lib/component/view/BookmarkView.cpp | 5 +- src/lib/component/view/BookmarkView.h | 9 +- src/lib/component/view/CodeView.cpp | 9 +- src/lib/component/view/CodeView.h | 10 +- src/lib/component/view/CompositeView.cpp | 16 +- src/lib/component/view/CompositeView.h | 2 +- src/lib/component/view/CustomTrailView.h | 10 +- src/lib/component/view/DialogView.cpp | 46 +- src/lib/component/view/DialogView.h | 34 +- src/lib/component/view/ErrorView.cpp | 9 +- src/lib/component/view/ErrorView.h | 10 +- src/lib/component/view/GraphView.cpp | 9 +- src/lib/component/view/GraphView.h | 4 +- src/lib/component/view/GraphViewStyle.cpp | 54 +- src/lib/component/view/GraphViewStyle.h | 17 +- src/lib/component/view/GraphViewStyleImpl.h | 4 +- src/lib/component/view/MainView.h | 5 +- src/lib/component/view/RefreshView.cpp | 9 +- src/lib/component/view/RefreshView.h | 5 +- src/lib/component/view/ScreenSearchView.cpp | 9 +- src/lib/component/view/ScreenSearchView.h | 5 +- src/lib/component/view/SearchView.cpp | 9 +- src/lib/component/view/SearchView.h | 7 +- src/lib/component/view/StatusBarView.cpp | 5 +- src/lib/component/view/StatusBarView.h | 7 +- src/lib/component/view/StatusView.cpp | 10 +- src/lib/component/view/StatusView.h | 7 +- src/lib/component/view/TabbedView.cpp | 3 +- src/lib/component/view/TabbedView.h | 2 +- src/lib/component/view/TabsView.cpp | 5 +- src/lib/component/view/TabsView.h | 5 +- src/lib/component/view/TooltipView.cpp | 9 +- src/lib/component/view/TooltipView.h | 7 +- src/lib/component/view/UndoRedoView.cpp | 9 +- src/lib/component/view/UndoRedoView.h | 4 +- src/lib/component/view/View.cpp | 4 +- src/lib/component/view/View.h | 14 +- src/lib/component/view/ViewFactory.h | 12 +- src/lib/component/view/ViewLayout.cpp | 8 +- src/lib/component/view/ViewLayout.h | 2 +- src/lib/component/view/ViewWidgetWrapper.cpp | 8 +- src/lib/component/view/ViewWidgetWrapper.h | 2 +- .../component/view/helper/CodeScrollParams.h | 24 +- .../view/helper/CodeSnippetParams.cpp | 18 +- .../component/view/helper/CodeSnippetParams.h | 4 +- src/lib/data/DefinitionKind.h | 4 +- src/lib/data/ErrorCountInfo.h | 18 +- src/lib/data/ErrorFilter.h | 17 +- src/lib/data/ErrorInfo.h | 11 +- src/lib/data/GroupType.cpp | 36 +- src/lib/data/GroupType.h | 2 +- src/lib/data/HierarchyCache.cpp | 36 +- src/lib/data/HierarchyCache.h | 14 +- src/lib/data/NodeType.cpp | 128 +- src/lib/data/NodeType.h | 19 +- src/lib/data/NodeTypeSet.cpp | 49 +- src/lib/data/NodeTypeSet.h | 2 +- src/lib/data/TaskCleanStorage.cpp | 31 +- src/lib/data/TaskCleanStorage.h | 8 +- src/lib/data/TaskFinishParsing.cpp | 19 +- src/lib/data/TaskFinishParsing.h | 5 +- src/lib/data/TaskInjectStorage.cpp | 19 +- src/lib/data/TaskInjectStorage.h | 7 +- src/lib/data/TaskMergeStorages.cpp | 18 +- src/lib/data/TaskMergeStorages.h | 9 +- src/lib/data/bookmark/Bookmark.cpp | 12 +- src/lib/data/bookmark/Bookmark.h | 11 +- src/lib/data/bookmark/BookmarkCategory.cpp | 16 +- src/lib/data/bookmark/BookmarkCategory.h | 2 +- src/lib/data/bookmark/EdgeBookmark.cpp | 12 +- src/lib/data/bookmark/EdgeBookmark.h | 13 +- src/lib/data/bookmark/NodeBookmark.cpp | 13 +- src/lib/data/bookmark/NodeBookmark.h | 13 +- .../fulltextsearch/FullTextSearchIndex.cpp | 5 +- .../data/fulltextsearch/FullTextSearchIndex.h | 10 +- src/lib/data/fulltextsearch/SuffixArray.cpp | 40 +- src/lib/data/fulltextsearch/SuffixArray.h | 8 +- src/lib/data/graph/Edge.cpp | 14 +- src/lib/data/graph/Edge.h | 36 +- src/lib/data/graph/ElementComponentKind.cpp | 6 +- src/lib/data/graph/ElementComponentKind.h | 2 +- src/lib/data/graph/Graph.cpp | 94 +- src/lib/data/graph/Graph.h | 4 +- src/lib/data/graph/Node.cpp | 93 +- src/lib/data/graph/Node.h | 7 +- src/lib/data/graph/Token.cpp | 12 +- src/lib/data/graph/Token.h | 4 +- .../graph/token_component/TokenComponent.cpp | 4 +- .../graph/token_component/TokenComponent.h | 2 +- .../TokenComponentAbstraction.cpp | 4 +- .../TokenComponentAbstraction.h | 5 +- .../token_component/TokenComponentAccess.cpp | 9 +- .../token_component/TokenComponentAccess.h | 7 +- .../TokenComponentAggregation.cpp | 13 +- .../TokenComponentAggregation.h | 5 +- .../token_component/TokenComponentConst.h | 5 +- .../TokenComponentFilePath.cpp | 7 +- .../token_component/TokenComponentFilePath.h | 5 +- .../TokenComponentInheritanceChain.h | 5 +- .../TokenComponentIsAmbiguous.h | 5 +- .../token_component/TokenComponentStatic.h | 5 +- .../CombinedIndexerCommandProvider.cpp | 19 +- .../indexer/CombinedIndexerCommandProvider.h | 5 +- src/lib/data/indexer/Indexer.h | 17 +- src/lib/data/indexer/IndexerBase.cpp | 4 +- src/lib/data/indexer/IndexerBase.h | 5 +- src/lib/data/indexer/IndexerCommand.cpp | 14 +- src/lib/data/indexer/IndexerCommand.h | 7 +- src/lib/data/indexer/IndexerCommandCustom.cpp | 15 +- src/lib/data/indexer/IndexerCommandCustom.h | 7 +- src/lib/data/indexer/IndexerCommandProvider.h | 4 +- src/lib/data/indexer/IndexerCommandType.cpp | 27 +- src/lib/data/indexer/IndexerCommandType.h | 8 +- src/lib/data/indexer/IndexerComposite.cpp | 10 +- src/lib/data/indexer/IndexerComposite.h | 2 +- src/lib/data/indexer/IndexerStateInfo.h | 2 +- .../indexer/MemoryIndexerCommandProvider.cpp | 16 +- .../indexer/MemoryIndexerCommandProvider.h | 4 +- src/lib/data/indexer/TaskBuildIndex.cpp | 75 +- src/lib/data/indexer/TaskBuildIndex.h | 13 +- .../indexer/TaskExecuteCustomCommands.cpp | 114 +- .../data/indexer/TaskExecuteCustomCommands.h | 9 +- .../indexer/TaskFillIndexerCommandQueue.cpp | 21 +- .../indexer/TaskFillIndexerCommandQueue.h | 7 +- .../BaseInterprocessDataManager.cpp | 8 +- .../BaseInterprocessDataManager.h | 4 +- .../interprocess/InterprocessIndexer.cpp | 27 +- .../interprocess/InterprocessIndexer.h | 2 +- .../InterprocessIndexerCommandManager.cpp | 26 +- .../InterprocessIndexerCommandManager.h | 5 +- .../InterprocessIndexingStatusManager.cpp | 57 +- .../InterprocessIndexingStatusManager.h | 7 +- ...InterprocessIntermediateStorageManager.cpp | 41 +- .../InterprocessIntermediateStorageManager.h | 5 +- .../shared_types/SharedIndexerCommand.cpp | 42 +- .../shared_types/SharedIndexerCommand.h | 14 +- .../SharedIntermediateStorage.cpp | 21 +- .../shared_types/SharedIntermediateStorage.h | 4 +- .../shared_types/SharedStorageTypes.h | 99 +- src/lib/data/location/LocationType.h | 2 +- src/lib/data/location/SourceLocation.cpp | 16 +- src/lib/data/location/SourceLocation.h | 12 +- .../location/SourceLocationCollection.cpp | 81 +- .../data/location/SourceLocationCollection.h | 19 +- src/lib/data/location/SourceLocationFile.cpp | 99 +- src/lib/data/location/SourceLocationFile.h | 27 +- src/lib/data/name/NameDelimiterType.cpp | 5 +- src/lib/data/name/NameDelimiterType.h | 2 +- src/lib/data/name/NameElement.cpp | 21 +- src/lib/data/name/NameElement.h | 2 +- src/lib/data/name/NameHierarchy.cpp | 48 +- src/lib/data/name/NameHierarchy.h | 2 +- src/lib/data/parser/AccessKind.cpp | 1 - src/lib/data/parser/AccessKind.h | 4 +- src/lib/data/parser/ParseLocation.cpp | 19 +- src/lib/data/parser/ParseLocation.h | 15 +- src/lib/data/parser/Parser.cpp | 5 +- src/lib/data/parser/Parser.h | 2 +- src/lib/data/parser/ParserClient.h | 14 +- src/lib/data/parser/ParserClientImpl.cpp | 37 +- src/lib/data/parser/ParserClientImpl.h | 20 +- src/lib/data/parser/ReferenceKind.h | 4 +- src/lib/data/parser/SymbolKind.h | 4 +- src/lib/data/parser/TaskParseWrapper.cpp | 13 +- src/lib/data/parser/TaskParseWrapper.h | 7 +- src/lib/data/search/SearchIndex.cpp | 103 +- src/lib/data/search/SearchIndex.h | 45 +- src/lib/data/search/SearchMatch.cpp | 14 +- src/lib/data/search/SearchMatch.h | 2 +- src/lib/data/storage/IntermediateStorage.cpp | 22 +- src/lib/data/storage/IntermediateStorage.h | 11 +- src/lib/data/storage/PersistentStorage.cpp | 1146 ++++---- src/lib/data/storage/PersistentStorage.h | 77 +- src/lib/data/storage/Storage.cpp | 22 +- src/lib/data/storage/Storage.h | 4 +- src/lib/data/storage/StorageAccess.h | 63 +- src/lib/data/storage/StorageAccessProxy.cpp | 283 +- src/lib/data/storage/StorageAccessProxy.h | 43 +- src/lib/data/storage/StorageCache.cpp | 39 +- src/lib/data/storage/StorageCache.h | 14 +- src/lib/data/storage/StorageProvider.cpp | 3 - src/lib/data/storage/StorageProvider.h | 8 +- src/lib/data/storage/StorageStats.h | 12 +- .../migration/SqliteStorageMigration.cpp | 7 +- .../migration/SqliteStorageMigration.h | 4 +- .../SqliteStorageMigrationLambda.cpp | 7 +- .../migration/SqliteStorageMigrationLambda.h | 5 +- .../storage/migration/SqliteStorageMigrator.h | 2 +- .../storage/sqlite/SqliteBookmarkStorage.cpp | 251 +- .../storage/sqlite/SqliteBookmarkStorage.h | 24 +- .../storage/sqlite/SqliteDatabaseIndex.cpp | 12 +- .../data/storage/sqlite/SqliteDatabaseIndex.h | 4 +- .../storage/sqlite/SqliteIndexStorage.cpp | 747 +++--- .../data/storage/sqlite/SqliteIndexStorage.h | 79 +- src/lib/data/storage/sqlite/SqliteStorage.cpp | 35 +- src/lib/data/storage/sqlite/SqliteStorage.h | 4 +- src/lib/data/storage/type/StorageBookmark.h | 39 +- .../storage/type/StorageBookmarkCategory.h | 27 +- .../data/storage/type/StorageBookmarkedEdge.h | 35 +- .../data/storage/type/StorageBookmarkedNode.h | 36 +- .../storage/type/StorageComponentAccess.h | 12 +- src/lib/data/storage/type/StorageEdge.h | 31 +- .../storage/type/StorageElementComponent.h | 15 +- src/lib/data/storage/type/StorageError.h | 49 +- src/lib/data/storage/type/StorageFile.h | 16 +- .../data/storage/type/StorageLocalSymbol.h | 26 +- src/lib/data/storage/type/StorageNode.h | 29 +- src/lib/data/storage/type/StorageOccurrence.h | 13 +- .../data/storage/type/StorageSourceLocation.h | 38 +- src/lib/data/storage/type/StorageSymbol.h | 12 +- src/lib/data/tooltip/TooltipInfo.h | 2 +- src/lib/data/tooltip/TooltipOrigin.h | 2 +- src/lib/project/Project.cpp | 467 ++-- src/lib/project/Project.h | 15 +- src/lib/project/RefreshInfo.h | 2 +- src/lib/project/RefreshInfoGenerator.cpp | 89 +- src/lib/project/RefreshInfoGenerator.h | 18 +- src/lib/project/SourceGroup.cpp | 14 +- src/lib/project/SourceGroup.h | 14 +- src/lib/project/SourceGroupCustomCommand.cpp | 21 +- src/lib/project/SourceGroupCustomCommand.h | 4 +- src/lib/project/SourceGroupFactory.cpp | 10 +- src/lib/project/SourceGroupFactory.h | 5 +- src/lib/project/SourceGroupFactoryModule.cpp | 4 +- src/lib/project/SourceGroupFactoryModule.h | 5 +- .../SourceGroupFactoryModuleCustom.cpp | 6 +- .../project/SourceGroupFactoryModuleCustom.h | 8 +- src/lib/settings/ApplicationSettings.cpp | 156 +- src/lib/settings/ApplicationSettings.h | 5 +- .../settings/ApplicationSettingsPrefiller.cpp | 26 +- .../settings/ApplicationSettingsPrefiller.h | 2 +- src/lib/settings/ColorScheme.cpp | 41 +- src/lib/settings/ColorScheme.h | 16 +- src/lib/settings/LanguageType.cpp | 19 +- src/lib/settings/LanguageType.h | 8 +- src/lib/settings/ProjectSettings.cpp | 287 +- src/lib/settings/ProjectSettings.h | 7 +- src/lib/settings/Settings.cpp | 13 +- src/lib/settings/Settings.h | 24 +- .../settings/migration/SettingsMigration.cpp | 4 +- .../settings/migration/SettingsMigration.h | 19 +- .../migration/SettingsMigrationDeleteKey.cpp | 9 +- .../migration/SettingsMigrationDeleteKey.h | 2 +- .../migration/SettingsMigrationLambda.cpp | 7 +- .../migration/SettingsMigrationLambda.h | 2 +- .../migration/SettingsMigrationMoveKey.cpp | 10 +- .../migration/SettingsMigrationMoveKey.h | 2 +- src/lib/settings/migration/SettingsMigrator.h | 2 +- .../source_group/SourceGroupSettings.cpp | 17 +- .../source_group/SourceGroupSettings.h | 8 +- .../source_group/SourceGroupSettingsBase.h | 2 +- .../SourceGroupSettingsWithComponents.h | 13 +- .../source_group/SourceGroupStatusType.cpp | 10 +- .../source_group/SourceGroupStatusType.h | 2 +- .../settings/source_group/SourceGroupType.cpp | 18 +- .../settings/source_group/SourceGroupType.h | 8 +- .../component/SourceGroupSettingsComponent.h | 5 +- .../SourceGroupSettingsWithCustomCommand.cpp | 5 +- .../SourceGroupSettingsWithCustomCommand.h | 5 +- .../SourceGroupSettingsWithExcludeFilters.cpp | 50 +- .../SourceGroupSettingsWithExcludeFilters.h | 8 +- ...ourceGroupSettingsWithSourceExtensions.cpp | 11 +- .../SourceGroupSettingsWithSourceExtensions.h | 5 +- ...ceGroupSettingsWithSourceExtensionsEmpty.h | 5 +- .../SourceGroupSettingsWithSourcePaths.cpp | 11 +- .../SourceGroupSettingsWithSourcePaths.h | 5 +- .../cxx/SourceGroupSettingsWithCStandard.cpp | 11 +- .../cxx/SourceGroupSettingsWithCStandard.h | 5 +- .../SourceGroupSettingsWithCppStandard.cpp | 11 +- .../cxx/SourceGroupSettingsWithCppStandard.h | 5 +- .../cxx/SourceGroupSettingsWithCxxCdbPath.cpp | 11 +- .../cxx/SourceGroupSettingsWithCxxCdbPath.h | 5 +- ...urceGroupSettingsWithCxxCodeblocksPath.cpp | 14 +- ...SourceGroupSettingsWithCxxCodeblocksPath.h | 5 +- ...SettingsWithCxxCrossCompilationOptions.cpp | 76 +- ...upSettingsWithCxxCrossCompilationOptions.h | 5 +- ...ourceGroupSettingsWithCxxPathsAndFlags.cpp | 27 +- .../SourceGroupSettingsWithCxxPathsAndFlags.h | 5 +- .../SourceGroupSettingsWithCxxPchOptions.cpp | 12 +- .../SourceGroupSettingsWithCxxPchOptions.h | 5 +- ...rceGroupSettingsWithIndexedHeaderPaths.cpp | 11 +- ...ourceGroupSettingsWithIndexedHeaderPaths.h | 5 +- ...SourceGroupSettingsWithSourceExtensionsC.h | 7 +- ...urceGroupSettingsWithSourceExtensionsCpp.h | 11 +- ...urceGroupSettingsWithSourceExtensionsCxx.h | 12 +- .../java/SourceGroupSettingsWithClasspath.cpp | 12 +- .../java/SourceGroupSettingsWithClasspath.h | 5 +- .../SourceGroupSettingsWithJavaGradle.cpp | 15 +- .../java/SourceGroupSettingsWithJavaGradle.h | 5 +- .../java/SourceGroupSettingsWithJavaMaven.cpp | 15 +- .../java/SourceGroupSettingsWithJavaMaven.h | 5 +- .../SourceGroupSettingsWithJavaStandard.cpp | 8 +- .../SourceGroupSettingsWithJavaStandard.h | 5 +- ...rceGroupSettingsWithSourceExtensionsJava.h | 7 +- ...GroupSettingsWithPythonEnvironmentPath.cpp | 11 +- ...ceGroupSettingsWithPythonEnvironmentPath.h | 5 +- ...eGroupSettingsWithSourceExtensionsPython.h | 7 +- .../type/SourceGroupSettingsCEmpty.h | 18 +- .../type/SourceGroupSettingsCppEmpty.h | 34 +- .../type/SourceGroupSettingsCustomCommand.h | 10 +- .../type/SourceGroupSettingsCxxCdb.h | 12 +- .../type/SourceGroupSettingsCxxCdbVs.h | 5 +- .../type/SourceGroupSettingsCxxCodeblocks.h | 18 +- .../type/SourceGroupSettingsJavaEmpty.h | 14 +- .../type/SourceGroupSettingsJavaGradle.h | 10 +- .../type/SourceGroupSettingsJavaMaven.h | 10 +- .../type/SourceGroupSettingsPythonEmpty.h | 10 +- .../type/SourceGroupSettingsUnloadable.h | 16 +- src/lib/utility/ApplicationArchitectureType.h | 2 +- src/lib/utility/ConfigManager.cpp | 61 +- src/lib/utility/ConfigManager.h | 10 +- src/lib/utility/LowMemoryStringMap.h | 110 +- src/lib/utility/Optional.h | 9 +- src/lib/utility/OrderedCache.h | 6 +- src/lib/utility/OsType.h | 2 +- src/lib/utility/Property.h | 21 +- src/lib/utility/ScopedFunctor.cpp | 10 +- src/lib/utility/ScopedFunctor.h | 2 +- src/lib/utility/ScopedSwitcher.h | 13 +- src/lib/utility/SingleValueCache.h | 5 +- src/lib/utility/Status.h | 5 +- src/lib/utility/TimeStamp.cpp | 34 +- src/lib/utility/TimeStamp.h | 35 +- src/lib/utility/Tree.h | 4 +- src/lib/utility/UnorderedCache.h | 6 +- src/lib/utility/Version.cpp | 52 +- src/lib/utility/Version.h | 2 +- .../utility/commandline/CommandLineParser.cpp | 51 +- .../utility/commandline/CommandLineParser.h | 12 +- .../utility/commandline/CommandlineHelper.cpp | 12 +- .../utility/commandline/CommandlineHelper.h | 24 +- .../commands/CommandlineCommand.cpp | 16 +- .../commandline/commands/CommandlineCommand.h | 14 +- .../commands/CommandlineCommandConfig.cpp | 124 +- .../commands/CommandlineCommandConfig.h | 13 +- .../commands/CommandlineCommandIndex.cpp | 24 +- .../commands/CommandlineCommandIndex.h | 16 +- src/lib/utility/file/FileInfo.cpp | 13 +- src/lib/utility/file/FileInfo.h | 2 +- src/lib/utility/file/FileManager.cpp | 19 +- src/lib/utility/file/FileManager.h | 5 +- src/lib/utility/file/FilePath.cpp | 26 +- src/lib/utility/file/FilePath.h | 12 +- src/lib/utility/file/FilePathFilter.cpp | 3 +- src/lib/utility/file/FilePathFilter.h | 2 +- src/lib/utility/file/FileRegister.cpp | 72 +- src/lib/utility/file/FileRegister.h | 5 +- src/lib/utility/file/FileSystem.cpp | 43 +- src/lib/utility/file/FileSystem.h | 6 +- src/lib/utility/file/FileTree.cpp | 20 +- src/lib/utility/file/FileTree.h | 7 +- src/lib/utility/file/utilityFile.cpp | 44 +- src/lib/utility/file/utilityFile.h | 23 +- src/lib/utility/interprocess/SharedMemory.cpp | 95 +- src/lib/utility/interprocess/SharedMemory.h | 16 +- .../SharedMemoryGarbageCollector.cpp | 66 +- .../SharedMemoryGarbageCollector.h | 4 +- src/lib/utility/logging/ConsoleLogger.cpp | 8 +- src/lib/utility/logging/ConsoleLogger.h | 7 +- src/lib/utility/logging/FileLogger.cpp | 13 +- src/lib/utility/logging/FileLogger.h | 7 +- src/lib/utility/logging/LogManager.cpp | 38 +- src/lib/utility/logging/LogManager.h | 22 +- .../logging/LogManagerImplementation.cpp | 36 +- .../logging/LogManagerImplementation.h | 13 +- src/lib/utility/logging/LogMessage.h | 8 +- src/lib/utility/logging/Logger.cpp | 6 +- src/lib/utility/logging/Logger.h | 10 +- src/lib/utility/logging/logging.h | 196 +- src/lib/utility/math/Color.h | 32 +- src/lib/utility/math/MatrixBase.h | 235 +- src/lib/utility/math/MatrixDynamicBase.h | 48 +- src/lib/utility/math/Vector2.h | 34 +- src/lib/utility/math/Vector4.h | 48 +- src/lib/utility/math/VectorBase.h | 168 +- src/lib/utility/messaging/Message.h | 17 +- src/lib/utility/messaging/MessageBase.h | 2 +- src/lib/utility/messaging/MessageFilter.h | 2 +- src/lib/utility/messaging/MessageListener.h | 11 +- .../utility/messaging/MessageListenerBase.h | 6 +- src/lib/utility/messaging/MessageQueue.cpp | 39 +- src/lib/utility/messaging/MessageQueue.h | 2 +- .../MessageFilterErrorCountUpdate.h | 16 +- .../filter_types/MessageFilterFocusInOut.h | 8 +- .../MessageFilterSearchAutocomplete.h | 5 +- .../messaging/type/MessageActivateWindow.h | 9 +- .../messaging/type/MessageClearStatusView.h | 9 +- .../messaging/type/MessageCloseProject.h | 13 +- .../messaging/type/MessageFlushUpdates.h | 5 +- .../utility/messaging/type/MessageFocusIn.h | 10 +- .../utility/messaging/type/MessageFocusOut.h | 10 +- .../messaging/type/MessageLoadProject.h | 8 +- .../messaging/type/MessageLogFilterChanged.h | 12 +- .../messaging/type/MessageProjectEdit.h | 9 +- .../messaging/type/MessageProjectNew.h | 10 +- .../messaging/type/MessageQuitApplication.h | 9 +- .../utility/messaging/type/MessageRefresh.h | 10 +- .../utility/messaging/type/MessageRefreshUI.h | 11 +- .../utility/messaging/type/MessageResetZoom.h | 9 +- .../messaging/type/MessageScrollSpeedChange.h | 10 +- .../messaging/type/MessageShowStatus.h | 9 +- .../utility/messaging/type/MessageStatus.cpp | 18 +- .../utility/messaging/type/MessageStatus.h | 17 +- .../type/MessageStatusFilterChanged.h | 10 +- .../messaging/type/MessageSwitchColorScheme.h | 10 +- .../messaging/type/MessageTooltipHide.h | 5 +- .../messaging/type/MessageTooltipShow.h | 20 +- .../messaging/type/MessageWindowClosed.h | 5 +- .../messaging/type/MessageWindowFocus.h | 10 +- src/lib/utility/messaging/type/MessageZoom.h | 10 +- .../type/activation/MessageActivateBase.h | 2 +- .../type/activation/MessageActivateErrors.h | 7 +- .../MessageActivateFullTextSearch.h | 7 +- .../type/activation/MessageActivateLegend.h | 4 +- .../type/activation/MessageActivateOverview.h | 4 +- .../type/activation/MessageActivateTokens.h | 16 +- .../type/activation/MessageActivateTrail.h | 8 +- .../type/bookmark/MessageBookmarkActivate.h | 10 +- .../type/bookmark/MessageBookmarkBrowse.h | 11 +- .../bookmark/MessageBookmarkButtonState.h | 8 +- .../type/bookmark/MessageBookmarkCreate.h | 10 +- .../type/bookmark/MessageBookmarkDelete.h | 5 +- .../type/bookmark/MessageBookmarkEdit.h | 5 +- .../messaging/type/code/MessageActivateFile.h | 10 +- .../type/code/MessageActivateLocalSymbols.h | 12 +- .../code/MessageActivateSourceLocations.h | 10 +- .../type/code/MessageActivateTokenIds.h | 10 +- .../type/code/MessageChangeFileView.h | 32 +- .../type/code/MessageCodeReference.h | 8 +- .../type/code/MessageCodeShowDefinition.h | 9 +- .../messaging/type/code/MessageScrollCode.h | 9 +- .../messaging/type/code/MessageScrollToLine.h | 9 +- .../type/code/MessageShowReference.h | 10 +- .../messaging/type/code/MessageShowScope.h | 10 +- .../custom_trail/MessageCustomTrailShow.h | 9 +- .../type/error/MessageErrorCountClear.h | 5 +- .../type/error/MessageErrorCountUpdate.h | 11 +- .../messaging/type/error/MessageErrorsAll.h | 9 +- .../type/error/MessageErrorsForFile.h | 10 +- .../type/error/MessageErrorsHelpMessage.h | 10 +- .../messaging/type/error/MessageShowError.h | 8 +- .../type/graph/MessageActivateEdge.h | 13 +- .../type/graph/MessageActivateNodes.h | 12 +- .../type/graph/MessageActivateTrailEdge.h | 14 +- .../type/graph/MessageDeactivateEdge.h | 8 +- .../type/graph/MessageGraphNodeBundleSplit.h | 9 +- .../type/graph/MessageGraphNodeExpand.h | 11 +- .../type/graph/MessageGraphNodeHide.h | 8 +- .../type/graph/MessageGraphNodeMove.h | 11 +- .../messaging/type/graph/MessageScrollGraph.h | 9 +- .../type/history/MessageHistoryRedo.h | 5 +- .../type/history/MessageHistoryToPosition.h | 8 +- .../type/history/MessageHistoryUndo.h | 5 +- .../type/indexing/MessageIndexingFinished.h | 9 +- .../indexing/MessageIndexingInterrupted.h | 5 +- .../type/indexing/MessageIndexingShowDialog.h | 5 +- .../type/indexing/MessageIndexingStarted.h | 9 +- .../type/indexing/MessageIndexingStatus.h | 8 +- .../type/plugin/MessageIDECreateCDB.h | 8 +- .../type/plugin/MessageMoveIDECursor.h | 8 +- .../type/plugin/MessagePingReceived.h | 10 +- .../type/plugin/MessagePluginPortChange.h | 9 +- .../messaging/type/search/MessageFind.h | 8 +- .../messaging/type/search/MessageSearch.h | 12 +- .../type/search/MessageSearchAutocomplete.h | 10 +- .../messaging/type/tab/MessageTabClose.h | 5 +- .../messaging/type/tab/MessageTabOpen.h | 5 +- .../messaging/type/tab/MessageTabOpenWith.h | 22 +- .../messaging/type/tab/MessageTabSelect.h | 10 +- .../messaging/type/tab/MessageTabState.h | 8 +- src/lib/utility/migration/Migration.h | 2 +- src/lib/utility/migration/Migrator.h | 5 +- src/lib/utility/scheduling/Blackboard.cpp | 9 +- src/lib/utility/scheduling/Blackboard.h | 21 +- src/lib/utility/scheduling/Task.cpp | 4 +- src/lib/utility/scheduling/Task.h | 4 +- src/lib/utility/scheduling/TaskDecorator.cpp | 4 +- src/lib/utility/scheduling/TaskDecorator.h | 2 +- .../utility/scheduling/TaskDecoratorDelay.cpp | 8 +- .../utility/scheduling/TaskDecoratorDelay.h | 5 +- .../scheduling/TaskDecoratorRepeat.cpp | 12 +- .../utility/scheduling/TaskDecoratorRepeat.h | 5 +- .../scheduling/TaskFindKeyOnBlackboard.cpp | 17 +- .../scheduling/TaskFindKeyOnBlackboard.h | 5 +- src/lib/utility/scheduling/TaskGroup.cpp | 10 +- src/lib/utility/scheduling/TaskGroup.h | 6 +- .../utility/scheduling/TaskGroupParallel.cpp | 17 +- .../utility/scheduling/TaskGroupParallel.h | 10 +- .../utility/scheduling/TaskGroupSelector.cpp | 9 +- .../utility/scheduling/TaskGroupSelector.h | 5 +- .../utility/scheduling/TaskGroupSequence.cpp | 8 +- .../utility/scheduling/TaskGroupSequence.h | 5 +- src/lib/utility/scheduling/TaskLambda.cpp | 17 +- src/lib/utility/scheduling/TaskLambda.h | 5 +- src/lib/utility/scheduling/TaskManager.h | 2 +- .../utility/scheduling/TaskReturnSuccessIf.h | 14 +- src/lib/utility/scheduling/TaskRunner.cpp | 8 +- src/lib/utility/scheduling/TaskRunner.h | 4 +- src/lib/utility/scheduling/TaskScheduler.cpp | 6 +- src/lib/utility/scheduling/TaskScheduler.h | 4 +- src/lib/utility/scheduling/TaskSetValue.h | 10 +- src/lib/utility/text/TextAccess.cpp | 99 +- src/lib/utility/text/TextAccess.h | 11 +- src/lib/utility/tracing.cpp | 60 +- src/lib/utility/tracing.h | 52 +- src/lib/utility/types.h | 2 +- src/lib/utility/utility.h | 252 +- src/lib/utility/utilityLibrary.h | 133 +- src/lib/utility/utilityUuid.cpp | 28 +- src/lib/utility/utilityUuid.h | 10 +- src/lib/utility/utilityWindows.cpp | 10 +- src/lib/utility/utilityWindows.h | 6 +- src/lib/utility/utilityXml.cpp | 331 +-- src/lib/utility/utilityXml.h | 22 +- src/lib_cxx/LanguagePackageCxx.h | 2 +- .../indexer/CxxIndexerCommandProvider.cpp | 60 +- .../data/indexer/CxxIndexerCommandProvider.h | 7 +- .../data/indexer/IndexerCommandCxx.cpp | 56 +- src/lib_cxx/data/indexer/IndexerCommandCxx.h | 25 +- src/lib_cxx/data/indexer/IndexerCxx.cpp | 12 +- src/lib_cxx/data/indexer/IndexerCxx.h | 5 +- src/lib_cxx/data/parser/cxx/ASTAction.cpp | 19 +- src/lib_cxx/data/parser/cxx/ASTAction.h | 10 +- src/lib_cxx/data/parser/cxx/ASTConsumer.cpp | 11 +- src/lib_cxx/data/parser/cxx/ASTConsumer.h | 8 +- .../parser/cxx/CanonicalFilePathCache.cpp | 12 +- .../data/parser/cxx/CanonicalFilePathCache.h | 3 +- .../data/parser/cxx/ClangInvocationInfo.cpp | 45 +- .../data/parser/cxx/ClangInvocationInfo.h | 13 +- .../data/parser/cxx/CommentHandler.cpp | 17 +- src/lib_cxx/data/parser/cxx/CommentHandler.h | 8 +- src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp | 168 +- src/lib_cxx/data/parser/cxx/CxxAstVisitor.h | 37 +- .../parser/cxx/CxxAstVisitorComponent.cpp | 3 +- .../data/parser/cxx/CxxAstVisitorComponent.h | 65 +- .../CxxAstVisitorComponentBraceRecorder.cpp | 37 +- .../cxx/CxxAstVisitorComponentBraceRecorder.h | 11 +- .../cxx/CxxAstVisitorComponentContext.cpp | 53 +- .../cxx/CxxAstVisitorComponentContext.h | 21 +- .../cxx/CxxAstVisitorComponentDeclRefKind.cpp | 9 +- .../cxx/CxxAstVisitorComponentDeclRefKind.h | 11 +- .../cxx/CxxAstVisitorComponentImplicitCode.h | 8 +- .../cxx/CxxAstVisitorComponentIndexer.cpp | 416 +-- .../cxx/CxxAstVisitorComponentIndexer.h | 16 +- .../cxx/CxxAstVisitorComponentTypeRefKind.cpp | 6 +- .../cxx/CxxAstVisitorComponentTypeRefKind.h | 11 +- .../cxx/CxxCompilationDatabaseSingle.cpp | 4 +- .../parser/cxx/CxxCompilationDatabaseSingle.h | 5 +- src/lib_cxx/data/parser/cxx/CxxContext.cpp | 10 +- src/lib_cxx/data/parser/cxx/CxxContext.h | 9 +- .../data/parser/cxx/CxxDiagnosticConsumer.cpp | 31 +- .../data/parser/cxx/CxxDiagnosticConsumer.h | 17 +- src/lib_cxx/data/parser/cxx/CxxParser.cpp | 162 +- src/lib_cxx/data/parser/cxx/CxxParser.h | 37 +- .../data/parser/cxx/CxxVerboseAstVisitor.cpp | 35 +- .../data/parser/cxx/CxxVerboseAstVisitor.h | 13 +- .../data/parser/cxx/GeneratePCHAction.cpp | 29 +- .../data/parser/cxx/GeneratePCHAction.h | 11 +- .../data/parser/cxx/PreprocessorCallbacks.cpp | 107 +- .../data/parser/cxx/PreprocessorCallbacks.h | 45 +- .../cxx/SingleFrontendActionFactory.cpp | 3 +- .../parser/cxx/SingleFrontendActionFactory.h | 4 +- .../data/parser/cxx/name/CxxDeclName.cpp | 11 +- .../data/parser/cxx/name/CxxDeclName.h | 12 +- .../parser/cxx/name/CxxFunctionDeclName.cpp | 3 +- .../parser/cxx/name/CxxFunctionDeclName.h | 8 +- src/lib_cxx/data/parser/cxx/name/CxxName.cpp | 9 +- src/lib_cxx/data/parser/cxx/name/CxxName.h | 2 +- .../parser/cxx/name/CxxQualifierFlags.cpp | 10 +- .../data/parser/cxx/name/CxxQualifierFlags.h | 2 +- .../cxx/name/CxxStaticFunctionDeclName.cpp | 14 +- .../cxx/name/CxxStaticFunctionDeclName.h | 8 +- .../data/parser/cxx/name/CxxTypeName.cpp | 27 +- .../data/parser/cxx/name/CxxTypeName.h | 15 +- .../parser/cxx/name/CxxVariableDeclName.cpp | 3 +- .../parser/cxx/name/CxxVariableDeclName.h | 8 +- .../cxx/name_resolver/CxxDeclNameResolver.cpp | 219 +- .../cxx/name_resolver/CxxDeclNameResolver.h | 49 +- .../cxx/name_resolver/CxxNameResolver.cpp | 2 +- .../cxx/name_resolver/CxxNameResolver.h | 2 +- .../CxxSpecifierNameResolver.cpp | 33 +- .../name_resolver/CxxSpecifierNameResolver.h | 5 +- .../CxxTemplateArgumentNameResolver.cpp | 46 +- .../CxxTemplateArgumentNameResolver.h | 5 +- .../CxxTemplateParameterStringResolver.cpp | 33 +- .../CxxTemplateParameterStringResolver.h | 5 +- .../cxx/name_resolver/CxxTypeNameResolver.cpp | 414 +-- .../cxx/name_resolver/CxxTypeNameResolver.h | 7 +- src/lib_cxx/data/parser/cxx/utilityClang.cpp | 49 +- src/lib_cxx/data/parser/cxx/utilityClang.h | 50 +- src/lib_cxx/project/SourceGroupCxxCdb.cpp | 93 +- src/lib_cxx/project/SourceGroupCxxCdb.h | 23 +- .../project/SourceGroupCxxCodeblocks.cpp | 48 +- .../project/SourceGroupCxxCodeblocks.h | 8 +- src/lib_cxx/project/SourceGroupCxxEmpty.cpp | 113 +- src/lib_cxx/project/SourceGroupCxxEmpty.h | 11 +- .../project/SourceGroupFactoryModuleCxx.cpp | 22 +- .../project/SourceGroupFactoryModuleCxx.h | 5 +- src/lib_cxx/project/utilitySourceGroupCxx.cpp | 316 +-- src/lib_cxx/project/utilitySourceGroupCxx.h | 37 +- src/lib_cxx/utility/CompilationDatabase.cpp | 39 +- src/lib_cxx/utility/CompilationDatabase.h | 34 +- src/lib_cxx/utility/IncludeDirective.cpp | 6 +- src/lib_cxx/utility/IncludeDirective.h | 2 +- src/lib_cxx/utility/IncludeProcessing.cpp | 108 +- src/lib_cxx/utility/IncludeProcessing.h | 17 +- .../utility/codeblocks/CodeblocksCompiler.cpp | 98 +- .../utility/codeblocks/CodeblocksCompiler.h | 28 +- .../codeblocks/CodeblocksCompilerVarType.cpp | 60 +- .../codeblocks/CodeblocksCompilerVarType.h | 22 +- .../utility/codeblocks/CodeblocksProject.cpp | 513 ++-- .../utility/codeblocks/CodeblocksProject.h | 47 +- .../utility/codeblocks/CodeblocksTarget.cpp | 101 +- .../utility/codeblocks/CodeblocksTarget.h | 34 +- .../CodeblocksTargetRelationType.cpp | 72 +- .../codeblocks/CodeblocksTargetRelationType.h | 24 +- .../utility/codeblocks/CodeblocksUnit.cpp | 139 +- .../utility/codeblocks/CodeblocksUnit.h | 36 +- src/lib_gui/platform_includes/includesLinux.h | 17 +- src/lib_gui/platform_includes/includesMac.h | 18 +- .../platform_includes/includesWindows.h | 26 +- src/lib_gui/qt/QtApplication.cpp | 13 +- src/lib_gui/qt/QtApplication.h | 7 +- src/lib_gui/qt/QtCoreApplication.cpp | 7 +- src/lib_gui/qt/QtCoreApplication.h | 4 +- src/lib_gui/qt/element/QtStatusBar.cpp | 41 +- src/lib_gui/qt/element/QtStatusBar.h | 7 +- src/lib_gui/qt/element/QtTabBar.cpp | 3 +- src/lib_gui/qt/element/QtTabBar.h | 5 +- src/lib_gui/qt/element/QtTable.cpp | 30 +- src/lib_gui/qt/element/QtTable.h | 5 +- src/lib_gui/qt/element/QtTooltip.cpp | 33 +- src/lib_gui/qt/element/QtTooltip.h | 5 +- .../qt/element/bookmark/QtBookmark.cpp | 43 +- src/lib_gui/qt/element/bookmark/QtBookmark.h | 17 +- .../element/bookmark/QtBookmarkCategory.cpp | 32 +- .../qt/element/bookmark/QtBookmarkCategory.h | 12 +- .../qt/element/button/QtHelpButton.cpp | 8 +- src/lib_gui/qt/element/button/QtHelpButton.h | 5 +- .../qt/element/button/QtHoverButton.cpp | 9 +- src/lib_gui/qt/element/button/QtHoverButton.h | 9 +- .../qt/element/button/QtIconButton.cpp | 6 +- src/lib_gui/qt/element/button/QtIconButton.h | 9 +- .../qt/element/button/QtIconStateButton.cpp | 11 +- .../qt/element/button/QtIconStateButton.h | 11 +- .../button/QtSelfRefreshIconButton.cpp | 21 +- .../element/button/QtSelfRefreshIconButton.h | 9 +- src/lib_gui/qt/element/code/QtCodeArea.cpp | 121 +- src/lib_gui/qt/element/code/QtCodeArea.h | 24 +- src/lib_gui/qt/element/code/QtCodeField.cpp | 239 +- src/lib_gui/qt/element/code/QtCodeField.h | 9 +- src/lib_gui/qt/element/code/QtCodeFile.cpp | 60 +- src/lib_gui/qt/element/code/QtCodeFile.h | 8 +- .../qt/element/code/QtCodeFileList.cpp | 103 +- src/lib_gui/qt/element/code/QtCodeFileList.h | 12 +- .../qt/element/code/QtCodeFileSingle.cpp | 37 +- .../qt/element/code/QtCodeFileSingle.h | 9 +- .../qt/element/code/QtCodeFileTitleBar.cpp | 63 +- .../qt/element/code/QtCodeFileTitleBar.h | 5 +- .../qt/element/code/QtCodeFileTitleButton.cpp | 18 +- .../qt/element/code/QtCodeFileTitleButton.h | 5 +- .../qt/element/code/QtCodeNavigateable.cpp | 20 +- .../qt/element/code/QtCodeNavigateable.h | 20 +- .../qt/element/code/QtCodeNavigator.cpp | 164 +- src/lib_gui/qt/element/code/QtCodeNavigator.h | 15 +- src/lib_gui/qt/element/code/QtCodeSnippet.cpp | 28 +- src/lib_gui/qt/element/code/QtCodeSnippet.h | 8 +- src/lib_gui/qt/element/dialog/QtLineEdit.cpp | 5 +- src/lib_gui/qt/element/dialog/QtLineEdit.h | 5 +- src/lib_gui/qt/element/dialog/QtListBox.cpp | 27 +- src/lib_gui/qt/element/dialog/QtListBox.h | 15 +- .../qt/element/dialog/QtListBoxItem.cpp | 22 +- src/lib_gui/qt/element/dialog/QtListBoxItem.h | 7 +- .../qt/element/dialog/QtLocationPicker.cpp | 17 +- .../qt/element/dialog/QtLocationPicker.h | 11 +- .../qt/element/dialog/QtNewsWidget.cpp | 14 +- src/lib_gui/qt/element/dialog/QtNewsWidget.h | 5 +- .../qt/element/dialog/QtPathListBox.cpp | 15 +- src/lib_gui/qt/element/dialog/QtPathListBox.h | 9 +- .../qt/element/dialog/QtPathListBoxItem.cpp | 12 +- .../qt/element/dialog/QtPathListBoxItem.h | 7 +- .../qt/element/dialog/QtProgressBar.cpp | 7 +- src/lib_gui/qt/element/dialog/QtProgressBar.h | 5 +- .../qt/element/dialog/QtStringListBox.cpp | 4 +- .../qt/element/dialog/QtStringListBox.h | 7 +- .../qt/element/dialog/QtStringListBoxItem.cpp | 5 +- .../qt/element/dialog/QtStringListBoxItem.h | 7 +- src/lib_gui/qt/element/dialog/QtTextEdit.cpp | 3 +- src/lib_gui/qt/element/dialog/QtTextEdit.h | 5 +- .../element/dialog/QtUpdateCheckerWidget.cpp | 72 +- .../qt/element/dialog/QtUpdateCheckerWidget.h | 5 +- .../qt/element/history/QtHistoryList.cpp | 46 +- .../qt/element/history/QtHistoryList.h | 17 +- src/lib_gui/qt/element/history/QtUndoRedo.cpp | 21 +- src/lib_gui/qt/element/history/QtUndoRedo.h | 5 +- .../element/search/QtAutocompletionList.cpp | 177 +- .../qt/element/search/QtAutocompletionList.h | 18 +- .../qt/element/search/QtScreenSearchBox.cpp | 59 +- .../qt/element/search/QtScreenSearchBox.h | 11 +- src/lib_gui/qt/element/search/QtSearchBar.cpp | 13 +- src/lib_gui/qt/element/search/QtSearchBar.h | 7 +- .../qt/element/search/QtSearchBarButton.cpp | 3 +- .../qt/element/search/QtSearchBarButton.h | 5 +- .../qt/element/search/QtSmartSearchBox.cpp | 80 +- .../qt/element/search/QtSmartSearchBox.h | 12 +- .../qt/graphics/base/QtCountCircleItem.cpp | 14 +- .../qt/graphics/base/QtCountCircleItem.h | 5 +- .../qt/graphics/base/QtGraphicsView.cpp | 128 +- src/lib_gui/qt/graphics/base/QtGraphicsView.h | 5 +- .../qt/graphics/base/QtLineItemAngled.cpp | 39 +- .../qt/graphics/base/QtLineItemAngled.h | 5 +- .../qt/graphics/base/QtLineItemBase.cpp | 96 +- src/lib_gui/qt/graphics/base/QtLineItemBase.h | 14 +- .../qt/graphics/base/QtLineItemBezier.cpp | 15 +- .../qt/graphics/base/QtLineItemBezier.h | 5 +- .../qt/graphics/base/QtLineItemStraight.cpp | 7 +- .../qt/graphics/base/QtLineItemStraight.h | 5 +- .../qt/graphics/base/QtRoundedRectItem.cpp | 9 +- .../qt/graphics/base/QtRoundedRectItem.h | 7 +- .../component/QtGraphNodeComponent.cpp | 21 +- .../graphics/component/QtGraphNodeComponent.h | 2 +- .../QtGraphNodeComponentClickable.cpp | 12 +- .../component/QtGraphNodeComponentClickable.h | 5 +- .../QtGraphNodeComponentMoveable.cpp | 10 +- .../component/QtGraphNodeComponentMoveable.h | 5 +- src/lib_gui/qt/graphics/graph/QtGraphEdge.cpp | 94 +- src/lib_gui/qt/graphics/graph/QtGraphEdge.h | 5 +- src/lib_gui/qt/graphics/graph/QtGraphNode.cpp | 93 +- src/lib_gui/qt/graphics/graph/QtGraphNode.h | 10 +- .../qt/graphics/graph/QtGraphNodeAccess.cpp | 25 +- .../qt/graphics/graph/QtGraphNodeAccess.h | 9 +- .../qt/graphics/graph/QtGraphNodeBundle.cpp | 18 +- .../qt/graphics/graph/QtGraphNodeBundle.h | 5 +- .../qt/graphics/graph/QtGraphNodeData.cpp | 10 +- .../qt/graphics/graph/QtGraphNodeData.h | 12 +- .../graph/QtGraphNodeExpandToggle.cpp | 24 +- .../graphics/graph/QtGraphNodeExpandToggle.h | 5 +- .../qt/graphics/graph/QtGraphNodeGroup.cpp | 16 +- .../qt/graphics/graph/QtGraphNodeGroup.h | 5 +- .../graphics/graph/QtGraphNodeQualifier.cpp | 10 +- .../qt/graphics/graph/QtGraphNodeQualifier.h | 5 +- .../qt/graphics/graph/QtGraphNodeText.cpp | 4 +- .../qt/graphics/graph/QtGraphNodeText.h | 5 +- .../network/QtIDECommunicationController.cpp | 34 +- .../qt/network/QtIDECommunicationController.h | 5 +- src/lib_gui/qt/network/QtNetworkFactory.cpp | 11 +- src/lib_gui/qt/network/QtNetworkFactory.h | 9 +- src/lib_gui/qt/network/QtRequest.cpp | 2 +- src/lib_gui/qt/network/QtRequest.h | 5 +- src/lib_gui/qt/network/QtTcpWrapper.cpp | 14 +- src/lib_gui/qt/network/QtTcpWrapper.h | 10 +- src/lib_gui/qt/network/QtUpdateChecker.cpp | 42 +- src/lib_gui/qt/network/QtUpdateChecker.h | 5 +- .../qt/project_wizard/QtProjectWizard.cpp | 1078 ++++---- .../qt/project_wizard/QtProjectWizard.h | 9 +- .../project_wizard/QtProjectWizardWindow.cpp | 10 +- .../qt/project_wizard/QtProjectWizardWindow.h | 5 +- .../qt/project_wizard/QtSourceGroupWizard.h | 40 +- .../project_wizard/QtSourceGroupWizardPage.h | 72 +- .../content/QtProjectWizardContent.cpp | 41 +- .../content/QtProjectWizardContent.h | 14 +- .../QtProjectWizardContentCStandard.cpp | 10 +- .../content/QtProjectWizardContentCStandard.h | 5 +- .../QtProjectWizardContentCppStandard.cpp | 10 +- .../QtProjectWizardContentCppStandard.h | 5 +- ...ctWizardContentCrossCompilationOptions.cpp | 53 +- ...jectWizardContentCrossCompilationOptions.h | 5 +- .../QtProjectWizardContentCustomCommand.cpp | 33 +- .../QtProjectWizardContentCustomCommand.h | 8 +- .../QtProjectWizardContentCxxPchFlags.cpp | 49 +- .../QtProjectWizardContentCxxPchFlags.h | 8 +- .../QtProjectWizardContentExtensions.cpp | 15 +- .../QtProjectWizardContentExtensions.h | 8 +- .../content/QtProjectWizardContentFlags.cpp | 20 +- .../content/QtProjectWizardContentFlags.h | 8 +- .../content/QtProjectWizardContentGroup.cpp | 19 +- .../content/QtProjectWizardContentGroup.h | 5 +- .../QtProjectWizardContentJavaStandard.cpp | 10 +- .../QtProjectWizardContentJavaStandard.h | 5 +- .../QtProjectWizardContentPreferences.cpp | 333 ++- .../QtProjectWizardContentPreferences.h | 30 +- .../QtProjectWizardContentProjectData.cpp | 38 +- .../QtProjectWizardContentProjectData.h | 5 +- .../content/QtProjectWizardContentSelect.cpp | 139 +- .../content/QtProjectWizardContentSelect.h | 7 +- .../QtProjectWizardContentSourceGroupData.cpp | 35 +- .../QtProjectWizardContentSourceGroupData.h | 8 +- ...rojectWizardContentSourceGroupInfoText.cpp | 27 +- ...tProjectWizardContentSourceGroupInfoText.h | 5 +- .../QtProjectWizardContentUnloadable.cpp | 20 +- .../QtProjectWizardContentUnloadable.h | 8 +- .../content/QtProjectWizardContentVS.cpp | 13 +- .../content/QtProjectWizardContentVS.h | 5 +- .../path/QtProjectWizardContentPath.cpp | 7 +- .../content/path/QtProjectWizardContentPath.h | 7 +- .../path/QtProjectWizardContentPathCDB.cpp | 58 +- .../path/QtProjectWizardContentPathCDB.h | 5 +- ...jectWizardContentPathCodeblocksProject.cpp | 50 +- ...rojectWizardContentPathCodeblocksProject.h | 8 +- .../path/QtProjectWizardContentPathCxxPch.cpp | 48 +- .../path/QtProjectWizardContentPathCxxPch.h | 5 +- ...jectWizardContentPathPythonEnvironment.cpp | 55 +- ...rojectWizardContentPathPythonEnvironment.h | 8 +- ...QtProjectWizardContentPathSourceGradle.cpp | 14 +- .../QtProjectWizardContentPathSourceGradle.h | 5 +- .../QtProjectWizardContentPathSourceMaven.cpp | 29 +- .../QtProjectWizardContentPathSourceMaven.h | 5 +- .../paths/QtProjectWizardContentPaths.cpp | 21 +- .../paths/QtProjectWizardContentPaths.h | 7 +- .../QtProjectWizardContentPathsClassJava.cpp | 15 +- .../QtProjectWizardContentPathsClassJava.h | 8 +- .../QtProjectWizardContentPathsExclude.cpp | 28 +- .../QtProjectWizardContentPathsExclude.h | 8 +- ...ojectWizardContentPathsFrameworkSearch.cpp | 14 +- ...ProjectWizardContentPathsFrameworkSearch.h | 9 +- ...izardContentPathsFrameworkSearchGlobal.cpp | 14 +- ...tWizardContentPathsFrameworkSearchGlobal.h | 5 +- ...tProjectWizardContentPathsHeaderSearch.cpp | 270 +- .../QtProjectWizardContentPathsHeaderSearch.h | 9 +- ...ctWizardContentPathsHeaderSearchGlobal.cpp | 36 +- ...jectWizardContentPathsHeaderSearchGlobal.h | 5 +- ...rojectWizardContentPathsIndexedHeaders.cpp | 145 +- ...tProjectWizardContentPathsIndexedHeaders.h | 15 +- .../QtProjectWizardContentPathsSource.cpp | 60 +- .../paths/QtProjectWizardContentPathsSource.h | 8 +- src/lib_gui/qt/utility/QtContextMenu.cpp | 28 +- src/lib_gui/qt/utility/QtContextMenu.h | 7 +- .../qt/utility/QtDeviceScaledPixmap.cpp | 7 +- src/lib_gui/qt/utility/QtDeviceScaledPixmap.h | 2 +- src/lib_gui/qt/utility/QtFileDialog.cpp | 31 +- src/lib_gui/qt/utility/QtFileDialog.h | 7 +- .../utility/QtFilesAndDirectoriesDialog.cpp | 9 +- .../qt/utility/QtFilesAndDirectoriesDialog.h | 2 +- src/lib_gui/qt/utility/QtFlowLayout.cpp | 212 +- src/lib_gui/qt/utility/QtFlowLayout.h | 45 +- src/lib_gui/qt/utility/QtHighlighter.cpp | 138 +- src/lib_gui/qt/utility/QtHighlighter.h | 24 +- .../utility/QtScrollSpeedChangeListener.cpp | 3 +- .../qt/utility/QtScrollSpeedChangeListener.h | 5 +- src/lib_gui/qt/utility/QtThreadedFunctor.h | 24 +- .../qt/utility/QtWindowsTaskbarButton.cpp | 4 +- .../qt/utility/QtWindowsTaskbarButton.h | 3 +- src/lib_gui/qt/utility/utilityQt.cpp | 406 +-- src/lib_gui/qt/utility/utilityQt.h | 20 +- src/lib_gui/qt/view/QtBookmarkButtonsView.cpp | 81 +- src/lib_gui/qt/view/QtBookmarkButtonsView.h | 2 +- src/lib_gui/qt/view/QtBookmarkView.cpp | 123 +- src/lib_gui/qt/view/QtBookmarkView.h | 9 +- src/lib_gui/qt/view/QtCodeView.cpp | 95 +- src/lib_gui/qt/view/QtCodeView.h | 13 +- src/lib_gui/qt/view/QtCompositeView.cpp | 13 +- src/lib_gui/qt/view/QtCompositeView.h | 5 +- src/lib_gui/qt/view/QtCustomTrailView.cpp | 312 +-- src/lib_gui/qt/view/QtCustomTrailView.h | 2 +- src/lib_gui/qt/view/QtDialogView.cpp | 506 ++-- src/lib_gui/qt/view/QtDialogView.h | 36 +- src/lib_gui/qt/view/QtErrorView.cpp | 152 +- src/lib_gui/qt/view/QtErrorView.h | 9 +- src/lib_gui/qt/view/QtGraphView.cpp | 343 +-- src/lib_gui/qt/view/QtGraphView.h | 19 +- src/lib_gui/qt/view/QtGraphViewStyleImpl.cpp | 4 +- src/lib_gui/qt/view/QtGraphViewStyleImpl.h | 5 +- src/lib_gui/qt/view/QtMainView.cpp | 119 +- src/lib_gui/qt/view/QtMainView.h | 2 +- src/lib_gui/qt/view/QtRefreshView.cpp | 28 +- src/lib_gui/qt/view/QtRefreshView.h | 7 +- src/lib_gui/qt/view/QtScreenSearchView.cpp | 35 +- src/lib_gui/qt/view/QtScreenSearchView.h | 4 +- src/lib_gui/qt/view/QtSearchView.cpp | 27 +- src/lib_gui/qt/view/QtSearchView.h | 7 +- src/lib_gui/qt/view/QtStatusBarView.cpp | 46 +- src/lib_gui/qt/view/QtStatusBarView.h | 7 +- src/lib_gui/qt/view/QtStatusView.cpp | 66 +- src/lib_gui/qt/view/QtStatusView.h | 4 +- src/lib_gui/qt/view/QtTabbedView.cpp | 30 +- src/lib_gui/qt/view/QtTabbedView.h | 4 +- src/lib_gui/qt/view/QtTabsView.cpp | 94 +- src/lib_gui/qt/view/QtTabsView.h | 4 +- src/lib_gui/qt/view/QtTooltipView.cpp | 25 +- src/lib_gui/qt/view/QtTooltipView.h | 7 +- src/lib_gui/qt/view/QtUndoRedoView.cpp | 37 +- src/lib_gui/qt/view/QtUndoRedoView.h | 9 +- src/lib_gui/qt/view/QtViewFactory.cpp | 10 +- src/lib_gui/qt/view/QtViewFactory.h | 16 +- src/lib_gui/qt/view/QtViewWidgetWrapper.cpp | 5 +- src/lib_gui/qt/view/QtViewWidgetWrapper.h | 5 +- src/lib_gui/qt/window/QtAbout.cpp | 46 +- src/lib_gui/qt/window/QtAbout.h | 5 +- src/lib_gui/qt/window/QtBookmarkBrowser.cpp | 41 +- src/lib_gui/qt/window/QtBookmarkBrowser.h | 7 +- src/lib_gui/qt/window/QtBookmarkCreator.cpp | 22 +- src/lib_gui/qt/window/QtBookmarkCreator.h | 10 +- src/lib_gui/qt/window/QtIndexingDialog.cpp | 28 +- src/lib_gui/qt/window/QtIndexingDialog.h | 7 +- .../qt/window/QtIndexingProgressDialog.cpp | 11 +- .../qt/window/QtIndexingProgressDialog.h | 5 +- .../qt/window/QtIndexingReportDialog.cpp | 41 +- .../qt/window/QtIndexingReportDialog.h | 17 +- .../qt/window/QtIndexingStartDialog.cpp | 55 +- src/lib_gui/qt/window/QtIndexingStartDialog.h | 14 +- src/lib_gui/qt/window/QtKeyboardShortcuts.cpp | 26 +- src/lib_gui/qt/window/QtKeyboardShortcuts.h | 10 +- src/lib_gui/qt/window/QtKnownProgressDialog.h | 5 +- src/lib_gui/qt/window/QtLicenseWindow.cpp | 34 +- src/lib_gui/qt/window/QtLicenseWindow.h | 5 +- src/lib_gui/qt/window/QtMainWindow.cpp | 294 +- src/lib_gui/qt/window/QtMainWindow.h | 23 +- src/lib_gui/qt/window/QtPathListDialog.cpp | 6 +- src/lib_gui/qt/window/QtPathListDialog.h | 11 +- src/lib_gui/qt/window/QtPreferencesWindow.cpp | 29 +- src/lib_gui/qt/window/QtPreferencesWindow.h | 5 +- src/lib_gui/qt/window/QtProgressBarDialog.cpp | 13 +- src/lib_gui/qt/window/QtProgressBarDialog.h | 7 +- src/lib_gui/qt/window/QtSelectPathsDialog.cpp | 55 +- src/lib_gui/qt/window/QtSelectPathsDialog.h | 10 +- src/lib_gui/qt/window/QtStartScreen.cpp | 146 +- src/lib_gui/qt/window/QtStartScreen.h | 11 +- src/lib_gui/qt/window/QtTextEditDialog.cpp | 4 +- src/lib_gui/qt/window/QtTextEditDialog.h | 5 +- .../qt/window/QtUnknownProgressDialog.cpp | 1 - .../qt/window/QtUnknownProgressDialog.h | 5 +- src/lib_gui/qt/window/QtWindow.cpp | 37 +- src/lib_gui/qt/window/QtWindow.h | 7 +- src/lib_gui/qt/window/QtWindowBase.cpp | 18 +- src/lib_gui/qt/window/QtWindowBase.h | 5 +- src/lib_gui/qt/window/QtWindowStack.cpp | 34 +- src/lib_gui/qt/window/QtWindowStack.h | 12 +- .../path_detector/CombinedPathDetector.cpp | 5 +- .../path_detector/CombinedPathDetector.h | 4 +- .../utility/path_detector/PathDetector.cpp | 5 +- .../utility/path_detector/PathDetector.h | 2 +- .../cxx_header/CxxFrameworkPathDetector.cpp | 8 +- .../cxx_header/CxxFrameworkPathDetector.h | 2 +- .../cxx_header/CxxHeaderPathDetector.cpp | 5 +- .../cxx_header/CxxHeaderPathDetector.h | 2 +- .../CxxVs10To14HeaderPathDetector.cpp | 12 +- .../CxxVs10To14HeaderPathDetector.h | 9 +- .../cxx_header/CxxVs15HeaderPathDetector.cpp | 32 +- .../cxx_header/CxxVs15HeaderPathDetector.h | 4 +- .../cxx_header/utilityCxxHeaderDetection.cpp | 160 +- .../cxx_header/utilityCxxHeaderDetection.h | 13 +- .../java_runtime/JavaPathDetector.cpp | 3 +- .../java_runtime/JavaPathDetector.h | 2 +- .../java_runtime/JavaPathDetectorLinux.cpp | 23 +- .../java_runtime/JavaPathDetectorLinux.h | 5 +- .../java_runtime/JavaPathDetectorMac.h | 5 +- .../java_runtime/JavaPathDetectorWindows.cpp | 3 +- .../java_runtime/JavaPathDetectorWindows.h | 2 +- .../JreSystemLibraryPathDetector.cpp | 12 +- .../JreSystemLibraryPathDetector.h | 2 +- .../JreSystemLibraryPathDetectorLinux.h | 2 +- .../JreSystemLibraryPathDetectorMac.h | 2 +- .../JreSystemLibraryPathDetectorWindows.h | 2 +- .../MavenPathDetectorUnix.cpp | 5 +- .../maven_executable/MavenPathDetectorUnix.h | 2 +- .../MavenPathDetectorWindows.cpp | 5 +- .../MavenPathDetectorWindows.h | 2 +- src/lib_gui/utility/utilityApp.cpp | 168 +- src/lib_gui/utility/utilityApp.h | 42 +- src/lib_gui/utility/utilityPathDetection.cpp | 88 +- src/lib_gui/utility/utilityPathDetection.h | 17 +- src/lib_java/LanguagePackageJava.cpp | 4 +- src/lib_java/LanguagePackageJava.h | 4 +- .../data/indexer/IndexerCommandJava.cpp | 11 +- .../data/indexer/IndexerCommandJava.h | 5 +- src/lib_java/data/indexer/IndexerJava.cpp | 4 +- src/lib_java/data/indexer/IndexerJava.h | 5 +- .../data/parser/java/JavaEnvironment.cpp | 79 +- .../data/parser/java/JavaEnvironment.h | 46 +- .../parser/java/JavaEnvironmentFactory.cpp | 69 +- .../data/parser/java/JavaEnvironmentFactory.h | 2 +- src/lib_java/data/parser/java/JavaParser.cpp | 217 +- src/lib_java/data/parser/java/JavaParser.h | 265 +- .../project/SourceGroupFactoryModuleJava.cpp | 14 +- .../project/SourceGroupFactoryModuleJava.h | 5 +- src/lib_java/project/SourceGroupJava.cpp | 26 +- src/lib_java/project/SourceGroupJava.h | 5 +- src/lib_java/project/SourceGroupJavaEmpty.cpp | 4 +- src/lib_java/project/SourceGroupJavaEmpty.h | 5 +- .../project/SourceGroupJavaGradle.cpp | 38 +- src/lib_java/project/SourceGroupJavaGradle.h | 5 +- src/lib_java/project/SourceGroupJavaMaven.cpp | 39 +- src/lib_java/project/SourceGroupJavaMaven.h | 2 +- src/lib_java/utility/utilityGradle.cpp | 218 +- src/lib_java/utility/utilityGradle.h | 12 +- src/lib_java/utility/utilityJava.cpp | 292 +- src/lib_java/utility/utilityJava.h | 24 +- src/lib_java/utility/utilityMaven.cpp | 315 ++- src/lib_java/utility/utilityMaven.h | 19 +- .../SourceGroupFactoryModulePython.cpp | 6 +- .../project/SourceGroupFactoryModulePython.h | 5 +- .../project/SourceGroupPythonEmpty.cpp | 20 +- .../project/SourceGroupPythonEmpty.h | 2 +- src/lib_utility/utility/TextCodec.cpp | 3 +- src/lib_utility/utility/TextCodec.h | 4 +- src/lib_utility/utility/utilityString.cpp | 1051 ++++---- src/lib_utility/utility/utilityString.h | 364 +-- src/test/CommandlineTestSuite.cpp | 70 +- src/test/ConfigManagerTestSuite.cpp | 56 +- src/test/CxxIncludeProcessingTestSuite.cpp | 144 +- src/test/CxxParserTestSuite.cpp | 2381 +++++++---------- src/test/CxxTypeNameTestSuite.cpp | 4 +- src/test/FileManagerTestSuite.cpp | 5 +- src/test/FileSystemTestSuite.cpp | 136 +- src/test/GraphTestSuite.cpp | 295 +- src/test/JavaIndexSampleProjectsTestSuite.cpp | 660 +++-- src/test/JavaParserTestSuite.cpp | 789 ++---- src/test/LogManagerTestSuite.cpp | 220 +- src/test/LowMemoryStringMapTestSuite.cpp | 2 +- src/test/MatrixBaseTestSuite.cpp | 192 +- src/test/MatrixDynamicBaseTestSuite.cpp | 26 +- src/test/MessageQueueTestSuite.cpp | 187 +- src/test/NetworkProtocolHelperTestSuite.cpp | 15 +- src/test/RefreshInfoGeneratorTestSuite.cpp | 857 +++--- src/test/SearchIndexTestSuite.cpp | 6 +- src/test/SettingsMigratorTestSuite.cpp | 165 +- src/test/SettingsTestSuite.cpp | 107 +- src/test/SharedMemoryTestSuite.cpp | 70 +- src/test/SourceGroupTestSuite.cpp | 538 ++-- .../SourceLocationCollectionTestSuite.cpp | 71 +- src/test/SqliteBookmarkStorageTestSuite.cpp | 33 +- src/test/StorageTestSuite.cpp | 258 +- src/test/TaskSchedulerTestSuite.cpp | 192 +- src/test/TextAccessTestSuite.cpp | 40 +- src/test/UtilityMavenTestSuite.cpp | 90 +- src/test/helper/TestFileRegister.cpp | 6 +- src/test/helper/TestFileRegister.h | 5 +- src/test/helper/TestIntermediateStorage.h | 118 +- src/test/test_main.cpp | 13 +- 1100 files changed, 21382 insertions(+), 20822 deletions(-) diff --git a/src/lib/app/Application.cpp b/src/lib/app/Application.cpp index 72f88454..f13ffa25 100644 --- a/src/lib/app/Application.cpp +++ b/src/lib/app/Application.cpp @@ -1,13 +1,12 @@ #include "Application.h" -#include "ApplicationSettings.h" #include "AppPath.h" +#include "ApplicationSettings.h" #include "ColorScheme.h" #include "DialogView.h" #include "FileSystem.h" #include "GraphViewStyle.h" #include "IDECommunicationController.h" -#include "logging.h" #include "LogManager.h" #include "MainView.h" #include "MessageFilterErrorCountUpdate.h" @@ -23,20 +22,21 @@ #include "TabId.h" #include "TaskManager.h" #include "TaskScheduler.h" -#include "tracing.h" #include "UpdateChecker.h" #include "UserPaths.h" -#include "utilityString.h" -#include "utilityUuid.h" #include "Version.h" #include "ViewFactory.h" +#include "logging.h" +#include "tracing.h" +#include "utilityString.h" +#include "utilityUuid.h" std::shared_ptr Application::s_instance; std::string Application::s_uuid; void Application::createInstance( - const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory -){ + const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory) +{ bool hasGui = (viewFactory != nullptr); Version::setApplicationVersion(version); @@ -70,8 +70,8 @@ void Application::createInstance( if (networkFactory != nullptr) { - s_instance->m_ideCommunicationController = - networkFactory->createIDECommunicationController(s_instance->m_storageCache.get()); + s_instance->m_ideCommunicationController = networkFactory->createIDECommunicationController( + s_instance->m_storageCache.get()); s_instance->m_ideCommunicationController->startListening(); s_instance->m_updateChecker = networkFactory->createUpdateChecker(); @@ -122,10 +122,7 @@ void Application::loadStyle(const FilePath& colorSchemePath) GraphViewStyle::loadStyleSettings(); } -Application::Application(bool withGUI) - : m_hasGUI(withGUI) -{ -} +Application::Application(bool withGUI): m_hasGUI(withGUI) {} Application::~Application() { @@ -277,10 +274,14 @@ void Application::handleMessage(MessageLoadProject* message) updateRecentProjects(projectSettingsFilePath); m_storageCache->clear(); - m_storageCache->setSubject(std::weak_ptr()); // TODO: check if this is really required. + m_storageCache->setSubject( + std::weak_ptr()); // TODO: check if this is really required. m_project = std::make_shared( - std::make_shared(projectSettingsFilePath), m_storageCache.get(), getUUID(), hasGUI()); + std::make_shared(projectSettingsFilePath), + m_storageCache.get(), + getUUID(), + hasGUI()); if (m_project) { @@ -289,7 +290,8 @@ void Application::handleMessage(MessageLoadProject* message) else { LOG_ERROR_STREAM(<< "Failed to load project."); - MessageStatus(L"Failed to load project: " + projectSettingsFilePath.wstr(), true).dispatch(); + MessageStatus(L"Failed to load project: " + projectSettingsFilePath.wstr(), true) + .dispatch(); } updateTitle(); @@ -297,12 +299,19 @@ void Application::handleMessage(MessageLoadProject* message) catch (std::exception& e) { LOG_ERROR_STREAM(<< "Failed to load project, exception thrown: " << e.what()); - MessageStatus(L"Failed to load project, exception was thrown: " + projectSettingsFilePath.wstr(), true).dispatch(); + MessageStatus( + L"Failed to load project, exception was thrown: " + projectSettingsFilePath.wstr(), + true) + .dispatch(); } catch (...) { LOG_ERROR_STREAM(<< "Failed to load project, unknown exception thrown."); - MessageStatus(L"Failed to load project, unknown exception was thrown: " + projectSettingsFilePath.wstr(), true).dispatch(); + MessageStatus( + L"Failed to load project, unknown exception was thrown: " + + projectSettingsFilePath.wstr(), + true) + .dispatch(); } if (message->refreshMode != REFRESH_NONE) @@ -421,7 +430,8 @@ void Application::updateRecentProjects(const FilePath& projectSettingsFilePath) std::vector recentProjects = appSettings->getRecentProjects(); if (recentProjects.size()) { - std::vector::iterator it = std::find(recentProjects.begin(), recentProjects.end(), projectSettingsFilePath); + std::vector::iterator it = std::find( + recentProjects.begin(), recentProjects.end(), projectSettingsFilePath); if (it != recentProjects.end()) { recentProjects.erase(it); @@ -494,11 +504,17 @@ bool Application::checkSharedMemory() std::wstring error = utility::decodeFromUtf8(SharedMemory::checkSharedMemory(getUUID())); if (error.size()) { - MessageStatus(L"Error on accessing shared memory. Indexing not possible. " - "Please restart computer or run as admin: " + error, true).dispatch(); + MessageStatus( + L"Error on accessing shared memory. Indexing not possible. " + "Please restart computer or run as admin: " + + error, + true) + .dispatch(); handleDialog( - L"There was an error accessing shared memory on your computer: " + error + L"\n\n" - "Project indexing is not possible. Please restart your computer or try running Sourcetrail as admin. If the " + L"There was an error accessing shared memory on your computer: " + error + + L"\n\n" + "Project indexing is not possible. Please restart your computer or try running " + "Sourcetrail as admin. If the " "issue persists contact mail@sourcetrail.com"); return false; } diff --git a/src/lib/app/Application.h b/src/lib/app/Application.h index 0fcc71e6..d59363a9 100644 --- a/src/lib/app/Application.h +++ b/src/lib/app/Application.h @@ -4,10 +4,10 @@ #include #include "DialogView.h" -#include "MessageListener.h" -#include "MessageIndexingFinished.h" #include "MessageActivateWindow.h" #include "MessageCloseProject.h" +#include "MessageIndexingFinished.h" +#include "MessageListener.h" #include "MessageLoadProject.h" #include "MessageRefresh.h" #include "MessageRefreshUI.h" @@ -35,7 +35,8 @@ class Application , public MessageListener { public: - static void createInstance(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory); + static void createInstance( + const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory); static std::shared_ptr getInstance(); static void destroyInstance(); @@ -99,4 +100,4 @@ private: std::shared_ptr m_updateChecker; }; -#endif // APPLICATION_H +#endif // APPLICATION_H diff --git a/src/lib/app/LanguagePackage.h b/src/lib/app/LanguagePackage.h index e618ac4d..a00d9516 100644 --- a/src/lib/app/LanguagePackage.h +++ b/src/lib/app/LanguagePackage.h @@ -13,4 +13,4 @@ public: virtual std::vector> instantiateSupportedIndexers() const = 0; }; -#endif // LANGUAGE_PACKAGE_H +#endif // LANGUAGE_PACKAGE_H diff --git a/src/lib/app/LanguagePackageManager.cpp b/src/lib/app/LanguagePackageManager.cpp index 69f607f7..5f5f039b 100644 --- a/src/lib/app/LanguagePackageManager.cpp +++ b/src/lib/app/LanguagePackageManager.cpp @@ -25,9 +25,9 @@ void LanguagePackageManager::addPackage(std::shared_ptr package std::shared_ptr LanguagePackageManager::instantiateSupportedIndexers() { std::shared_ptr composite = std::make_shared(); - for (std::shared_ptr package : m_packages) + for (std::shared_ptr package: m_packages) { - for (std::shared_ptr indexer : package->instantiateSupportedIndexers()) + for (std::shared_ptr indexer: package->instantiateSupportedIndexers()) { composite->addIndexer(indexer); } diff --git a/src/lib/app/LanguagePackageManager.h b/src/lib/app/LanguagePackageManager.h index 08f8d45e..a374edbb 100644 --- a/src/lib/app/LanguagePackageManager.h +++ b/src/lib/app/LanguagePackageManager.h @@ -23,4 +23,4 @@ private: std::vector> m_packages; }; -#endif // LANGUAGE_PACKAGE_MANAGER_H \ No newline at end of file +#endif // LANGUAGE_PACKAGE_MANAGER_H \ No newline at end of file diff --git a/src/lib/app/UpdateChecker.h b/src/lib/app/UpdateChecker.h index d43dff26..21500f9d 100644 --- a/src/lib/app/UpdateChecker.h +++ b/src/lib/app/UpdateChecker.h @@ -8,4 +8,4 @@ public: virtual void checkUpdate() = 0; }; -#endif // UPDATE_CHECKER_H +#endif // UPDATE_CHECKER_H diff --git a/src/lib/app/paths/AppPath.cpp b/src/lib/app/paths/AppPath.cpp index 924b4088..e140561b 100644 --- a/src/lib/app/paths/AppPath.cpp +++ b/src/lib/app/paths/AppPath.cpp @@ -9,7 +9,7 @@ FilePath AppPath::getAppPath() bool AppPath::setAppPath(const FilePath& path) { - if(!path.empty()) + if (!path.empty()) { m_appPath = path; return true; diff --git a/src/lib/app/paths/AppPath.h b/src/lib/app/paths/AppPath.h index 7c4669fb..6c40a9f4 100644 --- a/src/lib/app/paths/AppPath.h +++ b/src/lib/app/paths/AppPath.h @@ -13,4 +13,4 @@ private: static FilePath m_appPath; }; -#endif // APP_PATH_H +#endif // APP_PATH_H diff --git a/src/lib/app/paths/ResourcePaths.h b/src/lib/app/paths/ResourcePaths.h index ef50a0c3..a7fa351d 100644 --- a/src/lib/app/paths/ResourcePaths.h +++ b/src/lib/app/paths/ResourcePaths.h @@ -19,4 +19,4 @@ public: static FilePath getCxxCompilerHeaderPath(); }; -#endif // RESOURCE_PATHS_H +#endif // RESOURCE_PATHS_H diff --git a/src/lib/app/paths/UserPaths.h b/src/lib/app/paths/UserPaths.h index 0c66d354..28ec7768 100644 --- a/src/lib/app/paths/UserPaths.h +++ b/src/lib/app/paths/UserPaths.h @@ -19,4 +19,4 @@ private: static FilePath s_userDataPath; }; -#endif // USER_PATHS_H +#endif // USER_PATHS_H diff --git a/src/lib/component/Component.cpp b/src/lib/component/Component.cpp index 4a016b34..c43d073c 100644 --- a/src/lib/component/Component.cpp +++ b/src/lib/component/Component.cpp @@ -1,12 +1,10 @@ #include "Component.h" -#include "View.h" #include "Controller.h" +#include "View.h" Component::Component(std::shared_ptr view, std::shared_ptr controller) - : m_controller(controller) - , m_view(view) - , m_tabId(0) + : m_controller(controller), m_view(view), m_tabId(0) { if (m_controller) { diff --git a/src/lib/component/Component.h b/src/lib/component/Component.h index 9a7cd5a6..1d96b643 100644 --- a/src/lib/component/Component.h +++ b/src/lib/component/Component.h @@ -47,4 +47,4 @@ ViewType* Component::getView() const return dynamic_cast(m_view.get()); } -#endif // COMPONENT_H +#endif // COMPONENT_H diff --git a/src/lib/component/ComponentFactory.cpp b/src/lib/component/ComponentFactory.cpp index 87103051..a979bdf5 100644 --- a/src/lib/component/ComponentFactory.cpp +++ b/src/lib/component/ComponentFactory.cpp @@ -1,11 +1,11 @@ #include "ComponentFactory.h" -#include "Component.h" #include "ActivationController.h" #include "BookmarkController.h" #include "BookmarkView.h" #include "CodeController.h" #include "CodeView.h" +#include "Component.h" #include "CustomTrailController.h" #include "CustomTrailView.h" #include "ErrorController.h" @@ -31,8 +31,7 @@ #include "ViewFactory.h" ComponentFactory::ComponentFactory(const ViewFactory* viewFactory, StorageAccess* storageAccess) - : m_viewFactory(viewFactory) - , m_storageAccess(storageAccess) + : m_viewFactory(viewFactory), m_storageAccess(storageAccess) { } @@ -56,7 +55,8 @@ std::shared_ptr ComponentFactory::createActivationComponent() std::shared_ptr ComponentFactory::createBookmarkComponent(ViewLayout* viewLayout) { std::shared_ptr view = m_viewFactory->createBookmarkView(viewLayout); - std::shared_ptr controller = std::make_shared(m_storageAccess); + std::shared_ptr controller = std::make_shared( + m_storageAccess); return std::make_shared(view, controller); } @@ -72,7 +72,8 @@ std::shared_ptr ComponentFactory::createCodeComponent(ViewLayout* vie std::shared_ptr ComponentFactory::createCustomTrailComponent(ViewLayout* viewLayout) { std::shared_ptr view = m_viewFactory->createCustomTrailView(viewLayout); - std::shared_ptr controller = std::make_shared(m_storageAccess); + std::shared_ptr controller = std::make_shared( + m_storageAccess); return std::make_shared(view, controller); } @@ -120,7 +121,8 @@ std::shared_ptr ComponentFactory::createSearchComponent(ViewLayout* v std::shared_ptr ComponentFactory::createStatusBarComponent(ViewLayout* viewLayout) { std::shared_ptr view = m_viewFactory->createStatusBarView(viewLayout); - std::shared_ptr controller = std::make_shared(m_storageAccess); + std::shared_ptr controller = std::make_shared( + m_storageAccess); return std::make_shared(view, controller); } @@ -154,7 +156,8 @@ std::shared_ptr ComponentFactory::createTooltipComponent(ViewLayout* std::shared_ptr ComponentFactory::createUndoRedoComponent(ViewLayout* viewLayout) { std::shared_ptr view = m_viewFactory->createUndoRedoView(viewLayout); - std::shared_ptr controller = std::make_shared(m_storageAccess); + std::shared_ptr controller = std::make_shared( + m_storageAccess); return std::make_shared(view, controller); } diff --git a/src/lib/component/ComponentFactory.h b/src/lib/component/ComponentFactory.h index 1e094122..caef6043 100644 --- a/src/lib/component/ComponentFactory.h +++ b/src/lib/component/ComponentFactory.h @@ -29,7 +29,8 @@ public: std::shared_ptr createSearchComponent(ViewLayout* viewLayout); std::shared_ptr createStatusBarComponent(ViewLayout* viewLayout); std::shared_ptr createStatusComponent(ViewLayout* viewLayout); - std::shared_ptr createTabsComponent(ViewLayout* viewLayout, ScreenSearchSender* screenSearchSender); + std::shared_ptr createTabsComponent( + ViewLayout* viewLayout, ScreenSearchSender* screenSearchSender); std::shared_ptr createTooltipComponent(ViewLayout* viewLayout); std::shared_ptr createUndoRedoComponent(ViewLayout* viewLayout); @@ -38,4 +39,4 @@ private: StorageAccess* m_storageAccess; }; -#endif // COMPONENT_FACTORY_H +#endif // COMPONENT_FACTORY_H diff --git a/src/lib/component/ComponentManager.cpp b/src/lib/component/ComponentManager.cpp index 999b9848..3ddc8a65 100644 --- a/src/lib/component/ComponentManager.cpp +++ b/src/lib/component/ComponentManager.cpp @@ -1,19 +1,19 @@ #include "ComponentManager.h" -#include "CompositeView.h" -#include "Controller.h" -#include "DialogView.h" -#include "logging.h" -#include "ScreenSearchController.h" -#include "TabbedView.h" -#include "ViewFactory.h" #include "BookmarkButtonsView.h" #include "BookmarkView.h" #include "CodeView.h" +#include "CompositeView.h" +#include "Controller.h" +#include "DialogView.h" #include "GraphView.h" #include "RefreshView.h" +#include "ScreenSearchController.h" #include "SearchView.h" +#include "TabbedView.h" #include "UndoRedoView.h" +#include "ViewFactory.h" +#include "logging.h" ComponentManager::ComponentManager(const ViewFactory* viewFactory, StorageAccess* storageAccess) : m_componentFactory(viewFactory, storageAccess) @@ -30,22 +30,28 @@ void ComponentManager::clear() void ComponentManager::setupMain(ViewLayout* viewLayout, Id appId) { std::shared_ptr compositeView = - m_componentFactory.getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search"); + m_componentFactory.getViewFactory()->createCompositeView( + viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search"); m_singleViews.push_back(compositeView); - std::shared_ptr undoRedoView = m_componentFactory.getViewFactory()->createUndoRedoView(compositeView.get()); - std::shared_ptr refreshView = m_componentFactory.getViewFactory()->createRefreshView(compositeView.get()); - std::shared_ptr searchView = m_componentFactory.getViewFactory()->createSearchView(compositeView.get()); + std::shared_ptr undoRedoView = + m_componentFactory.getViewFactory()->createUndoRedoView(compositeView.get()); + std::shared_ptr refreshView = + m_componentFactory.getViewFactory()->createRefreshView(compositeView.get()); + std::shared_ptr searchView = m_componentFactory.getViewFactory()->createSearchView( + compositeView.get()); std::shared_ptr bookmarkView = m_componentFactory.getViewFactory()->createBookmarkButtonsView(compositeView.get()); bookmarkView->setTabId(appId); - std::shared_ptr graphView = m_componentFactory.getViewFactory()->createGraphView(viewLayout); - std::shared_ptr codeView = m_componentFactory.getViewFactory()->createCodeView(viewLayout); + std::shared_ptr graphView = m_componentFactory.getViewFactory()->createGraphView( + viewLayout); + std::shared_ptr codeView = m_componentFactory.getViewFactory()->createCodeView( + viewLayout); - for (std::shared_ptr view : - std::vector>({ undoRedoView, searchView, bookmarkView, graphView, codeView })) + for (std::shared_ptr view: std::vector>( + {undoRedoView, searchView, bookmarkView, graphView, codeView})) { view->setEnabled(false); } @@ -57,67 +63,82 @@ void ComponentManager::setupMain(ViewLayout* viewLayout, Id appId) m_singleViews.push_back(graphView); m_singleViews.push_back(codeView); - std::shared_ptr screenSearchComponent = m_componentFactory.createScreenSearchComponent(viewLayout); - ScreenSearchController* screenSearchController = screenSearchComponent->getController(); + std::shared_ptr screenSearchComponent = + m_componentFactory.createScreenSearchComponent(viewLayout); + ScreenSearchController* screenSearchController = + screenSearchComponent->getController(); screenSearchController->addResponder(graphView.get()); screenSearchController->addResponder(codeView.get()); m_components.push_back(screenSearchComponent); - std::shared_ptr tabsComponent = m_componentFactory.createTabsComponent(viewLayout, screenSearchController); + std::shared_ptr tabsComponent = m_componentFactory.createTabsComponent( + viewLayout, screenSearchController); m_components.push_back(tabsComponent); - std::shared_ptr tooltipComponent = m_componentFactory.createTooltipComponent(viewLayout); + std::shared_ptr tooltipComponent = m_componentFactory.createTooltipComponent( + viewLayout); m_components.push_back(tooltipComponent); - for (DialogView::UseCase useCase : - { DialogView::UseCase::GENERAL, DialogView::UseCase::INDEXING, DialogView::UseCase::PROJECT_SETUP }) + for (DialogView::UseCase useCase: + {DialogView::UseCase::GENERAL, + DialogView::UseCase::INDEXING, + DialogView::UseCase::PROJECT_SETUP}) { m_dialogViews.emplace( useCase, - m_componentFactory.getViewFactory()->createDialogView(viewLayout, useCase, m_componentFactory.getStorageAccess()) - ); + m_componentFactory.getViewFactory()->createDialogView( + viewLayout, useCase, m_componentFactory.getStorageAccess())); } m_dialogViews[DialogView::UseCase::INDEXING]->setDialogsHideable(true); - std::shared_ptr tabbedView = - m_componentFactory.getViewFactory()->createTabbedView(viewLayout, "Status"); + std::shared_ptr tabbedView = m_componentFactory.getViewFactory()->createTabbedView( + viewLayout, "Status"); m_singleViews.push_back(tabbedView); - std::shared_ptr statusComponent = m_componentFactory.createStatusComponent(tabbedView.get()); + std::shared_ptr statusComponent = m_componentFactory.createStatusComponent( + tabbedView.get()); m_components.push_back(statusComponent); - std::shared_ptr errorComponent = m_componentFactory.createErrorComponent(tabbedView.get()); + std::shared_ptr errorComponent = m_componentFactory.createErrorComponent( + tabbedView.get()); m_components.push_back(errorComponent); - std::shared_ptr bookmarkComponent = m_componentFactory.createBookmarkComponent(compositeView.get()); + std::shared_ptr bookmarkComponent = m_componentFactory.createBookmarkComponent( + compositeView.get()); m_components.push_back(bookmarkComponent); std::shared_ptr activationComponent = m_componentFactory.createActivationComponent(); m_components.push_back(activationComponent); - std::shared_ptr statusBarComponent = m_componentFactory.createStatusBarComponent(viewLayout); + std::shared_ptr statusBarComponent = m_componentFactory.createStatusBarComponent( + viewLayout); m_components.push_back(statusBarComponent); - std::shared_ptr customTrailComponent = m_componentFactory.createCustomTrailComponent(viewLayout); + std::shared_ptr customTrailComponent = m_componentFactory.createCustomTrailComponent( + viewLayout); m_components.push_back(customTrailComponent); } void ComponentManager::setupTab(ViewLayout* viewLayout, Id tabId, ScreenSearchSender* screenSearchSender) { std::shared_ptr compositeView = - m_componentFactory.getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search"); + m_componentFactory.getViewFactory()->createCompositeView( + viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search"); m_singleViews.push_back(compositeView); - std::shared_ptr undoRedoComponent = m_componentFactory.createUndoRedoComponent(compositeView.get()); + std::shared_ptr undoRedoComponent = m_componentFactory.createUndoRedoComponent( + compositeView.get()); undoRedoComponent->setTabId(tabId); m_components.push_back(undoRedoComponent); - std::shared_ptr refreshComponent = m_componentFactory.createRefreshComponent(compositeView.get()); + std::shared_ptr refreshComponent = m_componentFactory.createRefreshComponent( + compositeView.get()); refreshComponent->setTabId(tabId); m_components.push_back(refreshComponent); - std::shared_ptr searchComponent = m_componentFactory.createSearchComponent(compositeView.get()); + std::shared_ptr searchComponent = m_componentFactory.createSearchComponent( + compositeView.get()); searchComponent->setTabId(tabId); m_components.push_back(searchComponent); @@ -140,7 +161,7 @@ void ComponentManager::setupTab(ViewLayout* viewLayout, Id tabId, ScreenSearchSe void ComponentManager::teardownTab(ScreenSearchSender* screenSearchSender) { - for (const std::shared_ptr& component : m_components) + for (const std::shared_ptr& component: m_components) { screenSearchSender->removeResponder(component->getView()); screenSearchSender->removeResponder(component->getView()); @@ -149,7 +170,7 @@ void ComponentManager::teardownTab(ScreenSearchSender* screenSearchSender) void ComponentManager::clearComponents() { - for (const std::shared_ptr& component : m_components) + for (const std::shared_ptr& component: m_components) { Controller* controller = component->getController(); @@ -162,7 +183,7 @@ void ComponentManager::clearComponents() void ComponentManager::refreshViews() { - for (const std::shared_ptr& component : m_components) + for (const std::shared_ptr& component: m_components) { View* view = component->getView(); @@ -172,7 +193,7 @@ void ComponentManager::refreshViews() } } - for (const std::shared_ptr& view : m_singleViews) + for (const std::shared_ptr& view: m_singleViews) { view->refreshView(); } diff --git a/src/lib/component/ComponentManager.h b/src/lib/component/ComponentManager.h index fa24ff78..4af5f1b7 100644 --- a/src/lib/component/ComponentManager.h +++ b/src/lib/component/ComponentManager.h @@ -42,4 +42,4 @@ private: std::map> m_dialogViews; }; -#endif // COMPONENT_MANAGER_H +#endif // COMPONENT_MANAGER_H diff --git a/src/lib/component/NetworkFactory.cpp b/src/lib/component/NetworkFactory.cpp index 492471e4..ffb15f65 100644 --- a/src/lib/component/NetworkFactory.cpp +++ b/src/lib/component/NetworkFactory.cpp @@ -1,9 +1,5 @@ #include "NetworkFactory.h" -NetworkFactory::NetworkFactory() -{ -} +NetworkFactory::NetworkFactory() {} -NetworkFactory::~NetworkFactory() -{ -} +NetworkFactory::~NetworkFactory() {} diff --git a/src/lib/component/NetworkFactory.h b/src/lib/component/NetworkFactory.h index 618563a2..8c3424c8 100644 --- a/src/lib/component/NetworkFactory.h +++ b/src/lib/component/NetworkFactory.h @@ -13,8 +13,9 @@ public: NetworkFactory(); virtual ~NetworkFactory(); - virtual std::shared_ptr createIDECommunicationController(StorageAccess* storageAccess) const = 0; + virtual std::shared_ptr createIDECommunicationController( + StorageAccess* storageAccess) const = 0; virtual std::shared_ptr createUpdateChecker() const = 0; }; -#endif // NETWORK_FACTORY_H +#endif // NETWORK_FACTORY_H diff --git a/src/lib/component/Tab.cpp b/src/lib/component/Tab.cpp index 722b4b23..d75ea73a 100644 --- a/src/lib/component/Tab.cpp +++ b/src/lib/component/Tab.cpp @@ -1,6 +1,10 @@ #include "Tab.h" -Tab::Tab(Id tabId, const ViewFactory* viewFactory, StorageAccess* storageAccess, ScreenSearchSender* screenSearchSender) +Tab::Tab( + Id tabId, + const ViewFactory* viewFactory, + StorageAccess* storageAccess, + ScreenSearchSender* screenSearchSender) : m_tabId(tabId) , m_componentManager(viewFactory, storageAccess) , m_parentLayout(nullptr) @@ -21,7 +25,7 @@ void Tab::setParentLayout(ViewLayout* parentLayout) if (parentLayout) { - for (View* view : m_views) + for (View* view: m_views) { parentLayout->overrideView(view); } diff --git a/src/lib/component/Tab.h b/src/lib/component/Tab.h index 0f8a6754..3597c105 100644 --- a/src/lib/component/Tab.h +++ b/src/lib/component/Tab.h @@ -14,7 +14,10 @@ class Tab , public MessageListener { public: - Tab(Id tabId, const ViewFactory* viewFactory, StorageAccess* storageAccess, ScreenSearchSender* screenSearchSender); + Tab(Id tabId, + const ViewFactory* viewFactory, + StorageAccess* storageAccess, + ScreenSearchSender* screenSearchSender); virtual ~Tab(); void setParentLayout(ViewLayout* parentLayout); @@ -40,4 +43,4 @@ private: ScreenSearchSender* m_screenSearchSender; }; -#endif // TAB_H +#endif // TAB_H diff --git a/src/lib/component/TabId.h b/src/lib/component/TabId.h index afe47f47..02be848a 100644 --- a/src/lib/component/TabId.h +++ b/src/lib/component/TabId.h @@ -20,4 +20,4 @@ private: static Id s_currentTabId; }; -#endif // TAB_ID_H +#endif // TAB_ID_H diff --git a/src/lib/component/controller/ActivationController.cpp b/src/lib/component/controller/ActivationController.cpp index a7756d68..b3bd2587 100644 --- a/src/lib/component/controller/ActivationController.cpp +++ b/src/lib/component/controller/ActivationController.cpp @@ -1,17 +1,17 @@ #include "ActivationController.h" -#include "StorageAccess.h" #include "ApplicationSettings.h" +#include "StorageAccess.h" #include "MessageActivateLegend.h" -#include "MessageErrorsAll.h" #include "MessageActivateOverview.h" #include "MessageActivateTokens.h" #include "MessageChangeFileView.h" +#include "MessageErrorsAll.h" #include "MessageFlushUpdates.h" #include "MessageRefreshUI.h" -#include "MessageStatus.h" #include "MessageScrollToLine.h" +#include "MessageStatus.h" #include "MessageTooltipShow.h" #include "utility.h" @@ -20,9 +20,7 @@ ActivationController::ActivationController(StorageAccess* storageAccess) { } -void ActivationController::clear() -{ -} +void ActivationController::clear() {} void ActivationController::handleMessage(MessageActivateEdge* message) { @@ -51,7 +49,7 @@ void ActivationController::handleMessage(MessageActivateFile* message) { MessageActivateTokens messageActivateTokens(message); messageActivateTokens.tokenIds.push_back(fileId); - messageActivateTokens.searchMatches = m_storageAccess->getSearchMatchesForTokenIds({ fileId }); + messageActivateTokens.searchMatches = m_storageAccess->getSearchMatchesForTokenIds({fileId}); messageActivateTokens.dispatchImmediately(); } else @@ -60,8 +58,7 @@ void ActivationController::handleMessage(MessageActivateFile* message) message->filePath, MessageChangeFileView::FILE_MAXIMIZED, MessageChangeFileView::VIEW_CURRENT, - CodeScrollParams::toFile(message->filePath, CodeScrollParams::Target::VISIBLE) - ); + CodeScrollParams::toFile(message->filePath, CodeScrollParams::Target::VISIBLE)); msg.setSchedulerId(message->getSchedulerId()); msg.dispatchImmediately(); } @@ -77,7 +74,7 @@ void ActivationController::handleMessage(MessageActivateFile* message) void ActivationController::handleMessage(MessageActivateNodes* message) { MessageActivateTokens m(message); - for (const MessageActivateNodes::ActiveNode& node : message->nodes) + for (const MessageActivateNodes::ActiveNode& node: message->nodes) { Id nodeId = node.nodeId; if (!nodeId) @@ -105,13 +102,14 @@ void ActivationController::handleMessage(MessageActivateTokenIds* message) void ActivationController::handleMessage(MessageActivateSourceLocations* message) { MessageActivateNodes msg; - for (Id nodeId : m_storageAccess->getNodeIdsForLocationIds(message->locationIds)) + for (Id nodeId: m_storageAccess->getNodeIdsForLocationIds(message->locationIds)) { msg.addNode(nodeId); } if (message->containsUnsolvedLocations && msg.nodes.size() == 1 && - m_storageAccess->getNameHierarchyForNodeId(msg.nodes[0].nodeId).getQualifiedName() == L"unsolved symbol") + m_storageAccess->getNameHierarchyForNodeId(msg.nodes[0].nodeId).getQualifiedName() == + L"unsolved symbol") { MessageTooltipShow m(message->locationIds, {}, TOOLTIP_ORIGIN_CODE); m.force = true; @@ -147,36 +145,36 @@ void ActivationController::handleMessage(MessageSearch* message) { switch (matches.back().getCommandType()) { - case SearchMatch::COMMAND_ALL: - case SearchMatch::COMMAND_NODE_FILTER: - { - MessageActivateOverview msg(message->acceptedNodeTypes); - msg.setSchedulerId(message->getSchedulerId()); - msg.dispatch(); - return; - } + case SearchMatch::COMMAND_ALL: + case SearchMatch::COMMAND_NODE_FILTER: + { + MessageActivateOverview msg(message->acceptedNodeTypes); + msg.setSchedulerId(message->getSchedulerId()); + msg.dispatch(); + return; + } - case SearchMatch::COMMAND_ERROR: - { - MessageErrorsAll msg; - msg.setSchedulerId(message->getSchedulerId()); - msg.dispatch(); - return; - } + case SearchMatch::COMMAND_ERROR: + { + MessageErrorsAll msg; + msg.setSchedulerId(message->getSchedulerId()); + msg.dispatch(); + return; + } - case SearchMatch::COMMAND_LEGEND: - { - MessageActivateLegend msg; - msg.setSchedulerId(message->getSchedulerId()); - msg.dispatch(); - return; - } + case SearchMatch::COMMAND_LEGEND: + { + MessageActivateLegend msg; + msg.setSchedulerId(message->getSchedulerId()); + msg.dispatch(); + return; + } } } MessageActivateTokens m(message); m.isFromSearch = true; - for (const SearchMatch& match : matches) + for (const SearchMatch& match: matches) { if (match.tokenIds.size() && match.tokenIds[0] != 0) { @@ -197,8 +195,7 @@ void ActivationController::handleMessage(MessageZoom* message) int maxSize = settings->getFontSizeMax(); int minSize = settings->getFontSizeMin(); - if ((fontSize >= maxSize && zoomIn) - || (fontSize <= minSize && !zoomIn)) + if ((fontSize >= maxSize && zoomIn) || (fontSize <= minSize && !zoomIn)) { return; } diff --git a/src/lib/component/controller/ActivationController.h b/src/lib/component/controller/ActivationController.h index ba243cee..2e28334f 100644 --- a/src/lib/component/controller/ActivationController.h +++ b/src/lib/component/controller/ActivationController.h @@ -5,12 +5,12 @@ #include "Controller.h" -#include "MessageListener.h" #include "MessageActivateEdge.h" #include "MessageActivateFile.h" #include "MessageActivateNodes.h" -#include "MessageActivateTokenIds.h" #include "MessageActivateSourceLocations.h" +#include "MessageActivateTokenIds.h" +#include "MessageListener.h" #include "MessageResetZoom.h" #include "MessageSearch.h" #include "MessageZoom.h" @@ -46,4 +46,4 @@ private: StorageAccess* m_storageAccess; }; -#endif // ACTIVATION_CONTROLLER_H +#endif // ACTIVATION_CONTROLLER_H diff --git a/src/lib/component/controller/BookmarkController.cpp b/src/lib/component/controller/BookmarkController.cpp index 5d49fd23..1ecbd6d6 100644 --- a/src/lib/component/controller/BookmarkController.cpp +++ b/src/lib/component/controller/BookmarkController.cpp @@ -1,20 +1,20 @@ #include "BookmarkController.h" #include "Application.h" -#include "BookmarkView.h" -#include "StorageAccess.h" #include "Bookmark.h" +#include "BookmarkView.h" #include "EdgeBookmark.h" #include "NodeBookmark.h" +#include "StorageAccess.h" #include "StorageEdge.h" #include "MessageActivateEdge.h" #include "MessageActivateNodes.h" #include "MessageBookmarkButtonState.h" -#include "logging.h" #include "TabId.h" -#include "utilityString.h" +#include "logging.h" #include "utility.h" +#include "utilityString.h" const std::wstring BookmarkController::s_edgeSeperatorToken = L" => "; const std::wstring BookmarkController::s_defaultCategoryName = L"default"; @@ -27,9 +27,7 @@ BookmarkController::BookmarkController(StorageAccess* storageAccess) { } -BookmarkController::~BookmarkController() -{ -} +BookmarkController::~BookmarkController() {} void BookmarkController::clear() { @@ -42,7 +40,8 @@ void BookmarkController::displayBookmarks() getView()->displayBookmarks(getBookmarks(m_filter, m_order)); } -void BookmarkController::displayBookmarksFor(Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order) +void BookmarkController::displayBookmarksFor( + Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order) { if (filter != Bookmark::FILTER_UNKNOWN) { @@ -58,8 +57,8 @@ void BookmarkController::displayBookmarksFor(Bookmark::BookmarkFilter filter, Bo } void BookmarkController::createBookmark( - const std::wstring& name, const std::wstring& comment, const std::wstring& category, Id nodeId -){ + const std::wstring& name, const std::wstring& comment, const std::wstring& category, Id nodeId) +{ LOG_INFO("Attempting to create new bookmark"); Id tabId = TabId::currentTab(); @@ -103,20 +102,24 @@ void BookmarkController::createBookmark( m_bookmarkCache.clear(); - if (!nodeId || (m_activeNodeIds[TabId::currentTab()].size() == 1 && m_activeNodeIds[TabId::currentTab()][0] == nodeId)) + if (!nodeId || + (m_activeNodeIds[TabId::currentTab()].size() == 1 && + m_activeNodeIds[TabId::currentTab()][0] == nodeId)) { - MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::ALREADY_CREATED).dispatch(); + MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::ALREADY_CREATED) + .dispatch(); } update(); } void BookmarkController::editBookmark( - Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& category -){ + Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& category) +{ LOG_INFO_STREAM(<< "Attempting to update Bookmark " << bookmarkId); - m_storageAccess->updateBookmark(bookmarkId, name, comment, category.size() ? category : s_defaultCategoryName); + m_storageAccess->updateBookmark( + bookmarkId, name, comment, category.size() ? category : s_defaultCategoryName); cleanBookmarkCategories(); @@ -133,7 +136,8 @@ void BookmarkController::deleteBookmark(Id bookmarkId) if (!getBookmarkForActiveToken(TabId::currentTab())) { - MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::CAN_CREATE).dispatch(); + MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::CAN_CREATE) + .dispatch(); } update(); @@ -147,7 +151,8 @@ void BookmarkController::deleteBookmarkCategory(Id categoryId) if (!getBookmarkForActiveToken(TabId::currentTab())) { - MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::CAN_CREATE).dispatch(); + MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::CAN_CREATE) + .dispatch(); } update(); @@ -163,7 +168,8 @@ void BookmarkController::deleteBookmarkForActiveTokens() cleanBookmarkCategories(); - MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::CAN_CREATE).dispatch(); + MessageBookmarkButtonState(TabId::currentTab(), MessageBookmarkButtonState::CAN_CREATE) + .dispatch(); update(); } else @@ -183,8 +189,10 @@ void BookmarkController::activateBookmark(const std::shared_ptr bookma const Id firstEdgeId = edgeBookmark->getEdgeIds().front(); const StorageEdge storageEdge = m_storageAccess->getEdgeById(firstEdgeId); - const NameHierarchy sourceName = m_storageAccess->getNameHierarchyForNodeId(storageEdge.sourceNodeId); - const NameHierarchy targetName = m_storageAccess->getNameHierarchyForNodeId(storageEdge.targetNodeId); + const NameHierarchy sourceName = m_storageAccess->getNameHierarchyForNodeId( + storageEdge.sourceNodeId); + const NameHierarchy targetName = m_storageAccess->getNameHierarchyForNodeId( + storageEdge.targetNodeId); if (edgeBookmark->getEdgeIds().size() == 1) { @@ -194,11 +202,14 @@ void BookmarkController::activateBookmark(const std::shared_ptr bookma MessageActivateNodes(activeNodeId).dispatch(); } - MessageActivateEdge(firstEdgeId, Edge::intToType(storageEdge.type), sourceName, targetName).dispatch(); + MessageActivateEdge( + firstEdgeId, Edge::intToType(storageEdge.type), sourceName, targetName) + .dispatch(); } else { - MessageActivateEdge activateEdge(0, Edge::EdgeType::EDGE_AGGREGATION, sourceName, targetName); + MessageActivateEdge activateEdge( + 0, Edge::EdgeType::EDGE_AGGREGATION, sourceName, targetName); for (const Id aggregatedEdgeId: edgeBookmark->getEdgeIds()) { activateEdge.aggregationIds.push_back(aggregatedEdgeId); @@ -243,7 +254,8 @@ void BookmarkController::showBookmarkCreator(Id nodeId) } else { - view->displayBookmarkCreator(getDisplayNamesForNodeId(nodeId), getAllBookmarkCategories(), nodeId); + view->displayBookmarkCreator( + getDisplayNamesForNodeId(nodeId), getAllBookmarkCategories(), nodeId); } } else @@ -380,7 +392,7 @@ std::vector BookmarkController::getActiveTokenDisplayNames() const std::vector BookmarkController::getDisplayNamesForNodeId(Id nodeId) const { - return std::vector({ getNodeDisplayName(nodeId) }); + return std::vector({getNodeDisplayName(nodeId)}); } std::vector BookmarkController::getAllBookmarkCategories() const @@ -394,7 +406,8 @@ std::shared_ptr BookmarkController::getBookmarkForActiveToken(Id tabId { for (const std::shared_ptr& edgeBookmark: getAllEdgeBookmarks()) { - if (!m_activeNodeIds[tabId].empty() && edgeBookmark->getActiveNodeId() == m_activeNodeIds[tabId].front() && + if (!m_activeNodeIds[tabId].empty() && + edgeBookmark->getActiveNodeId() == m_activeNodeIds[tabId].front() && utility::isPermutation(edgeBookmark->getEdgeIds(), m_activeEdgeIds[tabId])) { return std::make_shared(*(edgeBookmark.get())); @@ -467,9 +480,10 @@ std::vector> BookmarkController::getAllEdgeBookmar } std::vector> BookmarkController::getBookmarks( - Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order -) const { - LOG_INFO_STREAM(<< "Retrieving bookmarks with filter \"" << filter << "\" and order \"" << order << "\""); + Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order) const +{ + LOG_INFO_STREAM( + << "Retrieving bookmarks with filter \"" << filter << "\" and order \"" << order << "\""); std::vector> bookmarks = getAllBookmarks(); bookmarks = getFilteredBookmarks(bookmarks, filter); @@ -480,7 +494,7 @@ std::vector> BookmarkController::getBookmarks( std::vector BookmarkController::getActiveNodeDisplayNames() const { std::vector names; - for (Id nodeId : m_activeNodeIds[TabId::currentTab()]) + for (Id nodeId: m_activeNodeIds[TabId::currentTab()]) { names.push_back(getNodeDisplayName(nodeId)); } @@ -627,12 +641,14 @@ void BookmarkController::cleanBookmarkCategories() } } -bool BookmarkController::bookmarkDateCompare(const std::shared_ptr a, const std::shared_ptr b) +bool BookmarkController::bookmarkDateCompare( + const std::shared_ptr a, const std::shared_ptr b) { return a->getTimeStamp() < b->getTimeStamp(); } -bool BookmarkController::bookmarkNameCompare(const std::shared_ptr a, const std::shared_ptr b) +bool BookmarkController::bookmarkNameCompare( + const std::shared_ptr a, const std::shared_ptr b) { std::wstring aName = a->getName(); std::wstring bName = b->getName(); @@ -666,7 +682,8 @@ void BookmarkController::update() view->displayBookmarks(getBookmarks(m_filter, m_order)); } - std::vector> bookmarks = getBookmarks(Bookmark::FILTER_ALL, Bookmark::ORDER_DATE_DESCENDING); + std::vector> bookmarks = getBookmarks( + Bookmark::FILTER_ALL, Bookmark::ORDER_DATE_DESCENDING); const size_t maxBookmarkMenuCount = 20; if (bookmarks.size() > maxBookmarkMenuCount) diff --git a/src/lib/component/controller/BookmarkController.h b/src/lib/component/controller/BookmarkController.h index ba18d11f..cb3023b1 100644 --- a/src/lib/component/controller/BookmarkController.h +++ b/src/lib/component/controller/BookmarkController.h @@ -5,13 +5,13 @@ #include "Bookmark.h" #include "Controller.h" #include "EdgeBookmark.h" -#include "MessageListener.h" #include "MessageBookmarkActivate.h" #include "MessageBookmarkBrowse.h" #include "MessageBookmarkCreate.h" #include "MessageBookmarkDelete.h" #include "MessageBookmarkEdit.h" #include "MessageIndexingFinished.h" +#include "MessageListener.h" #include "NodeBookmark.h" class StorageAccess; @@ -35,8 +35,13 @@ public: void displayBookmarks(); void displayBookmarksFor(Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order); - void createBookmark(const std::wstring& name, const std::wstring& comment, const std::wstring& category, Id nodeId); - void editBookmark(Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& category); + void createBookmark( + const std::wstring& name, const std::wstring& comment, const std::wstring& category, Id nodeId); + void editBookmark( + Id bookmarkId, + const std::wstring& name, + const std::wstring& comment, + const std::wstring& category); void deleteBookmark(Id bookmarkId); void deleteBookmarkCategory(Id categoryId); @@ -97,7 +102,8 @@ private: std::wstring getNodeDisplayName(const Id id) const; std::vector> getFilteredBookmarks( - const std::vector>& bookmarks, Bookmark::BookmarkFilter filter) const; + const std::vector>& bookmarks, + Bookmark::BookmarkFilter filter) const; std::vector> getOrderedBookmarks( const std::vector>& bookmarks, Bookmark::BookmarkOrder order) const; std::vector> getDateOrderedBookmarks( @@ -107,8 +113,10 @@ private: void cleanBookmarkCategories(); - static bool bookmarkDateCompare(const std::shared_ptr a, const std::shared_ptr b); - static bool bookmarkNameCompare(const std::shared_ptr a, const std::shared_ptr b); + static bool bookmarkDateCompare( + const std::shared_ptr a, const std::shared_ptr b); + static bool bookmarkNameCompare( + const std::shared_ptr a, const std::shared_ptr b); void update(); @@ -125,4 +133,4 @@ private: Bookmark::BookmarkOrder m_order; }; -#endif // BOOKMARK_CONTROLLER_H +#endif // BOOKMARK_CONTROLLER_H diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 5d9c3a3b..5720e053 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -5,23 +5,20 @@ #include "Application.h" #include "ApplicationSettings.h" #include "FileInfo.h" -#include "logging.h" #include "MessageMoveIDECursor.h" #include "MessageShowError.h" #include "MessageStatus.h" -#include "StorageAccess.h" #include "SourceLocation.h" #include "SourceLocationCollection.h" #include "SourceLocationFile.h" +#include "StorageAccess.h" #include "TextAccess.h" +#include "logging.h" #include "tracing.h" #include "utility.h" #include "utilityString.h" -CodeController::CodeController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) -{ -} +CodeController::CodeController(StorageAccess* storageAccess): m_storageAccess(storageAccess) {} Id CodeController::getSchedulerId() const { @@ -67,7 +64,8 @@ void CodeController::handleMessage(MessageActivateFullTextSearch* message) saveOrRestoreViewMode(message); - m_collection = m_storageAccess->getFullTextSearchLocations(message->searchTerm, message->caseSensitive); + m_collection = m_storageAccess->getFullTextSearchLocations( + message->searchTerm, message->caseSensitive); CodeView::CodeParams params; params.clearSnippets = true; @@ -115,7 +113,8 @@ void CodeController::handleMessage(MessageActivateOverview* message) statsSnippet.startLineNumber = 1; statsSnippet.endLineNumber = 1; - statsSnippet.locationFile = std::make_shared(FilePath(), L"", true, true, true); + statsSnippet.locationFile = std::make_shared( + FilePath(), L"", true, true, true); std::vector description = getProjectDescription(statsSnippet.locationFile.get()); @@ -124,7 +123,7 @@ void CodeController::handleMessage(MessageActivateOverview* message) if (description.size()) { ss << "\n"; - for (const std::string& line : description) + for (const std::string& line: description) { ss << line + "\n"; } @@ -141,13 +140,17 @@ void CodeController::handleMessage(MessageActivateOverview* message) } ss << "\t" + std::to_string(stats.fileCount) + " files"; - ss << (stats.completedFileCount != stats.fileCount ? " (" + std::to_string(stats.completedFileCount) + " complete)" : "") + "\n"; + ss << (stats.completedFileCount != stats.fileCount + ? " (" + std::to_string(stats.completedFileCount) + " complete)" + : "") + + "\n"; ss << "\t" + std::to_string(stats.fileLOCCount) + " lines of code\n"; ss << "\n"; ss << "\t" + std::to_string(stats.nodeCount) + " symbols\n"; ss << "\t" + std::to_string(stats.edgeCount) + " references\n"; ss << "\n"; - ss << "\t" + std::to_string(errorCount.total) + " errors (" + std::to_string(errorCount.fatal) + " fatal)\n"; + ss << "\t" + std::to_string(errorCount.total) + " errors (" + std::to_string(errorCount.fatal) + + " fatal)\n"; ss << "\n"; if (errorCount.fatal) @@ -167,7 +170,7 @@ void CodeController::handleMessage(MessageActivateOverview* message) file.fileParams = std::make_shared(statsSnippet); m_currentFilePath = file.locationFile->getFilePath(); - m_files = { file }; + m_files = {file}; CodeView::CodeParams params; params.clearSnippets = true; @@ -193,13 +196,14 @@ void CodeController::handleMessage(MessageActivateTokens* message) params.activeTokenIds = message->tokenIds; params.clearSnippets = true; - Id declarationId = 0; // 0 means that no token is found. + Id declarationId = 0; // 0 means that no token is found. if (!message->isAggregation) { std::vector activeTokenIds; - for (Id tokenId : params.activeTokenIds) + for (Id tokenId: params.activeTokenIds) { - utility::append(activeTokenIds, m_storageAccess->getActiveTokenIdsForId(tokenId, &declarationId)); + utility::append( + activeTokenIds, m_storageAccess->getActiveTokenIdsForId(tokenId, &declarationId)); } params.activeTokenIds = activeTokenIds; } @@ -210,7 +214,7 @@ void CodeController::handleMessage(MessageActivateTokens* message) return; } - if (message->keepContent()) // deactivating an edge + if (message->keepContent()) // deactivating an edge { m_codeParams.activeTokenIds = params.activeTokenIds; m_codeParams.activeLocationIds.clear(); @@ -235,7 +239,7 @@ void CodeController::handleMessage(MessageActivateTokens* message) size_t referenceCount = m_collection->getSourceLocationCount(); std::wstring status; - for (const SearchMatch& match : message->getSearchMatches()) + for (const SearchMatch& match: message->getSearchMatches()) { status += L"Activate \"" + match.name + L"\": "; break; @@ -261,7 +265,7 @@ void CodeController::handleMessage(MessageActivateTrail* message) if (message->custom) { getView()->clear(); - Id nodeId = { message->originId ? message->originId : message->targetId }; + Id nodeId = {message->originId ? message->originId : message->targetId}; MessageCodeShowDefinition msg(nodeId); handleMessage(&msg); } @@ -289,16 +293,17 @@ void CodeController::handleMessage(MessageChangeFileView* message) saveOrRestoreViewMode(message); - for (CodeFileParams& file : m_files) + for (CodeFileParams& file: m_files) { if (file.locationFile->getFilePath() == message->filePath) { setFileState(file, message->state, m_codeParams.useSingleFileCache); // maximize within snippet list - if (message->viewMode == MessageChangeFileView::VIEW_LIST && message->state == MessageChangeFileView::FILE_MAXIMIZED) + if (message->viewMode == MessageChangeFileView::VIEW_LIST && + message->state == MessageChangeFileView::FILE_MAXIMIZED) { - file.snippetParams = { *file.fileParams.get() }; + file.snippetParams = {*file.fileParams.get()}; } break; @@ -329,7 +334,8 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message) Id nodeId = message->nodeId; - std::shared_ptr collection = m_storageAccess->getSourceLocationsForTokenIds({ nodeId }); + std::shared_ptr collection = + m_storageAccess->getSourceLocationsForTokenIds({nodeId}); if (!collection->getSourceLocationFileCount()) { LOG_ERROR("MessageCodeShowDefinition did not contain a nodeId with location files."); @@ -343,34 +349,33 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message) // use first scope location for nodeId, otherwise first location if (collection->getSourceLocationCount()) { - std::shared_ptr filteredCollection = std::make_shared(); + std::shared_ptr filteredCollection = + std::make_shared(); bool addedLocation = false; - collection->forEachSourceLocation( - [&](SourceLocation* location) + collection->forEachSourceLocation([&](SourceLocation* location) { + if (addedLocation || !location->isStartLocation()) { - if (addedLocation || !location->isStartLocation()) - { - return; - } - - if (location->isScopeLocation()) - { - filteredCollection->addSourceLocationCopy(location); - filteredCollection->addSourceLocationCopy(location->getEndLocation()); - - filePath = location->getFilePath(); - lineNumber = location->getLineNumber(); - columnNumber = location->getColumnNumber(); - addedLocation = true; - return; - } + return; } - ); + + if (location->isScopeLocation()) + { + filteredCollection->addSourceLocationCopy(location); + filteredCollection->addSourceLocationCopy(location->getEndLocation()); + + filePath = location->getFilePath(); + lineNumber = location->getLineNumber(); + columnNumber = location->getColumnNumber(); + addedLocation = true; + return; + } + }); if (!addedLocation) { - SourceLocation* location = collection->getSourceLocationFiles().begin()->second->getSourceLocations().begin()->get(); + SourceLocation* location = + collection->getSourceLocationFiles().begin()->second->getSourceLocations().begin()->get(); filteredCollection->addSourceLocationCopy(location); filteredCollection->addSourceLocationCopy(location->getOtherLocation()); @@ -381,7 +386,7 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message) collection = filteredCollection; } - else // otherwise first file + else // otherwise first file { filePath = collection->getSourceLocationFiles().begin()->second->getFilePath(); } @@ -401,7 +406,10 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message) saveOrRestoreViewMode(message); - showFiles(m_codeParams, CodeScrollParams::toLine(filePath, lineNumber, CodeScrollParams::Target::TOP), !message->isReplayed()); + showFiles( + m_codeParams, + CodeScrollParams::toLine(filePath, lineNumber, CodeScrollParams::Target::TOP), + !message->isReplayed()); } void CodeController::handleMessage(MessageDeactivateEdge* message) @@ -446,11 +454,14 @@ void CodeController::handleMessage(MessageFocusOut* message) void CodeController::handleMessage(MessageScrollToLine* message) { - getView()->scrollTo(CodeScrollParams::toLine(message->filePath, message->line, CodeScrollParams::Target::TOP), false); + getView()->scrollTo( + CodeScrollParams::toLine(message->filePath, message->line, CodeScrollParams::Target::TOP), + false); MessageStatus( - L"Showing source location: " + message->filePath.wstr() + L" : " + std::to_wstring(message->line) - ).dispatch(); + L"Showing source location: " + message->filePath.wstr() + L" : " + + std::to_wstring(message->line)) + .dispatch(); } void CodeController::handleMessage(MessageScrollCode* message) @@ -478,13 +489,13 @@ void CodeController::handleMessage(MessageShowReference* message) if (m_referenceIndex >= 0 && m_referenceIndex < m_references.size()) { const Reference& ref = m_references[m_referenceIndex]; - m_codeParams.activeLocationIds = { ref.locationId }; + m_codeParams.activeLocationIds = {ref.locationId}; setFileState( ref.filePath, - getView()->isInListMode() ? MessageChangeFileView::FILE_SNIPPETS : MessageChangeFileView::FILE_MAXIMIZED, - m_codeParams.useSingleFileCache - ); + getView()->isInListMode() ? MessageChangeFileView::FILE_SNIPPETS + : MessageChangeFileView::FILE_MAXIMIZED, + m_codeParams.useSingleFileCache); showFiles(m_codeParams, toReferenceScrollParams(ref), !message->isReplayed()); @@ -500,7 +511,7 @@ void CodeController::handleMessage(MessageShowScope* message) TRACE("code scope"); std::shared_ptr collection = - m_storageAccess->getSourceLocationsForLocationIds({ message->scopeLocationId }); + m_storageAccess->getSourceLocationsForLocationIds({message->scopeLocationId}); SourceLocation* location = collection->getSourceLocationById(message->scopeLocationId); if (!location || !location->isScopeLocation() || !location->getOtherLocation()) @@ -536,63 +547,55 @@ void CodeController::clear() } std::vector CodeController::getFilesForActiveSourceLocations( - const SourceLocationCollection* collection, Id declarationId -) const { + const SourceLocationCollection* collection, Id declarationId) const +{ TRACE(); std::vector files; - collection->forEachSourceLocationFile( - [&](std::shared_ptr file) -> void - { - bool isDeclarationFile = false; - bool isDefinitionFile = false; - file->forEachSourceLocation( - [&](SourceLocation* location) + collection->forEachSourceLocationFile([&](std::shared_ptr file) -> void { + bool isDeclarationFile = false; + bool isDefinitionFile = false; + file->forEachSourceLocation([&](SourceLocation* location) { + for (Id i: location->getTokenIds()) + { + if (i == declarationId) { - for (Id i : location->getTokenIds()) + isDeclarationFile = true; + + if (location->getType() == LOCATION_SCOPE) { - if (i == declarationId) - { - isDeclarationFile = true; - - if (location->getType() == LOCATION_SCOPE) - { - isDefinitionFile = true; - } - - break; - } + isDefinitionFile = true; } - } - ); - CodeFileParams params; - params.locationFile = file; - params.isDeclaration = isDeclarationFile; - params.isDefinition = isDefinitionFile; - files.push_back(params); - } - ); + break; + } + } + }); + + CodeFileParams params; + params.locationFile = file; + params.isDeclaration = isDeclarationFile; + params.isDefinition = isDefinitionFile; + files.push_back(params); + }); std::sort(files.begin(), files.end(), CodeFileParams::sort); return files; } -std::vector CodeController::getFilesForCollection(std::shared_ptr collection) const +std::vector CodeController::getFilesForCollection( + std::shared_ptr collection) const { TRACE(); std::vector files; - collection->forEachSourceLocationFile( - [&](std::shared_ptr file) -> void - { - CodeFileParams params; - params.locationFile = file; - files.push_back(params); - } - ); + collection->forEachSourceLocationFile([&](std::shared_ptr file) -> void { + CodeFileParams params; + params.locationFile = file; + files.push_back(params); + }); return files; } @@ -604,7 +607,8 @@ CodeSnippetParams CodeController::getSnippetParamsForWholeFile( CodeSnippetParams snippet; snippet.startLineNumber = 1; - if (useSingleFileCache && !getView()->isInListMode() && getView()->hasSingleFileCached(locationFile->getFilePath())) + if (useSingleFileCache && !getView()->isInListMode() && + getView()->hasSingleFileCached(locationFile->getFilePath())) { snippet.locationFile = locationFile; return snippet; @@ -613,18 +617,20 @@ CodeSnippetParams CodeController::getSnippetParamsForWholeFile( bool showsErrors = false; if (m_collection->getSourceLocationFiles().size()) { - std::shared_ptr file = m_collection->getSourceLocationFiles().begin()->second; + std::shared_ptr file = + m_collection->getSourceLocationFiles().begin()->second; if (file->getSourceLocations().size()) { showsErrors = (*file->getSourceLocations().begin())->getType() == LOCATION_ERROR; } } - std::shared_ptr textAccess = m_storageAccess->getFileContent(locationFile->getFilePath(), showsErrors); + std::shared_ptr textAccess = m_storageAccess->getFileContent( + locationFile->getFilePath(), showsErrors); snippet.code = textAccess->getText(); - // make a copy of SourceLocationFile so that isWhole flag is different for first snippet adding the file - // and second snippet adding the content + // make a copy of SourceLocationFile so that isWhole flag is different for first snippet adding + // the file and second snippet adding the content snippet.locationFile = std::make_shared(*locationFile.get()); snippet.locationFile->setIsWhole(true); @@ -632,45 +638,40 @@ CodeSnippetParams CodeController::getSnippetParamsForWholeFile( } std::vector CodeController::getSnippetsForFile( - std::shared_ptr activeSourceLocations -) const + std::shared_ptr activeSourceLocations) const { TRACE(); bool showsErrors = false; if (activeSourceLocations->getSourceLocations().size()) { - showsErrors = (*activeSourceLocations->getSourceLocations().begin())->getType() == LOCATION_ERROR; + showsErrors = (*activeSourceLocations->getSourceLocations().begin())->getType() == + LOCATION_ERROR; } - std::shared_ptr textAccess = - m_storageAccess->getFileContent(activeSourceLocations->getFilePath(), showsErrors); + std::shared_ptr textAccess = m_storageAccess->getFileContent( + activeSourceLocations->getFilePath(), showsErrors); size_t lineCount = textAccess->getLineCount(); SnippetMerger fileScopedMerger(1, lineCount); std::map> mergers; std::shared_ptr scopeLocations = - m_storageAccess->getSourceLocationsOfTypeInFile(activeSourceLocations->getFilePath(), LOCATION_SCOPE); - activeSourceLocations->forEachStartSourceLocation( - [&](SourceLocation* location) - { - buildMergerHierarchy(location, scopeLocations.get(), fileScopedMerger, mergers); - } - ); + m_storageAccess->getSourceLocationsOfTypeInFile( + activeSourceLocations->getFilePath(), LOCATION_SCOPE); + activeSourceLocations->forEachStartSourceLocation([&](SourceLocation* location) { + buildMergerHierarchy(location, scopeLocations.get(), fileScopedMerger, mergers); + }); std::vector atomicRanges; std::shared_ptr commentLocations = - m_storageAccess->getSourceLocationsOfTypeInFile(activeSourceLocations->getFilePath(), LOCATION_COMMENT); - commentLocations->forEachStartSourceLocation( - [&](SourceLocation* location) - { - atomicRanges.push_back(SnippetMerger::Range( - SnippetMerger::Border(location->getLineNumber(), false), - SnippetMerger::Border(location->getOtherLocation()->getLineNumber(), false) - )); - } - ); + m_storageAccess->getSourceLocationsOfTypeInFile( + activeSourceLocations->getFilePath(), LOCATION_COMMENT); + commentLocations->forEachStartSourceLocation([&](SourceLocation* location) { + atomicRanges.push_back(SnippetMerger::Range( + SnippetMerger::Border(location->getLineNumber(), false), + SnippetMerger::Border(location->getOtherLocation()->getLineNumber(), false))); + }); atomicRanges = SnippetMerger::Range::mergeAdjacent(atomicRanges); std::deque ranges = fileScopedMerger.merge(atomicRanges); @@ -681,29 +682,35 @@ std::vector CodeController::getSnippetsForFile( for (const SnippetMerger::Range& range: ranges) { CodeSnippetParams params; - params.startLineNumber = std::max(1, range.start.row - (range.start.strong ? 0 : snippetExpandRange)); - params.endLineNumber = std::min(lineCount, range.end.row + (range.end.strong ? 0 : snippetExpandRange)); + params.startLineNumber = std::max( + 1, range.start.row - (range.start.strong ? 0 : snippetExpandRange)); + params.endLineNumber = std::min( + lineCount, range.end.row + (range.end.strong ? 0 : snippetExpandRange)); - params.locationFile = activeSourceLocations->getFilteredByLines(params.startLineNumber, params.endLineNumber); + params.locationFile = activeSourceLocations->getFilteredByLines( + params.startLineNumber, params.endLineNumber); if (params.startLineNumber > 1) { - const SourceLocation* location = - getSourceLocationOfParentScope(params.startLineNumber, scopeLocations.get()); + const SourceLocation* location = getSourceLocationOfParentScope( + params.startLineNumber, scopeLocations.get()); if (location && location->getTokenIds().size()) { - params.title = m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]).getQualifiedName(); + params.title = m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]) + .getQualifiedName(); params.titleId = location->getLocationId(); } } if (params.endLineNumber < lineCount) { - const SourceLocation* location = - getSourceLocationOfParentScope(params.endLineNumber + 1, scopeLocations.get()); + const SourceLocation* location = getSourceLocationOfParentScope( + params.endLineNumber + 1, scopeLocations.get()); if (location && location->getTokenIds().size()) { - params.footer = m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]).getQualifiedName(); + params.footer = m_storageAccess + ->getNameHierarchyForNodeId(location->getTokenIds()[0]) + .getQualifiedName(); params.footerId = location->getLocationId(); } } @@ -717,7 +724,8 @@ std::vector CodeController::getSnippetsForFile( params.footer = activeSourceLocations->getFilePath().wstr(); } - for (const std::string& line: textAccess->getLines(params.startLineNumber, params.endLineNumber)) + for (const std::string& line: + textAccess->getLines(params.startLineNumber, params.endLineNumber)) { params.code += line; } @@ -732,15 +740,13 @@ std::shared_ptr CodeController::buildMergerHierarchy( const SourceLocation* location, const SourceLocationFile* scopeLocations, SnippetMerger& fileScopedMerger, - std::map>& mergers -) const + std::map>& mergers) const { std::shared_ptr currentMerger = std::make_shared( - location->getStartLocation()->getLineNumber(), - location->getEndLocation()->getLineNumber() - ); + location->getStartLocation()->getLineNumber(), location->getEndLocation()->getLineNumber()); - const SourceLocation* scopeLocation = getSourceLocationOfParentScope(location->getLineNumber(), scopeLocations); + const SourceLocation* scopeLocation = getSourceLocationOfParentScope( + location->getLineNumber(), scopeLocations); if (!scopeLocation) { fileScopedMerger.addChild(currentMerger); @@ -748,7 +754,8 @@ std::shared_ptr CodeController::buildMergerHierarchy( } std::shared_ptr nextMerger; - std::map>::iterator it = mergers.find(scopeLocation->getLocationId()); + std::map>::iterator it = mergers.find( + scopeLocation->getLocationId()); if (it == mergers.end()) { nextMerger = buildMergerHierarchy(scopeLocation, scopeLocations, fileScopedMerger, mergers); @@ -767,17 +774,14 @@ const SourceLocation* CodeController::getSourceLocationOfParentScope( { const SourceLocation* location = nullptr; - scopeLocations->forEachStartSourceLocation( - [&location, lineNumber](SourceLocation* scopeLocation) + scopeLocations->forEachStartSourceLocation([&location, lineNumber](SourceLocation* scopeLocation) { + if (scopeLocation->getLineNumber() < lineNumber && + scopeLocation->getEndLocation()->getLineNumber() >= lineNumber && + (!location || *location < *scopeLocation)) { - if (scopeLocation->getLineNumber() < lineNumber && - scopeLocation->getEndLocation()->getLineNumber() >= lineNumber && - (!location || *location < *scopeLocation)) - { - location = scopeLocation; - } + location = scopeLocation; } - ); + }); return location; } @@ -818,7 +822,8 @@ std::vector CodeController::getProjectDescription(SourceLocationFil break; } - std::wstring serializedName = utility::decodeFromUtf8(line.substr(posA + 1, posB - posA - 1)); + std::wstring serializedName = utility::decodeFromUtf8( + line.substr(posA + 1, posB - posA - 1)); NameHierarchy nameHierarchy = NameHierarchy::deserialize(serializedName); Id tokenId = m_storageAccess->getNodeIdForNameHierarchy(nameHierarchy); @@ -828,10 +833,13 @@ std::vector CodeController::getProjectDescription(SourceLocationFil { line.replace(posA, posB - posA + 1, nameString); locationFile->addSourceLocation( - LOCATION_TOKEN, 0, { tokenId }, - startLineNumber + i, posA + 1, - startLineNumber + i, posA + nameString.size() - ); + LOCATION_TOKEN, + 0, + {tokenId}, + startLineNumber + i, + posA + 1, + startLineNumber + i, + posA + nameString.size()); } else { @@ -859,7 +867,7 @@ void CodeController::createReferences() { clearReferences(); - for (CodeFileParams& file : m_files) + for (CodeFileParams& file: m_files) { size_t referenceCountBefore = m_references.size(); @@ -873,57 +881,52 @@ void CodeController::createReferences() { std::map scopeLocationIds; - file.locationFile->forEachStartSourceLocation( - [&](SourceLocation* location) + file.locationFile->forEachStartSourceLocation([&](SourceLocation* location) { + if (location->isScopeLocation()) { - if (location->isScopeLocation()) + for (Id tokenId: location->getTokenIds()) { - for (Id tokenId : location->getTokenIds()) - { - scopeLocationIds.emplace(tokenId, location->getLocationId()); - } + scopeLocationIds.emplace(tokenId, location->getLocationId()); } } - ); + }); - file.locationFile->forEachStartSourceLocation( - [&](SourceLocation* location) + file.locationFile->forEachStartSourceLocation([&](SourceLocation* location) { + if (location->isScopeLocation() || location->getType() == LOCATION_SIGNATURE || + location->getType() == LOCATION_COMMENT || + location->getType() == LOCATION_QUALIFIER) { - if (location->isScopeLocation() || location->getType() == LOCATION_SIGNATURE || - location->getType() == LOCATION_COMMENT || location->getType() == LOCATION_QUALIFIER) - { - return; - } - - if (!location->getTokenIds().size()) - { - Reference ref; - ref.filePath = location->getFilePath(); - ref.tokenId = 0; - ref.locationId = location->getLocationId(); - ref.locationType = location->getType(); - m_references.push_back(ref); - return; - } - - for (Id i : location->getTokenIds()) - { - Reference ref; - ref.filePath = location->getFilePath(); - ref.tokenId = i; - ref.locationId = location->getLocationId(); - ref.locationType = location->getType(); - - std::map::const_iterator it = scopeLocationIds.find(i); - if (it != scopeLocationIds.end()) - { - ref.scopeLocationId = it->second; - } - - m_references.push_back(ref); - } + return; } - ); + + if (!location->getTokenIds().size()) + { + Reference ref; + ref.filePath = location->getFilePath(); + ref.tokenId = 0; + ref.locationId = location->getLocationId(); + ref.locationType = location->getType(); + m_references.push_back(ref); + return; + } + + for (Id i: location->getTokenIds()) + { + Reference ref; + ref.filePath = location->getFilePath(); + ref.tokenId = i; + ref.locationId = location->getLocationId(); + ref.locationType = location->getType(); + + std::map::const_iterator it = scopeLocationIds.find(i); + if (it != scopeLocationIds.end()) + { + ref.scopeLocationId = it->second; + } + + m_references.push_back(ref); + } + }); } file.referenceCount = m_references.size() - referenceCountBefore; @@ -942,9 +945,8 @@ void CodeController::createLocalReferences(const std::set& localSymbolIds) if (localSymbolIds.size()) { - auto func = [&localSymbolIds, this](const SourceLocation* location) - { - for (Id tokenId : location->getTokenIds()) + auto func = [&localSymbolIds, this](const SourceLocation* location) { + for (Id tokenId: location->getTokenIds()) { if (localSymbolIds.find(tokenId) != localSymbolIds.end()) { @@ -959,11 +961,11 @@ void CodeController::createLocalReferences(const std::set& localSymbolIds) }; bool inListMode = getView()->isInListMode(); - for (const CodeFileParams& file : m_files) + for (const CodeFileParams& file: m_files) { if (inListMode) { - for (const CodeSnippetParams& snippet : file.snippetParams) + for (const CodeSnippetParams& snippet: file.snippetParams) { snippet.locationFile->forEachStartSourceLocation(func); } @@ -1037,7 +1039,7 @@ void CodeController::iterateLocalReference(bool next, bool updateView) } const Reference& ref = m_localReferences[m_localReferenceIndex]; - m_codeParams.currentActiveLocalLocationIds = { ref.locationId }; + m_codeParams.currentActiveLocalLocationIds = {ref.locationId}; // synchronise reference navigation with local reference navigation if (ref.locationType == LOCATION_TOKEN) @@ -1065,8 +1067,8 @@ void CodeController::expandVisibleFiles(bool useSingleFileCache) bool inListMode = getView()->isInListMode(); size_t filesToExpand = inListMode ? std::min(int(m_files.size()), 3) : 1; - MessageChangeFileView::FileState state = - inListMode ? MessageChangeFileView::FILE_SNIPPETS : MessageChangeFileView::FILE_MAXIMIZED; + MessageChangeFileView::FileState state = inListMode ? MessageChangeFileView::FILE_SNIPPETS + : MessageChangeFileView::FILE_MAXIMIZED; for (size_t i = 0; i < filesToExpand; i++) { @@ -1083,7 +1085,7 @@ CodeFileParams* CodeController::addSourceLocations(std::shared_ptraddSourceLocationCopies(locationFile.get()); CodeFileParams* file = nullptr; - for (CodeFileParams& f : m_files) + for (CodeFileParams& f: m_files) { if (f.locationFile->getFilePath() == locationFile->getFilePath()) { @@ -1119,24 +1121,24 @@ CodeFileParams* CodeController::addSourceLocations(std::shared_ptrsnippetParams[i]; - if (oldSnippet.endLineNumber + 1 < start) // before + if (oldSnippet.endLineNumber + 1 < start) // before { i++; continue; } - else if (oldSnippet.startLineNumber > end + 1) // after + else if (oldSnippet.startLineNumber > end + 1) // after { break; } - else if (oldSnippet.startLineNumber <= start && oldSnippet.endLineNumber >= end) // containing + else if (oldSnippet.startLineNumber <= start && oldSnippet.endLineNumber >= end) // containing { return nullptr; } - else if (oldSnippet.startLineNumber < start || oldSnippet.endLineNumber > end) // overlaping + else if (oldSnippet.startLineNumber < start || oldSnippet.endLineNumber > end) // overlaping { newSnippet = CodeSnippetParams::merge(newSnippet, oldSnippet); } - else if (oldSnippet.startLineNumber >= start && oldSnippet.endLineNumber <= end) // enclosing + else if (oldSnippet.startLineNumber >= start && oldSnippet.endLineNumber <= end) // enclosing { // copy all source locations from old to new snippet: fulltext locations got lost newSnippet.locationFile->copySourceLocations(oldSnippet.locationFile); @@ -1148,13 +1150,18 @@ CodeFileParams* CodeController::addSourceLocations(std::shared_ptrsnippetParams.insert(file->snippetParams.begin() + i, newSnippet); } - setFileState(*file, getView()->isInListMode() ? MessageChangeFileView::FILE_SNIPPETS : MessageChangeFileView::FILE_MAXIMIZED, m_codeParams.useSingleFileCache); + setFileState( + *file, + getView()->isInListMode() ? MessageChangeFileView::FILE_SNIPPETS + : MessageChangeFileView::FILE_MAXIMIZED, + m_codeParams.useSingleFileCache); return file; } -void CodeController::setFileState(const FilePath& filePath, MessageChangeFileView::FileState state, bool useSingleFileCache) +void CodeController::setFileState( + const FilePath& filePath, MessageChangeFileView::FileState state, bool useSingleFileCache) { - for (CodeFileParams& file : m_files) + for (CodeFileParams& file: m_files) { if (file.locationFile->getFilePath() == filePath) { @@ -1164,7 +1171,8 @@ void CodeController::setFileState(const FilePath& filePath, MessageChangeFileVie } } -void CodeController::setFileState(CodeFileParams& file, MessageChangeFileView::FileState state, bool useSingleFileCache) +void CodeController::setFileState( + CodeFileParams& file, MessageChangeFileView::FileState state, bool useSingleFileCache) { TRACE(); @@ -1180,7 +1188,8 @@ void CodeController::setFileState(CodeFileParams& file, MessageChangeFileView::F { if (file.locationFile->isWhole()) { - file.snippetParams = { getSnippetParamsForWholeFile(file.locationFile, useSingleFileCache) }; + file.snippetParams = { + getSnippetParamsForWholeFile(file.locationFile, useSingleFileCache)}; } else { @@ -1192,7 +1201,8 @@ void CodeController::setFileState(CodeFileParams& file, MessageChangeFileView::F case MessageChangeFileView::FILE_MAXIMIZED: if (!file.fileParams) { - file.fileParams = std::make_shared(getSnippetParamsForWholeFile(file.locationFile, useSingleFileCache)); + file.fileParams = std::make_shared( + getSnippetParamsForWholeFile(file.locationFile, useSingleFileCache)); } if (file.locationFile) @@ -1209,9 +1219,9 @@ bool CodeController::addAllSourceLocations() bool addedNewLocations = false; - for (CodeFileParams& file : m_files) + for (CodeFileParams& file: m_files) { - for (CodeSnippetParams& snippet : file.snippetParams) + for (CodeSnippetParams& snippet: file.snippetParams) { if (snippet.hasAllSourceLocations) { @@ -1220,7 +1230,8 @@ bool CodeController::addAllSourceLocations() if (snippet.locationFile->isWhole()) { - snippet.locationFile = m_storageAccess->getSourceLocationsForFile(snippet.locationFile->getFilePath()); + snippet.locationFile = m_storageAccess->getSourceLocationsForFile( + snippet.locationFile->getFilePath()); if (snippet.locationFile) { snippet.locationFile->copySourceLocations(file.locationFile); @@ -1228,8 +1239,11 @@ bool CodeController::addAllSourceLocations() } else { - std::shared_ptr file = m_storageAccess->getSourceLocationsForLinesInFile( - snippet.locationFile->getFilePath(), snippet.startLineNumber, snippet.endLineNumber); + std::shared_ptr file = + m_storageAccess->getSourceLocationsForLinesInFile( + snippet.locationFile->getFilePath(), + snippet.startLineNumber, + snippet.endLineNumber); if (file) { file->copySourceLocations(snippet.locationFile); @@ -1248,7 +1262,8 @@ bool CodeController::addAllSourceLocations() continue; } - file.fileParams->locationFile = m_storageAccess->getSourceLocationsForFile(file.locationFile->getFilePath()); + file.fileParams->locationFile = m_storageAccess->getSourceLocationsForFile( + file.locationFile->getFilePath()); if (file.fileParams->locationFile) { file.fileParams->locationFile->copySourceLocations(file.locationFile); @@ -1267,19 +1282,19 @@ void CodeController::addModificationTimes() TRACE(); std::vector filePaths; - for (const CodeFileParams& file : m_files) + for (const CodeFileParams& file: m_files) { filePaths.push_back(file.locationFile->getFilePath()); } std::vector fileInfos = m_storageAccess->getFileInfosForFilePaths(filePaths); std::map fileInfoMap; - for (FileInfo& fileInfo : fileInfos) + for (FileInfo& fileInfo: fileInfos) { fileInfoMap.emplace(fileInfo.path, fileInfo); } - for (CodeFileParams& file : m_files) + for (CodeFileParams& file: m_files) { file.modificationTime = fileInfoMap[file.locationFile->getFilePath()].lastWriteTime; } @@ -1294,8 +1309,7 @@ CodeScrollParams CodeController::firstReferenceScrollParams() const return CodeScrollParams::toReference( ref.filePath, ref.scopeLocationId ? ref.scopeLocationId : ref.locationId, - CodeScrollParams::Target::TOP - ); + CodeScrollParams::Target::TOP); } return CodeScrollParams(); @@ -1306,27 +1320,21 @@ CodeScrollParams CodeController::definitionReferenceScrollParams(const std::vect Id activeTokenId = activeTokenIds.size() ? activeTokenIds.front() : 0; if (activeTokenId) { - for (const Reference& ref : m_references) + for (const Reference& ref: m_references) { if (ref.scopeLocationId && ref.tokenId == activeTokenId) { return CodeScrollParams::toReference( - ref.filePath, - ref.scopeLocationId, - CodeScrollParams::Target::TOP - ); + ref.filePath, ref.scopeLocationId, CodeScrollParams::Target::TOP); } } - for (const Reference& ref : m_references) + for (const Reference& ref: m_references) { if (ref.tokenId == activeTokenId) { return CodeScrollParams::toReference( - ref.filePath, - ref.locationId, - CodeScrollParams::Target::TOP - ); + ref.filePath, ref.locationId, CodeScrollParams::Target::TOP); } } } @@ -1339,8 +1347,7 @@ CodeScrollParams CodeController::toReferenceScrollParams(const Reference& ref) c return CodeScrollParams::toReference( ref.filePath, ref.scopeLocationId ? ref.scopeLocationId : ref.locationId, - CodeScrollParams::Target::CENTER - ); + CodeScrollParams::Target::CENTER); } void CodeController::saveOrRestoreViewMode(MessageBase* message) @@ -1362,7 +1369,8 @@ void CodeController::saveOrRestoreViewMode(MessageBase* message) void CodeController::showFirstActiveReference(Id tokenId, bool updateView) { // iterate local references when same tokenId get reactivated (consecutive edge clicks) - if (m_codeParams.activeLocalSymbolIds.size() == 1 && m_codeParams.activeLocalSymbolIds[0] == tokenId && m_localReferences.size()) + if (m_codeParams.activeLocalSymbolIds.size() == 1 && + m_codeParams.activeLocalSymbolIds[0] == tokenId && m_localReferences.size()) { iterateLocalReference(true, updateView); return; @@ -1395,49 +1403,53 @@ void CodeController::showFirstActiveReference(Id tokenId, bool updateView) if (!locationIds.size()) { - std::shared_ptr collection = m_storageAccess->getSourceLocationsForTokenIds({ tokenId }); - collection->forEachSourceLocation( - [&](SourceLocation* location) + std::shared_ptr collection = + m_storageAccess->getSourceLocationsForTokenIds({tokenId}); + collection->forEachSourceLocation([&](SourceLocation* location) { + if (!location->isStartLocation()) { - if (!location->isStartLocation()) + return; + } + + for (Id i: location->getTokenIds()) + { + if (i == tokenId) { + locationIds.push_back(location->getLocationId()); + filePathsToExpand.insert(location->getFilePath()); + + if (!firstReference.tokenId || + filePathOrder[location->getFilePath()] < + filePathOrder[firstReference.filePath]) + { + firstReference.tokenId = tokenId; + firstReference.locationId = location->getLocationId(); + firstReference.filePath = location->getFilePath(); + } return; } - - for (Id i : location->getTokenIds()) - { - if (i == tokenId) - { - locationIds.push_back(location->getLocationId()); - filePathsToExpand.insert(location->getFilePath()); - - if (!firstReference.tokenId || filePathOrder[location->getFilePath()] < filePathOrder[firstReference.filePath]) - { - firstReference.tokenId = tokenId; - firstReference.locationId = location->getLocationId(); - firstReference.filePath = location->getFilePath(); - } - return; - } - } } - ); + }); } if (getView()->isInListMode()) { - for (const FilePath& filePath : filePathsToExpand) + for (const FilePath& filePath: filePathsToExpand) { - setFileState(filePath, MessageChangeFileView::FILE_SNIPPETS, m_codeParams.useSingleFileCache); + setFileState( + filePath, MessageChangeFileView::FILE_SNIPPETS, m_codeParams.useSingleFileCache); } } else if (firstReference.tokenId) { - setFileState(firstReference.filePath, MessageChangeFileView::FILE_MAXIMIZED, m_codeParams.useSingleFileCache); + setFileState( + firstReference.filePath, + MessageChangeFileView::FILE_MAXIMIZED, + m_codeParams.useSingleFileCache); } - createLocalReferences({ tokenId }); - m_codeParams.activeLocalSymbolIds = { tokenId }; + createLocalReferences({tokenId}); + m_codeParams.activeLocalSymbolIds = {tokenId}; m_codeParams.activeLocalSymbolType = LOCATION_TOKEN; m_codeParams.currentActiveLocalLocationIds.clear(); @@ -1462,7 +1474,8 @@ void CodeController::showFiles(CodeView::CodeParams params, CodeScrollParams scr params.referenceIndex = m_referenceIndex >= 0 ? m_referenceIndex : m_references.size(); params.localReferenceCount = m_localReferences.size(); - params.localReferenceIndex = m_localReferenceIndex >= 0 ? m_localReferenceIndex : m_localReferences.size(); + params.localReferenceIndex = m_localReferenceIndex >= 0 ? m_localReferenceIndex + : m_localReferences.size(); if (getView()->isInListMode()) { @@ -1471,7 +1484,7 @@ void CodeController::showFiles(CodeView::CodeParams params, CodeScrollParams scr else { bool updated = false; - for (const CodeFileParams& file : m_files) + for (const CodeFileParams& file: m_files) { if (file.locationFile->getFilePath() == m_currentFilePath) { diff --git a/src/lib/component/controller/CodeController.h b/src/lib/component/controller/CodeController.h index 9ff2dcde..16e5fb10 100644 --- a/src/lib/component/controller/CodeController.h +++ b/src/lib/component/controller/CodeController.h @@ -6,33 +6,33 @@ #include "FilePath.h" #include "LocationType.h" -#include "MessageListener.h" -#include "MessageActivateLegend.h" -#include "MessageCodeReference.h" -#include "MessageCodeShowDefinition.h" #include "MessageActivateErrors.h" -#include "MessageErrorCountClear.h" -#include "MessageShowError.h" #include "MessageActivateFullTextSearch.h" +#include "MessageActivateLegend.h" #include "MessageActivateLocalSymbols.h" #include "MessageActivateOverview.h" #include "MessageActivateTokens.h" #include "MessageActivateTrail.h" #include "MessageActivateTrailEdge.h" #include "MessageChangeFileView.h" +#include "MessageCodeReference.h" +#include "MessageCodeShowDefinition.h" #include "MessageDeactivateEdge.h" +#include "MessageErrorCountClear.h" #include "MessageFlushUpdates.h" #include "MessageFocusIn.h" #include "MessageFocusOut.h" +#include "MessageListener.h" #include "MessageScrollCode.h" #include "MessageScrollToLine.h" +#include "MessageShowError.h" #include "MessageShowReference.h" #include "MessageShowScope.h" #include "types.h" -#include "SnippetMerger.h" -#include "Controller.h" #include "CodeView.h" +#include "Controller.h" +#include "SnippetMerger.h" class StorageAccess; class SourceLocation; @@ -107,12 +107,17 @@ private: std::vector getFilesForActiveSourceLocations( const SourceLocationCollection* collection, Id declarationId) const; - std::vector getFilesForCollection(std::shared_ptr collection) const; - CodeSnippetParams getSnippetParamsForWholeFile(std::shared_ptr locationFile, bool useSingleFileCache) const; - std::vector getSnippetsForFile(std::shared_ptr activeSourceLocations) const; + std::vector getFilesForCollection( + std::shared_ptr collection) const; + CodeSnippetParams getSnippetParamsForWholeFile( + std::shared_ptr locationFile, bool useSingleFileCache) const; + std::vector getSnippetsForFile( + std::shared_ptr activeSourceLocations) const; std::shared_ptr buildMergerHierarchy( - const SourceLocation* location, const SourceLocationFile* scopeLocations, SnippetMerger& fileScopedMerger, + const SourceLocation* location, + const SourceLocationFile* scopeLocations, + SnippetMerger& fileScopedMerger, std::map>& mergers) const; const SourceLocation* getSourceLocationOfParentScope( size_t lineNumber, const SourceLocationFile* scopeLocations) const; @@ -130,8 +135,10 @@ private: void expandVisibleFiles(bool useSingleFileCache); CodeFileParams* addSourceLocations(std::shared_ptr locationFile); - void setFileState(const FilePath& filePath, MessageChangeFileView::FileState state, bool useSingleFileCache); - void setFileState(CodeFileParams& file, MessageChangeFileView::FileState state, bool useSingleFileCache); + void setFileState( + const FilePath& filePath, MessageChangeFileView::FileState state, bool useSingleFileCache); + void setFileState( + CodeFileParams& file, MessageChangeFileView::FileState state, bool useSingleFileCache); bool addAllSourceLocations(); void addModificationTimes(); @@ -163,4 +170,4 @@ private: int m_localReferenceIndex = -1; }; -#endif // CODE_CONTROLLER_H +#endif // CODE_CONTROLLER_H diff --git a/src/lib/component/controller/Controller.cpp b/src/lib/component/controller/Controller.cpp index 4c3a5751..b58677a5 100644 --- a/src/lib/component/controller/Controller.cpp +++ b/src/lib/component/controller/Controller.cpp @@ -1,13 +1,8 @@ -#include "Controller.h" +#include "Controller.h" -Controller::Controller() - : m_component(nullptr) -{ -} +Controller::Controller(): m_component(nullptr) {} -Controller::~Controller() -{ -} +Controller::~Controller() {} void Controller::setComponent(Component* component) { diff --git a/src/lib/component/controller/Controller.h b/src/lib/component/controller/Controller.h index 9e63f3ea..275a49ae 100644 --- a/src/lib/component/controller/Controller.h +++ b/src/lib/component/controller/Controller.h @@ -17,7 +17,7 @@ public: protected: template - ViewType* getView() const; + ViewType* getView() const; private: Component* m_component; @@ -35,4 +35,4 @@ ViewType* Controller::getView() const return nullptr; } -#endif // CONTROLLER_H +#endif // CONTROLLER_H diff --git a/src/lib/component/controller/CustomTrailController.cpp b/src/lib/component/controller/CustomTrailController.cpp index 1dc886b8..43f20efb 100644 --- a/src/lib/component/controller/CustomTrailController.cpp +++ b/src/lib/component/controller/CustomTrailController.cpp @@ -13,8 +13,7 @@ void CustomTrailController::clear() { getView()->clearView(); getView()->setAvailableNodeAndEdgeTypes( - m_storageAccess->getAvailableNodeTypes(), m_storageAccess->getAvailableEdgeTypes() - ); + m_storageAccess->getAvailableNodeTypes(), m_storageAccess->getAvailableEdgeTypes()); } void CustomTrailController::autocomplete(const std::wstring query, bool from) @@ -24,13 +23,14 @@ void CustomTrailController::autocomplete(const std::wstring query, bool from) nodeTypes.remove(NodeType(NodeType::NODE_NAMESPACE)); nodeTypes.remove(NodeType(NodeType::NODE_PACKAGE)); - getView()->showAutocompletions(m_storageAccess->getAutocompletionMatches(query, nodeTypes, false), from); + getView()->showAutocompletions( + m_storageAccess->getAutocompletionMatches(query, nodeTypes, false), from); } void CustomTrailController::activateTrail(MessageActivateTrail message) { Id nodeId = message.originId ? message.originId : message.targetId; - message.searchMatches = m_storageAccess->getSearchMatchesForTokenIds({ nodeId }); + message.searchMatches = m_storageAccess->getSearchMatchesForTokenIds({nodeId}); message.dispatch(); } diff --git a/src/lib/component/controller/CustomTrailController.h b/src/lib/component/controller/CustomTrailController.h index a8ec9ef7..548ba649 100644 --- a/src/lib/component/controller/CustomTrailController.h +++ b/src/lib/component/controller/CustomTrailController.h @@ -2,11 +2,11 @@ #define CUSTOM_TRAIL_CONTROLLER_H #include "Controller.h" +#include "MessageActivateTrail.h" #include "MessageCustomTrailShow.h" +#include "MessageIndexingFinished.h" #include "MessageListener.h" #include "MessageWindowClosed.h" -#include "MessageIndexingFinished.h" -#include "MessageActivateTrail.h" class CustomTrailView; class StorageAccess; @@ -37,4 +37,4 @@ private: StorageAccess* m_storageAccess; }; -#endif // CUSTOM_TRAIL_CONTROLLER_H +#endif // CUSTOM_TRAIL_CONTROLLER_H diff --git a/src/lib/component/controller/ErrorController.cpp b/src/lib/component/controller/ErrorController.cpp index 2a34f1b0..311ddfec 100644 --- a/src/lib/component/controller/ErrorController.cpp +++ b/src/lib/component/controller/ErrorController.cpp @@ -7,14 +7,9 @@ #include "StorageAccess.h" #include "TabId.h" -ErrorController::ErrorController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) -{ -} +ErrorController::ErrorController(StorageAccess* storageAccess): m_storageAccess(storageAccess) {} -ErrorController::~ErrorController() -{ -} +ErrorController::~ErrorController() {} void ErrorController::errorFilterChanged(const ErrorFilter& filter) { @@ -83,7 +78,7 @@ void ErrorController::handleMessage(MessageErrorCountUpdate* message) filter.limit = 0; std::vector errors; - for (const ErrorInfo& error : message->newErrors) + for (const ErrorInfo& error: message->newErrors) { if (filter.filter(error)) { @@ -118,8 +113,7 @@ void ErrorController::handleMessage(MessageErrorsForFile* message) if (project && project->isIndexing()) { Application::getInstance()->handleDialog( - L"Showing errors for a file is not possible while indexing." - ); + L"Showing errors for a file is not possible while indexing."); return; } @@ -197,7 +191,8 @@ bool ErrorController::showErrors(const ErrorFilter& filter, bool scrollTo) } else { - errors = m_storageAccess->getErrorsForFileLimited(filter, m_tabActiveFilePath[TabId::currentTab()]); + errors = m_storageAccess->getErrorsForFileLimited( + filter, m_tabActiveFilePath[TabId::currentTab()]); } ErrorCountInfo errorCount(errors); diff --git a/src/lib/component/controller/ErrorController.h b/src/lib/component/controller/ErrorController.h index d17fd6a3..1cc29fa7 100644 --- a/src/lib/component/controller/ErrorController.h +++ b/src/lib/component/controller/ErrorController.h @@ -2,15 +2,15 @@ #define ERROR_CONTROLLER_H #include "ActivationListener.h" -#include "MessageListener.h" #include "MessageErrorCountClear.h" #include "MessageErrorCountUpdate.h" #include "MessageErrorsAll.h" #include "MessageErrorsForFile.h" #include "MessageErrorsHelpMessage.h" -#include "MessageShowError.h" #include "MessageIndexingFinished.h" #include "MessageIndexingStarted.h" +#include "MessageListener.h" +#include "MessageShowError.h" #include "Controller.h" #include "ErrorView.h" @@ -65,4 +65,4 @@ private: bool m_newErrorsAdded = false; }; -#endif // ERROR_CONTROLLER_H +#endif // ERROR_CONTROLLER_H diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index c9b8e640..7347922e 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -10,21 +10,20 @@ #include "GraphView.h" #include "GraphViewStyle.h" #include "ListLayouter.h" -#include "logging.h" #include "MessageActivateNodes.h" #include "MessageStatus.h" #include "StorageAccess.h" #include "TokenComponentAccess.h" #include "TokenComponentFilePath.h" #include "TokenComponentInheritanceChain.h" -#include "tracing.h" #include "TrailLayouter.h" +#include "logging.h" +#include "tracing.h" #include "utility.h" #include "utilityString.h" GraphController::GraphController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) - , m_useBezierEdges(false) + : m_storageAccess(storageAccess), m_useBezierEdges(false) { } @@ -67,8 +66,9 @@ void GraphController::handleMessage(MessageActivateOverview* message) if (message->acceptedNodeTypes != NodeTypeSet::all()) { createDummyGraphAndSetActiveAndVisibility( - std::vector(), m_storageAccess->getGraphForNodeTypes(message->acceptedNodeTypes), false - ); + std::vector(), + m_storageAccess->getGraphForNodeTypes(message->acceptedNodeTypes), + false); addCharacterIndex(); layoutNesting(); @@ -76,7 +76,8 @@ void GraphController::handleMessage(MessageActivateOverview* message) } else { - createDummyGraphAndSetActiveAndVisibility(std::vector(), m_storageAccess->getGraphForAll(), false); + createDummyGraphAndSetActiveAndVisibility( + std::vector(), m_storageAccess->getGraphForAll(), false); bundleNodesByType(); @@ -97,7 +98,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) if (message->isEdge || message->keepContent()) { m_activeEdgeIds = message->tokenIds; - if (message->isAggregation) // only on redo + if (message->isAggregation) // only on redo { m_activeEdgeIds.clear(); } @@ -138,7 +139,8 @@ void GraphController::handleMessage(MessageActivateTokens* message) std::vector tokenIds = utility::concat(m_activeNodeIds, m_activeEdgeIds); bool isNamespace = false; - std::shared_ptr graph = m_storageAccess->getGraphForActiveTokenIds(tokenIds, getExpandedNodeIds(), &isNamespace); + std::shared_ptr graph = m_storageAccess->getGraphForActiveTokenIds( + tokenIds, getExpandedNodeIds(), &isNamespace); createDummyGraphAndSetActiveAndVisibility(tokenIds, graph, !message->isFromSearch); @@ -167,7 +169,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) else if (message->isAggregation) { bool isInheritanceChain = true; - for (const auto& edge : m_dummyEdges) + for (const auto& edge: m_dummyEdges) { if (!edge->data->isType(Edge::EDGE_INHERITANCE)) { @@ -178,7 +180,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) if (isInheritanceChain) { - for (auto& node : m_dummyNodes) + for (auto& node: m_dummyNodes) { node->bundleInfo.layoutVertical = true; } @@ -186,7 +188,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) m_useBezierEdges = !isInheritanceChain; - for (const std::shared_ptr& edge : m_dummyEdges) + for (const std::shared_ptr& edge: m_dummyEdges) { edge->active = false; } @@ -214,7 +216,12 @@ void GraphController::handleMessage(MessageActivateTrail* message) m_activeEdgeIds.clear(); std::shared_ptr graph = m_storageAccess->getGraphForTrail( - message->originId, message->targetId, message->nodeTypes, message->edgeTypes, message->nodeNonIndexed, message->depth, + message->originId, + message->targetId, + message->nodeTypes, + message->edgeTypes, + message->nodeNonIndexed, + message->depth, true /* !message->custom || (message->originId && message->targetId) */); // remove non-indexed files from include graph if indexed file is origin @@ -224,17 +231,14 @@ void GraphController::handleMessage(MessageActivateTrail* message) if (fileNode && fileNode->isDefined()) { std::vector nodesToRemove; - graph->forEachNode( - [&nodesToRemove](Node* node) + graph->forEachNode([&nodesToRemove](Node* node) { + if (!node->isDefined()) { - if (!node->isDefined()) - { - nodesToRemove.push_back(node); - } + nodesToRemove.push_back(node); } - ); + }); - for (Node* node : nodesToRemove) + for (Node* node: nodesToRemove) { graph->removeNode(node); } @@ -246,19 +250,20 @@ void GraphController::handleMessage(MessageActivateTrail* message) MessageStatus(L"No trail graph found.", true).dispatch(); Application::getInstance()->handleDialog( - L"No custom trail was found between the specified symbols with the specified parameters.", - { L"Ok" } - ); + L"No custom trail was found between the specified symbols with the specified " + L"parameters.", + {L"Ok"}); } else if (graph->getNodeCount() > 1000) { int r = Application::getInstance()->handleDialog( - L"Warning!\n\nThe graph will contain " + std::to_wstring(graph->getNodeCount()) + " nodes. " - L"Layouting and drawing might take a while and the resulting graph could look confusing. Please " - L"consider reducing graph depth with the slider on the left.\n\n" - L"Do you want to proceed?", - { L"Yes", L"No" } - ); + L"Warning!\n\nThe graph will contain " + std::to_wstring(graph->getNodeCount()) + + " nodes. " + L"Layouting and drawing might take a while and the resulting graph could look " + L"confusing. Please " + L"consider reducing graph depth with the slider on the left.\n\n" + L"Do you want to proceed?", + {L"Yes", L"No"}); if (r == 1) { @@ -271,7 +276,7 @@ void GraphController::handleMessage(MessageActivateTrail* message) m_graph->setTrailMode(message->horizontalLayout ? Graph::TRAIL_HORIZONTAL : Graph::TRAIL_VERTICAL); m_graph->setHasTrailOrigin(message->originId); - m_activeNodeIds = { message->originId ? message->originId : message->targetId }; + m_activeNodeIds = {message->originId ? message->originId : message->targetId}; setActive(m_activeNodeIds, true); setVisibility(true); @@ -332,7 +337,7 @@ void GraphController::handleMessage(MessageFocusIn* message) getView()->focusTokenIds(message->tokenIds); } -void GraphController::handleMessage(MessageFocusOut *message) +void GraphController::handleMessage(MessageFocusOut* message) { getView()->defocusTokenIds(message->tokenIds); } @@ -360,14 +365,15 @@ void GraphController::handleMessage(MessageGraphNodeBundleSplit* message) std::vector> nodes; if (node->isBundleNode()) { - nodes = std::vector>(node->bundledNodes.begin(), node->bundledNodes.end()); + nodes = std::vector>( + node->bundledNodes.begin(), node->bundledNodes.end()); } else if (node->isGroupNode()) { nodes = node->subNodes; std::set hiddenEdgeIds(node->hiddenEdgeIds.begin(), node->hiddenEdgeIds.end()); - for (std::shared_ptr& edge : m_dummyEdges) + for (std::shared_ptr& edge: m_dummyEdges) { if (edge->ownerId == node->tokenId || edge->targetId == node->tokenId || (edge->data && hiddenEdgeIds.find(edge->data->getId()) != hiddenEdgeIds.end())) @@ -377,7 +383,7 @@ void GraphController::handleMessage(MessageGraphNodeBundleSplit* message) } m_topLevelAncestorIds.erase(node->tokenId); - for (const std::shared_ptr& subNode : nodes) + for (const std::shared_ptr& subNode: nodes) { m_topLevelAncestorIds[subNode->tokenId] = subNode->tokenId; } @@ -438,15 +444,12 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message) { std::shared_ptr childGraph = m_storageAccess->getGraphForChildrenOfNodeId(nodeId); - childGraph->getNodeById(nodeId)->forEachEdgeOfType(Edge::EDGE_MEMBER, - [this](Edge* edge) - { - m_graph->addEdgeAsPlainCopy(edge); - } - ); + childGraph->getNodeById(nodeId)->forEachEdgeOfType( + Edge::EDGE_MEMBER, [this](Edge* edge) { m_graph->addEdgeAsPlainCopy(edge); }); Node* node = m_graph->getNodeById(nodeId); - std::vector> newDummyNodes = createDummyNodeTopDown(node, node->getLastParentNode()->getId()); + std::vector> newDummyNodes = createDummyNodeTopDown( + node, node->getLastParentNode()->getId()); if (newDummyNodes.size() != 1) { LOG_ERROR("Wrong amount of dummy nodes created"); @@ -454,7 +457,8 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message) } std::shared_ptr newDummyNode = newDummyNodes[0]; - // replace newer dummy graph nodes with the old ones. Nodes will have the correct sorting after that. + // replace newer dummy graph nodes with the old ones. Nodes will have the correct + // sorting after that. newDummyNode->replaceSubGraphNodes(dummyNode->getSubGraphNodes()); // move all newer and older dummy graph nodes into the old dummy node @@ -470,8 +474,8 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message) if (edge && edge->data && edge->data->isType(Edge::EDGE_AGGREGATION) && (edge->targetId == dummyNode->tokenId || edge->ownerId == dummyNode->tokenId)) { - std::vector aggregationIds = - utility::toVector(edge->data->getComponent()->getAggregationIds()); + std::vector aggregationIds = utility::toVector( + edge->data->getComponent()->getAggregationIds()); if (m_graph->getEdgeById(aggregationIds[0]) != nullptr) { @@ -479,18 +483,18 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message) } std::shared_ptr aggregationGraph = - m_storageAccess->getGraphForActiveTokenIds(aggregationIds, std::vector()); + m_storageAccess->getGraphForActiveTokenIds( + aggregationIds, std::vector()); - aggregationGraph->forEachEdge( - [this](Edge* e) + aggregationGraph->forEachEdge([this](Edge* e) { + if (!e->isType(Edge::EDGE_MEMBER)) { - if (!e->isType(Edge::EDGE_MEMBER)) - { - m_dummyEdges.push_back(std::make_shared( - e->getFrom()->getId(), e->getTo()->getId(), m_graph->addEdgeAsPlainCopy(e))); - } + m_dummyEdges.push_back(std::make_shared( + e->getFrom()->getId(), + e->getTo()->getId(), + m_graph->addEdgeAsPlainCopy(e))); } - ); + }); } } } @@ -558,7 +562,7 @@ void GraphController::handleMessage(MessageGraphNodeMove* message) if (m_graph->getTrailMode() != Graph::TRAIL_NONE) { std::set childNodeIds; - for (const std::pair& p : m_topLevelAncestorIds) + for (const std::pair& p: m_topLevelAncestorIds) { if (p.second == message->tokenId) { @@ -566,7 +570,7 @@ void GraphController::handleMessage(MessageGraphNodeMove* message) } } - for (std::shared_ptr edge : m_dummyEdges) + for (std::shared_ptr edge: m_dummyEdges) { if (childNodeIds.find(edge->ownerId) != childNodeIds.end() || childNodeIds.find(edge->targetId) != childNodeIds.end()) @@ -643,32 +647,27 @@ void GraphController::createDummyGraph(const std::shared_ptr graph) std::set addedNodes; std::vector> dummyNodes; - graph->forEachNode( - [&addedNodes, &dummyNodes, this](Node* node) + graph->forEachNode([&addedNodes, &dummyNodes, this](Node* node) { + Node* parent = node->getLastParentNode(); + Id parentId = parent->getId(); + if (addedNodes.find(parentId) != addedNodes.end()) { - Node* parent = node->getLastParentNode(); - Id parentId = parent->getId(); - if (addedNodes.find(parentId) != addedNodes.end()) - { - return; - } - addedNodes.insert(parentId); - - utility::append(dummyNodes, createDummyNodeTopDown(parent, parentId)); + return; } - ); + addedNodes.insert(parentId); + + utility::append(dummyNodes, createDummyNodeTopDown(parent, parentId)); + }); std::set addedEdges; - graph->forEachEdge( - [&addedEdges, this](Edge* edge) + graph->forEachEdge([&addedEdges, this](Edge* edge) { + if (!edge->isType(Edge::EDGE_MEMBER) && addedEdges.find(edge->getId()) == addedEdges.end()) { - if (!edge->isType(Edge::EDGE_MEMBER) && addedEdges.find(edge->getId()) == addedEdges.end()) - { - m_dummyEdges.push_back(std::make_shared(edge->getFrom()->getId(), edge->getTo()->getId(), edge)); - addedEdges.insert(edge->getId()); - } + m_dummyEdges.push_back(std::make_shared( + edge->getFrom()->getId(), edge->getTo()->getId(), edge)); + addedEdges.insert(edge->getId()); } - ); + }); updateDummyNodeNamesAndAddQualifiers(dummyNodes); @@ -680,8 +679,8 @@ void GraphController::createDummyGraph(const std::shared_ptr graph) } void GraphController::createDummyGraphAndSetActiveAndVisibility( - const std::vector& tokenIds, const std::shared_ptr graph, bool keepExpandedNodesExpanded -){ + const std::vector& tokenIds, const std::shared_ptr graph, bool keepExpandedNodesExpanded) +{ std::vector expandedNodeIds; if (keepExpandedNodesExpanded) @@ -721,48 +720,43 @@ std::vector> GraphController::createDummyNodeTopDown( if (node->getType().isPackage()) { - node->forEachChildNode( - [&nodes, &ancestorId, this](Node* child) - { - utility::append(nodes, createDummyNodeTopDown(child, ancestorId)); - } - ); + node->forEachChildNode([&nodes, &ancestorId, this](Node* child) { + utility::append(nodes, createDummyNodeTopDown(child, ancestorId)); + }); return nodes; } - node->forEachChildNode( - [&result, &ancestorId, this](Node* child) + node->forEachChildNode([&result, &ancestorId, this](Node* child) { + DummyNode* parent = nullptr; + AccessKind accessKind = ACCESS_NONE; + + TokenComponentAccess* access = child->getComponent(); + if (access) { - DummyNode* parent = nullptr; - AccessKind accessKind = ACCESS_NONE; - - TokenComponentAccess* access = child->getComponent(); - if (access) - { - accessKind = access->getAccess(); - } - - for (const std::shared_ptr& dummy : result->subNodes) - { - if (dummy->accessKind == accessKind) - { - parent = dummy.get(); - break; - } - } - - if (!parent) - { - std::shared_ptr accessNode = std::make_shared(DummyNode::DUMMY_ACCESS); - accessNode->accessKind = accessKind; - result->subNodes.push_back(accessNode); - parent = accessNode.get(); - } - - utility::append(parent->subNodes, createDummyNodeTopDown(child, ancestorId)); + accessKind = access->getAccess(); } - ); + + for (const std::shared_ptr& dummy: result->subNodes) + { + if (dummy->accessKind == accessKind) + { + parent = dummy.get(); + break; + } + } + + if (!parent) + { + std::shared_ptr accessNode = std::make_shared( + DummyNode::DUMMY_ACCESS); + accessNode->accessKind = accessKind; + result->subNodes.push_back(accessNode); + parent = accessNode.get(); + } + + utility::append(parent->subNodes, createDummyNodeTopDown(child, ancestorId)); + }); return nodes; } @@ -770,7 +764,7 @@ std::vector> GraphController::createDummyNodeTopDown( void GraphController::updateDummyNodeNamesAndAddQualifiers( const std::vector>& dummyNodes) { - for (const std::shared_ptr& node : dummyNodes) + for (const std::shared_ptr& node: dummyNodes) { if (node->isGroupNode() || !node->data || node->data->getType().isFile()) { @@ -789,7 +783,8 @@ void GraphController::updateDummyNodeNamesAndAddQualifiers( if (qualifier.size()) { - std::shared_ptr qualifierNode = std::make_shared(DummyNode::DUMMY_QUALIFIER); + std::shared_ptr qualifierNode = std::make_shared( + DummyNode::DUMMY_QUALIFIER); qualifierNode->qualifierName = qualifier; qualifierNode->visible = true; @@ -803,7 +798,7 @@ void GraphController::updateDummyNodeNamesAndAddQualifiers( std::vector GraphController::getExpandedNodeIds() const { std::vector nodeIds; - for (const std::pair>& p : m_dummyGraphNodes) + for (const std::pair>& p: m_dummyGraphNodes) { DummyNode* oldNode = p.second.get(); if (oldNode->expanded && !oldNode->autoExpanded && oldNode->isGraphNode() && @@ -817,7 +812,7 @@ std::vector GraphController::getExpandedNodeIds() const void GraphController::setExpandedNodeIds(const std::vector& nodeIds) { - for (Id id : nodeIds) + for (Id id: nodeIds) { DummyNode* node = getDummyGraphNodeById(id).get(); if (node) @@ -851,7 +846,7 @@ bool GraphController::setActive(const std::vector& activeTokenIds, bool show if (activeTokenIds.size() > 0) { noActive = true; - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { if (setNodeActiveRecursive(node.get(), activeTokenIds)) { @@ -861,7 +856,7 @@ bool GraphController::setActive(const std::vector& activeTokenIds, bool show } bool noActiveFinal = noActive; - for (const std::shared_ptr& edge : m_dummyEdges) + for (const std::shared_ptr& edge: m_dummyEdges) { if (!edge->data) { @@ -869,7 +864,8 @@ bool GraphController::setActive(const std::vector& activeTokenIds, bool show } edge->active = false; - if (find(activeTokenIds.begin(), activeTokenIds.end(), edge->data->getId()) != activeTokenIds.end()) + if (find(activeTokenIds.begin(), activeTokenIds.end(), edge->data->getId()) != + activeTokenIds.end()) { edge->active = true; noActiveFinal = false; @@ -881,7 +877,8 @@ bool GraphController::setActive(const std::vector& activeTokenIds, bool show bool isInheritance = edge->data->isType(Edge::EDGE_INHERITANCE); if (from && to && !edge->hidden && (showAllEdges || noActive || from->active || to->active || edge->active || isInheritance) && - !(to->active && edge->data->isType(Edge::EDGE_TYPE_USAGE) && to->data->isParentOf(from->data))) // Don't show type use edges to active parent + !(to->active && edge->data->isType(Edge::EDGE_TYPE_USAGE) && + to->data->isParentOf(from->data))) // Don't show type use edges to active parent { edge->visible = true; from->connected = true; @@ -900,7 +897,7 @@ void GraphController::setVisibility(bool noActive) { TRACE(); - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { setNodeVisibilityRecursiveBottomUp(node.get(), noActive); } @@ -920,7 +917,8 @@ bool GraphController::setNodeActiveRecursive(DummyNode* node, const std::vector< if (node->isGraphNode()) { - node->active = find(activeTokenIds.begin(), activeTokenIds.end(), node->data->getId()) != activeTokenIds.end(); + node->active = find(activeTokenIds.begin(), activeTokenIds.end(), node->data->getId()) != + activeTokenIds.end(); if (node->active) { @@ -928,7 +926,7 @@ bool GraphController::setNodeActiveRecursive(DummyNode* node, const std::vector< } } - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (setNodeActiveRecursive(subNode.get(), activeTokenIds)) { @@ -964,7 +962,7 @@ bool GraphController::setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool n return false; } - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (setNodeVisibilityRecursiveBottomUp(subNode.get(), noActive)) { @@ -986,7 +984,8 @@ bool GraphController::setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool n void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool parentExpanded) const { - if (node->isGraphNode() && node->data->getType().getType() == NodeType::NODE_ENUM && !node->isExpanded()) + if (node->isGraphNode() && node->data->getType().getType() == NodeType::NODE_ENUM && + !node->isExpanded()) { node->visible = true; return; @@ -995,7 +994,7 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa if ((node->isGraphNode() && node->isExpanded()) || (node->isAccessNode() && (node->accessKind == ACCESS_NONE || parentExpanded))) { - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (!subNode->isQualifierNode() && !subNode->isExpandToggleNode() && !subNode->hidden) { @@ -1013,12 +1012,13 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa void GraphController::hideBuiltinTypes() { - if (ApplicationSettings::getInstance()->getShowBuiltinTypesInGraph() || m_activeNodeIds.size() != 1) + if (ApplicationSettings::getInstance()->getShowBuiltinTypesInGraph() || + m_activeNodeIds.size() != 1) { return; } - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { if (node->isGraphNode() && !node->active && node->data->getType().isBuiltin()) { @@ -1033,7 +1033,7 @@ void GraphController::bundleNodes() TRACE(); // evaluate top level nodes - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { if (!node->isGraphNode() || !node->visible) { @@ -1043,71 +1043,66 @@ void GraphController::bundleNodes() DummyNode::BundleInfo* bundleInfo = &node->bundleInfo; bundleInfo->isActive = node->hasActiveSubNode(); - node->data->forEachNodeRecursive( - [&bundleInfo](const Node* n) + node->data->forEachNodeRecursive([&bundleInfo](const Node* n) { + if (n->isDefined()) { - if (n->isDefined()) - { - bundleInfo->isDefined = true; - } + bundleInfo->isDefined = true; + } + if (bundleInfo->layoutVertical) + { + return; + } + + n->forEachEdgeOfType(~Edge::EDGE_MEMBER, [&bundleInfo, &n](Edge* e) { if (bundleInfo->layoutVertical) { return; } - n->forEachEdgeOfType( - ~Edge::EDGE_MEMBER, - [&bundleInfo, &n](Edge* e) + if (e->isType(Edge::LAYOUT_VERTICAL)) + { + bundleInfo->layoutVertical = true; + bundleInfo->isReferenced = false; + bundleInfo->isReferencing = false; + } + + if (e->isType(Edge::EDGE_AGGREGATION)) + { + TokenComponentAggregation::Direction dir = + e->getComponent()->getDirection(); + + if (dir == TokenComponentAggregation::DIRECTION_NONE) { - if (bundleInfo->layoutVertical) - { - return; - } - - if (e->isType(Edge::LAYOUT_VERTICAL)) - { - bundleInfo->layoutVertical = true; - bundleInfo->isReferenced = false; - bundleInfo->isReferencing = false; - } - - if (e->isType(Edge::EDGE_AGGREGATION)) - { - TokenComponentAggregation::Direction dir = - e->getComponent()->getDirection(); - - if (dir == TokenComponentAggregation::DIRECTION_NONE) - { - bundleInfo->isReferenced = true; - bundleInfo->isReferencing = true; - } - else if ((dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getFrom() == n) || - (dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getTo() == n)) - { - bundleInfo->isReferencing = true; - } - else if ((dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getTo() == n) || - (dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getFrom() == n)) - { - bundleInfo->isReferenced = true; - } - } - else - { - if (e->getTo() == n) - { - bundleInfo->isReferenced = true; - } - else if (e->getFrom() == n) - { - bundleInfo->isReferencing = true; - } - } + bundleInfo->isReferenced = true; + bundleInfo->isReferencing = true; } - ); - } - ); + else if ( + (dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getFrom() == n) || + (dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getTo() == n)) + { + bundleInfo->isReferencing = true; + } + else if ( + (dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getTo() == n) || + (dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getFrom() == n)) + { + bundleInfo->isReferenced = true; + } + } + else + { + if (e->getTo() == n) + { + bundleInfo->isReferenced = true; + } + else if (e->getFrom() == n) + { + bundleInfo->isReferencing = true; + } + } + }); + }); if (bundleInfo->isReferenced && bundleInfo->isReferencing) { @@ -1134,11 +1129,11 @@ void GraphController::bundleNodes() // bundle bool fileOrMacroActive = false; - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { - if (node->bundleInfo.isActive && ( - node->data->isType(NodeType::NODE_FILE | NodeType::NODE_MACRO) || - node->data->findEdgeOfType(Edge::EDGE_INCLUDE | Edge::EDGE_MACRO_USAGE) != nullptr)) + if (node->bundleInfo.isActive && + (node->data->isType(NodeType::NODE_FILE | NodeType::NODE_MACRO) || + node->data->findEdgeOfType(Edge::EDGE_INCLUDE | Edge::EDGE_MACRO_USAGE) != nullptr)) { fileOrMacroActive = true; break; @@ -1151,103 +1146,87 @@ void GraphController::bundleNodes() } bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { + [](const DummyNode::BundleInfo& info, const Node* data) { return data->getType().isFile() && data->findEdgeOfType(Edge::EDGE_IMPORT); }, 1, false, - L"Importing Files" - ); + L"Importing Files"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { + [](const DummyNode::BundleInfo& info, const Node* data) { return !info.isDefined && info.isReferencing && !info.layoutVertical; }, 2, true, - L"Non-indexed Symbols" - ); + L"Non-indexed Symbols"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { + [](const DummyNode::BundleInfo& info, const Node* data) { return !info.isDefined && info.isReferenced && !info.layoutVertical; }, 2, true, - L"Non-indexed Symbols" - ); + L"Non-indexed Symbols"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { + [](const DummyNode::BundleInfo& info, const Node* data) { return info.isDefined && info.isReferenced && data->getType().isBuiltin(); }, 3, false, - L"Built-in Types" - ); + L"Built-in Types"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { + [](const DummyNode::BundleInfo& info, const Node* data) { return info.isDefined && info.isReferencing && !info.layoutVertical; }, 10, false, - L"Referencing Symbols" - ); + L"Referencing Symbols"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { + [](const DummyNode::BundleInfo& info, const Node* data) { return info.isDefined && info.isReferenced && !info.layoutVertical; }, 10, false, - L"Referenced Symbols" - ); + L"Referenced Symbols"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { - return info.isReferencing && info.layoutVertical && data->findEdgeOfType(Edge::EDGE_TEMPLATE_SPECIALIZATION); + [](const DummyNode::BundleInfo& info, const Node* data) { + return info.isReferencing && info.layoutVertical && + data->findEdgeOfType(Edge::EDGE_TEMPLATE_SPECIALIZATION); }, 5, false, - L"Specializing Symbols" - ); + L"Specializing Symbols"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { - return info.isReferencing && info.layoutVertical && data->findEdgeOfType(Edge::EDGE_INHERITANCE); + [](const DummyNode::BundleInfo& info, const Node* data) { + return info.isReferencing && info.layoutVertical && + data->findEdgeOfType(Edge::EDGE_INHERITANCE); }, 5, false, - L"Derived Symbols" - ); + L"Derived Symbols"); bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { - return info.isReferenced && info.layoutVertical && data->findEdgeOfType(Edge::EDGE_INHERITANCE); + [](const DummyNode::BundleInfo& info, const Node* data) { + return info.isReferenced && info.layoutVertical && + data->findEdgeOfType(Edge::EDGE_INHERITANCE); }, 5, false, - L"Base Symbols" - ); + L"Base Symbols"); } void GraphController::bundleNodesAndEdgesMatching( - std::function matcher, + std::function matcher, size_t count, bool countConnectedNodes, - const std::wstring& name -){ + const std::wstring& name) +{ std::vector matchedNodeIndices; size_t connectedNodeCount = 0; for (size_t i = 0; i < m_dummyNodes.size(); i++) @@ -1270,7 +1249,8 @@ void GraphController::bundleNodesAndEdgesMatching( } size_t matchedNodeCount = countConnectedNodes ? connectedNodeCount : matchedNodeIndices.size(); - if (!matchedNodeIndices.size() || matchedNodeCount < count || matchedNodeIndices.size() == m_dummyNodes.size()) + if (!matchedNodeIndices.size() || matchedNodeCount < count || + matchedNodeIndices.size() == m_dummyNodes.size()) { return; } @@ -1311,9 +1291,9 @@ void GraphController::bundleNodesAndEdgesMatching( std::vector> bundleEdges; std::vector bundledNodes = bundleNode->getAllBundledNodes(); - for (const DummyNode* node : bundledNodes) + for (const DummyNode* node: bundledNodes) { - for (const std::shared_ptr& edge : m_dummyEdges) + for (const std::shared_ptr& edge: m_dummyEdges) { bool owner = (edge->ownerId == node->data->getId()); bool target = (edge->targetId == node->data->getId()); @@ -1324,7 +1304,7 @@ void GraphController::bundleNodesAndEdgesMatching( } DummyEdge* bundleEdgePtr = nullptr; - for (const std::shared_ptr& bundleEdge : bundleEdges) + for (const std::shared_ptr& bundleEdge: bundleEdges) { if ((owner && bundleEdge->ownerId == edge->targetId) || (target && bundleEdge->ownerId == edge->ownerId)) @@ -1354,8 +1334,10 @@ void GraphController::bundleNodesAndEdgesMatching( } std::shared_ptr GraphController::bundleNodesMatching( - std::list>& nodes, std::function matcher, const std::wstring& name -){ + std::list>& nodes, + std::function matcher, + const std::wstring& name) +{ std::vector>::iterator> matchedNodes; for (std::list>::iterator it = nodes.begin(); it != nodes.end(); it++) { @@ -1396,16 +1378,11 @@ std::shared_ptr GraphController::bundleByType( { std::shared_ptr bundleNode = bundleNodesMatching( nodes, - [&](const DummyNode* node) - { - return - (considerInvisibleNodes || node->visible) && - node->isGraphNode() && - node->data->getType() == type && - bundleInfoTree.data.nameMatcher(node->name); + [&](const DummyNode* node) { + return (considerInvisibleNodes || node->visible) && node->isGraphNode() && + node->data->getType() == type && bundleInfoTree.data.nameMatcher(node->name); }, - bundleInfoTree.data.bundleName - ); + bundleInfoTree.data.bundleName); if (bundleNode) { @@ -1419,9 +1396,10 @@ std::shared_ptr GraphController::bundleByType( bundleNode->bundledNodes.clear(); // crate a sub-bundle for anonymous namespaces - for (const Tree& childBundleInfoTree : bundleInfoTree.children) + for (const Tree& childBundleInfoTree: bundleInfoTree.children) { - std::shared_ptr childBundle = bundleByType(bundledNodes, type, childBundleInfoTree, true); + std::shared_ptr childBundle = bundleByType( + bundledNodes, type, childBundleInfoTree, true); if (childBundle) { bundleNode->bundledNodes.insert(childBundle); @@ -1445,12 +1423,13 @@ void GraphController::bundleNodesByType() bool hasNonFileBundle = false; - for (const NodeType& nodeType : NodeType::getOverviewBundleNodeTypesOrdered()) + for (const NodeType& nodeType: NodeType::getOverviewBundleNodeTypesOrdered()) { Tree bundleInfoTree = nodeType.getOverviewBundleTree(); if (bundleInfoTree.data.isValid()) { - std::shared_ptr bundleNode = bundleByType(nodes, nodeType, bundleInfoTree, false); + std::shared_ptr bundleNode = bundleByType( + nodes, nodeType, bundleInfoTree, false); if (bundleNode) { m_dummyNodes.push_back(bundleNode); @@ -1466,7 +1445,8 @@ void GraphController::bundleNodesByType() if (nodes.size() && !hasNonFileBundle) { Tree bundleInfoTree(NodeType::BundleInfo(L"Symbols")); - std::shared_ptr bundleNode = bundleByType(nodes, NodeType::NODE_SYMBOL, bundleInfoTree, false); + std::shared_ptr bundleNode = bundleByType( + nodes, NodeType::NODE_SYMBOL, bundleInfoTree, false); if (bundleNode) { m_dummyNodes.push_back(bundleNode); @@ -1483,7 +1463,7 @@ void GraphController::addCharacterIndex() { // Remove index characters from last time DummyNode::BundledNodesSet newNodes; - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { if (!node->isTextNode()) { @@ -1517,7 +1497,7 @@ void GraphController::addCharacterIndex() bool GraphController::hasCharacterIndex() const { - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { if (node->isTextNode()) { @@ -1543,7 +1523,7 @@ void GraphController::groupNodesByParents(GroupType groupType) if (groupType == GroupType::FILE) { std::vector nodeIds; - for (const std::shared_ptr& dummyNode : m_dummyNodes) + for (const std::shared_ptr& dummyNode: m_dummyNodes) { if (dummyNode->isGraphNode()) { @@ -1555,7 +1535,7 @@ void GraphController::groupNodesByParents(GroupType groupType) } std::map qualifierNameToIdMap; - for (const std::shared_ptr& dummyNode : m_dummyNodes) + for (const std::shared_ptr& dummyNode: m_dummyNodes) { if (dummyNode->isGroupNode()) { @@ -1588,20 +1568,22 @@ void GraphController::groupNodesByParents(GroupType groupType) } else { - qualifierId = m_storageAccess->getNodeIdForNameHierarchy(qualifierNode->qualifierName); + qualifierId = m_storageAccess->getNodeIdForNameHierarchy( + qualifierNode->qualifierName); qualifierNameToIdMap.emplace(qualifierName, qualifierId); } nodesToGroup[qualifierName].push_back(dummyNode); nodeIdtoParentMap.emplace( - dummyNode->tokenId, std::make_pair(qualifierId, qualifierNode->qualifierName)); + dummyNode->tokenId, + std::make_pair(qualifierId, qualifierNode->qualifierName)); } } } } std::set groupedNodeIds; - for (const std::pair>>& p : nodesToGroup) + for (const std::pair>>& p: nodesToGroup) { std::shared_ptr groupNode; @@ -1633,7 +1615,7 @@ void GraphController::groupNodesByParents(GroupType groupType) m_dummyNodes.push_back(groupNode); } - for (std::shared_ptr dummyNode : p.second) + for (std::shared_ptr dummyNode: p.second) { if (dummyNode->hasActiveSubNode()) { @@ -1675,7 +1657,7 @@ DummyNode* GraphController::groupAllNodes(GroupType groupType, Id groupNodeId) groupNode->tokenId = groupNodeId; m_topLevelAncestorIds[groupNode->tokenId] = groupNode->tokenId; - for (std::shared_ptr dummyNode : m_dummyNodes) + for (std::shared_ptr dummyNode: m_dummyNodes) { groupNode->subNodes.push_back(dummyNode); m_topLevelAncestorIds[dummyNode->tokenId] = groupNode->tokenId; @@ -1683,7 +1665,7 @@ DummyNode* GraphController::groupAllNodes(GroupType groupType, Id groupNodeId) if (groupNode->subNodes.size()) { - m_dummyNodes = { groupNode }; + m_dummyNodes = {groupNode}; } return groupNode.get(); @@ -1704,10 +1686,11 @@ void GraphController::groupTrailNodes(GroupType groupType) }; std::set possibleNodeIds; - for (auto dummyNode : m_dummyNodes) + for (auto dummyNode: m_dummyNodes) { if (dummyNode->visible && dummyNode->tokenId && - (!dummyNode->subNodes.size() || (dummyNode->subNodes.size() == 1 && dummyNode->subNodes[0]->isQualifierNode()))) + (!dummyNode->subNodes.size() || + (dummyNode->subNodes.size() == 1 && dummyNode->subNodes[0]->isQualifierNode()))) { possibleNodeIds.insert(dummyNode->tokenId); } @@ -1715,10 +1698,9 @@ void GraphController::groupTrailNodes(GroupType groupType) std::map nodes; - for (const std::shared_ptr& edge : m_dummyEdges) + for (const std::shared_ptr& edge: m_dummyEdges) { - if (edge->visible && - possibleNodeIds.find(edge->ownerId) != possibleNodeIds.end() && + if (edge->visible && possibleNodeIds.find(edge->ownerId) != possibleNodeIds.end() && possibleNodeIds.find(edge->targetId) != possibleNodeIds.end()) { TrailNode& fromNode = nodes[edge->ownerId]; @@ -1778,7 +1760,7 @@ void GraphController::groupTrailNodes(GroupType groupType) std::vector hiddenEdgeIds; - for (TrailNode& node : group) + for (TrailNode& node: group) { std::shared_ptr dummyNode = getDummyGraphNodeById(node.nodeId); if (!dummyNode) @@ -1791,7 +1773,7 @@ void GraphController::groupTrailNodes(GroupType groupType) m_topLevelAncestorIds[node.nodeId] = groupNode->tokenId; - for (DummyEdge* edge : node.targetEdges) + for (DummyEdge* edge: node.targetEdges) { if (!targetEdge->visible) { @@ -1809,7 +1791,7 @@ void GraphController::groupTrailNodes(GroupType groupType) } } - for (DummyEdge* edge : node.originEdges) + for (DummyEdge* edge: node.originEdges) { if (!originEdge->visible) { @@ -1858,12 +1840,12 @@ void GraphController::layoutNesting() extendEqualFunctionNames(m_dummyNodes); - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { layoutNestingRecursive(node.get()); } - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { layoutToGrid(node.get()); } @@ -1872,15 +1854,16 @@ void GraphController::layoutNesting() void GraphController::extendEqualFunctionNames(const std::vector>& nodes) const { std::multimap> functionNames; - for (auto& node : nodes) + for (auto& node: nodes) { - if (node->visible && node->isGraphNode() && node->data->isType(NodeType::NODE_FUNCTION | NodeType::NODE_METHOD)) + if (node->visible && node->isGraphNode() && + node->data->isType(NodeType::NODE_FUNCTION | NodeType::NODE_METHOD)) { functionNames.emplace(node->name, node); } } - for (auto it : functionNames) + for (auto it: functionNames) { if (functionNames.count(it.first) < 2) { @@ -1890,11 +1873,12 @@ void GraphController::extendEqualFunctionNames(const std::vectorsecond->name = it2->second->data->getNameHierarchy().getRawNameWithSignatureParameters(); + it2->second->name = + it2->second->data->getNameHierarchy().getRawNameWithSignatureParameters(); } } - for (auto& node : nodes) + for (auto& node: nodes) { if (node->subNodes.size()) { @@ -1980,7 +1964,7 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces int maxAccessWidth = 0; std::shared_ptr maxWidthAccessNode; - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (!subNode->visible) { @@ -2008,7 +1992,7 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces if (maxAccessWidth > 0) { - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (subNode->visible && subNode->isAccessNode() && subNode != maxWidthAccessNode) { @@ -2027,12 +2011,13 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces switch (node->groupLayout) { case GroupLayout::LIST: - viewSize.x = viewSize.x - 150; // prevent horizontal scroll + viewSize.x = viewSize.x - 150; // prevent horizontal scroll ListLayouter::layoutMultiColumn(viewSize, &node->subNodes); break; case GroupLayout::SKEWED: - ListLayouter::layoutSkewed(&node->subNodes, margins.spacingX, margins.spacingY, viewSize.x() * 1.5); + ListLayouter::layoutSkewed( + &node->subNodes, margins.spacingX, margins.spacingY, viewSize.x() * 1.5); break; case GroupLayout::BUCKET: @@ -2073,7 +2058,7 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces node->size.x = margins.left + width + margins.right; node->size.y = margins.top + margins.charHeight + margins.spacingA + height + margins.bottom; - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (!subNode->visible) { @@ -2096,7 +2081,8 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces void GraphController::addExpandToggleNode(DummyNode* node) const { - std::shared_ptr expandNode = std::make_shared(DummyNode::DUMMY_EXPAND_TOGGLE); + std::shared_ptr expandNode = std::make_shared( + DummyNode::DUMMY_EXPAND_TOGGLE); expandNode->expanded = node->expanded; expandNode->visible = true; @@ -2117,10 +2103,11 @@ void GraphController::addExpandToggleNode(DummyNode* node) const continue; } - for (const std::shared_ptr& subSubNode : subNode->subNodes) + for (const std::shared_ptr& subSubNode: subNode->subNodes) { if ((subSubNode->visible || subSubNode->hidden) && - (!subSubNode->isGraphNode() || !subSubNode->data->isImplicit() || node->data->isImplicit())) + (!subSubNode->isGraphNode() || !subSubNode->data->isImplicit() || + node->data->isImplicit())) { visibleSubNodeCount++; } @@ -2152,7 +2139,7 @@ void GraphController::layoutToGrid(DummyNode* node) const DummyNode* lastAccessNode = nullptr; DummyNode* expandToggleNode = nullptr; - for (const std::shared_ptr& subNode : node->subNodes) + for (const std::shared_ptr& subNode: node->subNodes) { if (!subNode->visible) { @@ -2167,7 +2154,6 @@ void GraphController::layoutToGrid(DummyNode* node) const else if (subNode->isExpandToggleNode()) { expandToggleNode = subNode.get(); - } } @@ -2190,7 +2176,7 @@ void GraphController::layoutGraph(bool getSortedNodes) TRACE(); std::vector> visibleNodes; - for (auto node : m_dummyNodes) + for (auto node: m_dummyNodes) { if (node->visible) { @@ -2242,7 +2228,7 @@ void GraphController::layoutTrail(bool horizontal, bool hasOrigin) } std::vector> visibleNodes; - for (auto node : m_dummyNodes) + for (auto node: m_dummyNodes) { if (node->visible) { @@ -2271,7 +2257,7 @@ std::shared_ptr GraphController::getDummyGraphNodeById(Id tokenId) co return it->second; } - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { if (node->tokenId == tokenId) { @@ -2284,7 +2270,7 @@ std::shared_ptr GraphController::getDummyGraphNodeById(Id tokenId) co DummyEdge* GraphController::getDummyGraphEdgeById(Id tokenId) const { - for (const std::shared_ptr& edge : m_dummyEdges) + for (const std::shared_ptr& edge: m_dummyEdges) { if (edge->data && edge->data->getId() == tokenId) { @@ -2296,7 +2282,10 @@ DummyEdge* GraphController::getDummyGraphEdgeById(Id tokenId) const } void GraphController::relayoutGraph( - MessageBase* message, GraphView::GraphParams params, bool withCharacterIndex, const std::wstring& groupName) + MessageBase* message, + GraphView::GraphParams params, + bool withCharacterIndex, + const std::wstring& groupName) { bool showsTrail = m_graph->getTrailMode() != Graph::TRAIL_NONE; @@ -2331,7 +2320,8 @@ void GraphController::relayoutGraph( if (showsTrail) { - layoutTrail(m_graph->getTrailMode() == Graph::TRAIL_HORIZONTAL, m_graph->hasTrailOrigin()); + layoutTrail( + m_graph->getTrailMode() == Graph::TRAIL_HORIZONTAL, m_graph->hasTrailOrigin()); } else { @@ -2342,8 +2332,7 @@ void GraphController::relayoutGraph( buildGraph(message, params); } -void GraphController::buildGraph( - MessageBase* message, GraphView::GraphParams params) +void GraphController::buildGraph(MessageBase* message, GraphView::GraphParams params) { if (!message->isReplayed()) { @@ -2357,7 +2346,7 @@ void GraphController::buildGraph( void GraphController::forEachDummyNodeRecursive(std::function func) { - for (const std::shared_ptr& node : m_dummyNodes) + for (const std::shared_ptr& node: m_dummyNodes) { node->forEachDummyNodeRecursive(func); } @@ -2365,7 +2354,7 @@ void GraphController::forEachDummyNodeRecursive(std::function void GraphController::forEachDummyEdge(std::function func) { - for (const std::shared_ptr& edge : m_dummyEdges) + for (const std::shared_ptr& edge: m_dummyEdges) { func(edge.get()); } @@ -2377,8 +2366,7 @@ void GraphController::createLegendGraph() std::map nodePositions; std::shared_ptr graph = std::make_shared(); - auto addText = [this](std::wstring text, int fontSizeDiff, Vec2i position) - { + auto addText = [this](std::wstring text, int fontSizeDiff, Vec2i position) { std::shared_ptr node = std::make_shared(DummyNode::DUMMY_TEXT); node->name = text; node->visible = true; @@ -2389,19 +2377,19 @@ void GraphController::createLegendGraph() }; auto addNode = [&id, &graph, &nodePositions]( - NodeType::Type type, const std::wstring& name, Vec2i position, DefinitionKind defKind = DEFINITION_EXPLICIT) - { + NodeType::Type type, + const std::wstring& name, + Vec2i position, + DefinitionKind defKind = DEFINITION_EXPLICIT) { nodePositions.emplace(++id, position); return graph->createNode(id, type, NameHierarchy(name, NAME_DELIMITER_UNKNOWN), defKind); }; - auto addEdge = [&id, &graph](Edge::EdgeType type, Node* from, Node* to) - { + auto addEdge = [&id, &graph](Edge::EdgeType type, Node* from, Node* to) { return graph->createEdge(++id, type, from, to); }; - auto addMember = [&id, &graph](Node* from, Node* to, AccessKind access = ACCESS_NONE) - { + auto addMember = [&id, &graph](Node* from, Node* to, AccessKind access = ACCESS_NONE) { if (access != ACCESS_NONE) { to->addComponent(std::make_shared(access)); @@ -2432,7 +2420,8 @@ void GraphController::createLegendGraph() { Edge* edge = addEdge(Edge::EDGE_AGGREGATION, user, main); - std::shared_ptr aggregationComp = std::make_shared(); + std::shared_ptr aggregationComp = + std::make_shared(); for (size_t i = 0; i < 10; i++) { aggregationComp->addAggregationId(++id, true); @@ -2442,7 +2431,8 @@ void GraphController::createLegendGraph() { Edge* edge = addEdge(Edge::EDGE_AGGREGATION, main, usee); - std::shared_ptr aggregationComp = std::make_shared(); + std::shared_ptr aggregationComp = + std::make_shared(); for (size_t i = 0; i < 10; i++) { aggregationComp->addAggregationId(++id, true); @@ -2461,7 +2451,8 @@ void GraphController::createLegendGraph() Node* func = addNode(NodeType::NODE_FUNCTION, L"function", Vec2i(x + 220, y)); Node* caller = addNode(NodeType::NODE_FUNCTION, L"calling function", Vec2i(x, y)); - Node* var = addNode(NodeType::NODE_GLOBAL_VARIABLE, L"accessed variable", Vec2i(x + 410, y - 50)); + Node* var = addNode( + NodeType::NODE_GLOBAL_VARIABLE, L"accessed variable", Vec2i(x + 410, y - 50)); Node* called = addNode(NodeType::NODE_FUNCTION, L"called function", Vec2i(x + 410, y - 10)); Node* type = addNode(NodeType::NODE_TYPE, L"Referenced Type", Vec2i(x + 410, y + 30)); @@ -2483,7 +2474,8 @@ void GraphController::createLegendGraph() addNode(NodeType::NODE_FILE, L"File", Vec2i(x, y + dy * ++i)); addNode(NodeType::NODE_FILE, L"Non-Indexed File", Vec2i(x, y + dy * ++i), DEFINITION_NONE); - Node* incompleteFile = addNode(NodeType::NODE_FILE, L"Incomplete File", Vec2i(x, y + dy * ++i)); + Node* incompleteFile = addNode( + NodeType::NODE_FILE, L"Incomplete File", Vec2i(x, y + dy * ++i)); incompleteFile->addComponent(std::make_shared(FilePath(), false)); addNode(NodeType::NODE_MACRO, L"Macro", Vec2i(x, y + dy * ++i)); @@ -2501,12 +2493,17 @@ void GraphController::createLegendGraph() addNode(NodeType::NODE_GLOBAL_VARIABLE, L"variable", Vec2i(x, y + dy * ++i)); y -= 15; - addNode(NodeType::NODE_GLOBAL_VARIABLE, L"non-indexed variable", Vec2i(x, y + dy * ++i), DEFINITION_NONE); + addNode( + NodeType::NODE_GLOBAL_VARIABLE, + L"non-indexed variable", + Vec2i(x, y + dy * ++i), + DEFINITION_NONE); y -= 15; addNode(NodeType::NODE_FUNCTION, L"function", Vec2i(x, y + dy * ++i)); y -= 15; - addNode(NodeType::NODE_FUNCTION, L"non-indexed function", Vec2i(x, y + dy * ++i), DEFINITION_NONE); + addNode( + NodeType::NODE_FUNCTION, L"non-indexed function", Vec2i(x, y + dy * ++i), DEFINITION_NONE); y -= 15; Node* typeNode = addNode(NodeType::NODE_TYPE, L"Type with Members", Vec2i(x, y + dy * ++i)); @@ -2544,8 +2541,10 @@ void GraphController::createLegendGraph() y += 10; i += 1; - Node* genericNode = addNode(NodeType::NODE_TYPE, L"JavaGenericType", Vec2i(x, y + dy * ++i)); - Node* genericParameterNode = addNode(NodeType::NODE_TYPE_PARAMETER, L"ParameterType", Vec2i()); + Node* genericNode = addNode( + NodeType::NODE_TYPE, L"JavaGenericType", Vec2i(x, y + dy * ++i)); + Node* genericParameterNode = addNode( + NodeType::NODE_TYPE_PARAMETER, L"ParameterType", Vec2i()); addMember(genericNode, genericParameterNode, ACCESS_TYPE_PARAMETER); i += 2; @@ -2598,7 +2597,8 @@ void GraphController::createLegendGraph() { addText(L"annotation use", 0, Vec2i(x, y + dy * ++i)); Node* type = addNode(NodeType::NODE_TYPE, L"Type", Vec2i(x, y + dy * ++i)); - Node* macro = addNode(NodeType::NODE_ANNOTATION, L"Annotation", Vec2i(x + dx, y + dy * i)); + Node* macro = addNode( + NodeType::NODE_ANNOTATION, L"Annotation", Vec2i(x + dx, y + dy * i)); addEdge(Edge::EDGE_ANNOTATION_USAGE, type, macro); } @@ -2607,7 +2607,8 @@ void GraphController::createLegendGraph() Node* typeA = addNode(NodeType::NODE_TYPE, L"Type A", Vec2i(x, y + dy * ++i)); Node* typeB = addNode(NodeType::NODE_TYPE, L"Type B", Vec2i(x + dx, y + dy * i)); Edge* edge = addEdge(Edge::EDGE_AGGREGATION, typeA, typeB); - std::shared_ptr aggregationComp = std::make_shared(); + std::shared_ptr aggregationComp = + std::make_shared(); for (size_t i = 0; i < 10; i++) { aggregationComp->addAggregationId(++id, true); @@ -2625,32 +2626,38 @@ void GraphController::createLegendGraph() { addText(L"function call", 0, Vec2i(x, y + dy * ++i)); Node* function = addNode(NodeType::NODE_FUNCTION, L"function", Vec2i(x, y + dy * ++i)); - Node* functionB = addNode(NodeType::NODE_FUNCTION, L"function", Vec2i(x + dx, y + dy * i)); + Node* functionB = addNode( + NodeType::NODE_FUNCTION, L"function", Vec2i(x + dx, y + dy * i)); addEdge(Edge::EDGE_CALL, function, functionB); } { addText(L"variable access", 0, Vec2i(x, y + dy * ++i)); Node* function = addNode(NodeType::NODE_FUNCTION, L"function", Vec2i(x, y + dy * ++i)); - Node* variable = addNode(NodeType::NODE_GLOBAL_VARIABLE, L"variable", Vec2i(x + dx, y + dy * i)); + Node* variable = addNode( + NodeType::NODE_GLOBAL_VARIABLE, L"variable", Vec2i(x + dx, y + dy * i)); addEdge(Edge::EDGE_USAGE, function, variable); } { addText(L"class inheritance", 0, Vec2i(x, y + dy * ++i)); Node* base = addNode(NodeType::NODE_CLASS, L"Base Class", Vec2i(x, y + dy * (i + 1))); - Node* derived = addNode(NodeType::NODE_CLASS, L"Derived Class", Vec2i(x, y + dy * (i + 3))); + Node* derived = addNode( + NodeType::NODE_CLASS, L"Derived Class", Vec2i(x, y + dy * (i + 3))); addEdge(Edge::EDGE_INHERITANCE, derived, base); - Node* base2 = addNode(NodeType::NODE_CLASS, L"Base Class", Vec2i(x + 180, y + dy * (i + 1))); - Node* derived2 = addNode(NodeType::NODE_CLASS, L"Derived Derived Class", Vec2i(x + 180, y + dy * (i + 3))); + Node* base2 = addNode( + NodeType::NODE_CLASS, L"Base Class", Vec2i(x + 180, y + dy * (i + 1))); + Node* derived2 = addNode( + NodeType::NODE_CLASS, L"Derived Derived Class", Vec2i(x + 180, y + dy * (i + 3))); Edge* edge = addEdge(Edge::EDGE_INHERITANCE, derived2, base2); - edge->addComponent(std::make_shared(std::vector({ 1, 2 }))); + edge->addComponent( + std::make_shared(std::vector({1, 2}))); i += 3; } { - addText(L"method override", 0, Vec2i(x , y + dy * ++i)); + addText(L"method override", 0, Vec2i(x, y + dy * ++i)); Node* base = addNode(NodeType::NODE_CLASS, L"Base Class", Vec2i(x, y + dy * ++i)); i += 3; Node* derived = addNode(NodeType::NODE_CLASS, L"Derived Class", Vec2i(x, y + dy * i)); @@ -2664,31 +2671,56 @@ void GraphController::createLegendGraph() { addText(L"template specialization", 0, Vec2i(x, y + dy * ++i)); - Node* templateFunctionNode = addNode(NodeType::NODE_FUNCTION, L"template_function", Vec2i(x, y + dy * ++i)); + Node* templateFunctionNode = addNode( + NodeType::NODE_FUNCTION, + L"template_function", + Vec2i(x, y + dy * ++i)); y += 20; - Node* templateFunctionSpecializationNode = addNode(NodeType::NODE_FUNCTION, L"template_function", Vec2i(x, y + dy * ++i), DEFINITION_IMPLICIT); - addEdge(Edge::EDGE_TEMPLATE_SPECIALIZATION, templateFunctionSpecializationNode, templateFunctionNode); + Node* templateFunctionSpecializationNode = addNode( + NodeType::NODE_FUNCTION, + L"template_function", + Vec2i(x, y + dy * ++i), + DEFINITION_IMPLICIT); + addEdge( + Edge::EDGE_TEMPLATE_SPECIALIZATION, + templateFunctionSpecializationNode, + templateFunctionNode); - Node* templateNode = addNode(NodeType::NODE_TYPE, L"TemplateType", Vec2i(x , y + dy * ++i)); + Node* templateNode = addNode( + NodeType::NODE_TYPE, L"TemplateType", Vec2i(x, y + dy * ++i)); y += 30; - Node* templateSpecializationNode = addNode(NodeType::NODE_TYPE, L"TemplateType", Vec2i(x, y + dy * ++i), DEFINITION_IMPLICIT); - Node* argumentNode = addNode(NodeType::NODE_TYPE, L"ArgumentType", Vec2i(x + 270, y + dy * i)); + Node* templateSpecializationNode = addNode( + NodeType::NODE_TYPE, + L"TemplateType", + Vec2i(x, y + dy * ++i), + DEFINITION_IMPLICIT); + Node* argumentNode = addNode( + NodeType::NODE_TYPE, L"ArgumentType", Vec2i(x + 270, y + dy * i)); addEdge(Edge::EDGE_TEMPLATE_SPECIALIZATION, templateSpecializationNode, templateNode); addEdge(Edge::EDGE_TYPE_USAGE, templateSpecializationNode, argumentNode); } { addText(L"template member specialization", 0, Vec2i(x, y + dy * ++i)); - Node* templateNode = addNode(NodeType::NODE_TYPE, L"TemplateType", Vec2i(x, y + dy * ++i)); + Node* templateNode = addNode( + NodeType::NODE_TYPE, L"TemplateType", Vec2i(x, y + dy * ++i)); Node* templateMethodNode = addNode(NodeType::NODE_METHOD, L"method", Vec2i()); addMember(templateNode, templateMethodNode); i += 1; - Node* templateSpecializationNode = addNode(NodeType::NODE_TYPE, L"TemplateType", Vec2i(x, y + dy * ++i + 20), DEFINITION_IMPLICIT); - Node* templateSpecializationMethodNode = addNode(NodeType::NODE_METHOD, L"method", Vec2i(), DEFINITION_IMPLICIT); + Node* templateSpecializationNode = addNode( + NodeType::NODE_TYPE, + L"TemplateType", + Vec2i(x, y + dy * ++i + 20), + DEFINITION_IMPLICIT); + Node* templateSpecializationMethodNode = addNode( + NodeType::NODE_METHOD, L"method", Vec2i(), DEFINITION_IMPLICIT); addMember(templateSpecializationNode, templateSpecializationMethodNode); - addEdge(Edge::EDGE_TEMPLATE_SPECIALIZATION, templateSpecializationMethodNode, templateMethodNode); + addEdge( + Edge::EDGE_TEMPLATE_SPECIALIZATION, + templateSpecializationMethodNode, + templateMethodNode); } } @@ -2696,7 +2728,7 @@ void GraphController::createLegendGraph() createDummyGraphAndSetActiveAndVisibility({}, graph, false); m_dummyNodes = utility::concat(nodes, m_dummyNodes); - for (std::shared_ptr node : m_dummyNodes) + for (std::shared_ptr node: m_dummyNodes) { if (node->tokenId) { diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h index 2cefeaba..9856d3fe 100644 --- a/src/lib/component/controller/GraphController.h +++ b/src/lib/component/controller/GraphController.h @@ -4,7 +4,6 @@ #include #include -#include "MessageListener.h" #include "MessageActivateErrors.h" #include "MessageActivateFullTextSearch.h" #include "MessageActivateLegend.h" @@ -19,6 +18,7 @@ #include "MessageGraphNodeExpand.h" #include "MessageGraphNodeHide.h" #include "MessageGraphNodeMove.h" +#include "MessageListener.h" #include "MessageScrollGraph.h" #include "MessageShowReference.h" @@ -80,7 +80,9 @@ private: void createDummyGraph(const std::shared_ptr graph); void createDummyGraphAndSetActiveAndVisibility( - const std::vector& tokenIds, const std::shared_ptr graph, bool keepExpandedNodesExpanded); + const std::vector& tokenIds, + const std::shared_ptr graph, + bool keepExpandedNodesExpanded); std::vector> createDummyNodeTopDown(Node* node, Id ancestorId); void updateDummyNodeNamesAndAddQualifiers(const std::vector>& dummyNodes); @@ -100,10 +102,14 @@ private: void bundleNodes(); void bundleNodesAndEdgesMatching( - std::function matcher, size_t count, bool countConnectedNodes, + std::function matcher, + size_t count, + bool countConnectedNodes, const std::wstring& name); std::shared_ptr bundleNodesMatching( - std::list>& nodes, std::function matcher, const std::wstring& name); + std::list>& nodes, + std::function matcher, + const std::wstring& name); std::shared_ptr bundleByType( std::list>& nodes, const NodeType& type, @@ -134,7 +140,10 @@ private: DummyEdge* getDummyGraphEdgeById(Id tokenId) const; void relayoutGraph( - MessageBase* message, GraphView::GraphParams params, bool withCharacterIndex, const std::wstring& groupName); + MessageBase* message, + GraphView::GraphParams params, + bool withCharacterIndex, + const std::wstring& groupName); void buildGraph(MessageBase* message, GraphView::GraphParams params); void forEachDummyNodeRecursive(std::function func); @@ -160,4 +169,4 @@ private: bool m_showsLegend = false; }; -#endif // GRAPH_CONTROLLER_H +#endif // GRAPH_CONTROLLER_H diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp index 3f8d648b..b5d1dee9 100644 --- a/src/lib/component/controller/IDECommunicationController.cpp +++ b/src/lib/component/controller/IDECommunicationController.cpp @@ -1,29 +1,24 @@ #include "IDECommunicationController.h" #include "FileSystem.h" -#include "logging.h" #include "MessageActivateWindow.h" #include "MessagePingReceived.h" #include "MessageProjectNew.h" #include "MessageStatus.h" #include "MessageTabOpenWith.h" +#include "logging.h" -#include "StorageAccess.h" #include "SourceLocationFile.h" +#include "StorageAccess.h" IDECommunicationController::IDECommunicationController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) - , m_enabled(true) + : m_storageAccess(storageAccess), m_enabled(true) { } -IDECommunicationController::~IDECommunicationController() -{ -} +IDECommunicationController::~IDECommunicationController() {} -void IDECommunicationController::clear() -{ -} +void IDECommunicationController::clear() {} void IDECommunicationController::handleIncomingMessage(const std::wstring& message) { @@ -76,8 +71,7 @@ void IDECommunicationController::sendUpdatePing() } void IDECommunicationController::handleSetActiveTokenMessage( - const NetworkProtocolHelper::SetActiveTokenMessage& message -) + const NetworkProtocolHelper::SetActiveTokenMessage& message) { if (message.valid) { @@ -90,33 +84,32 @@ void IDECommunicationController::handleSetActiveTokenMessage( if (FileSystem::getFileInfoForPath(filePath).lastWriteTime == fileInfo.lastWriteTime) { // file was not modified - std::shared_ptr sourceLocationFile = m_storageAccess->getSourceLocationsForLinesInFile( - filePath, message.row, message.row - ); + std::shared_ptr sourceLocationFile = + m_storageAccess->getSourceLocationsForLinesInFile(filePath, message.row, message.row); std::vector selectedLocationIds; sourceLocationFile->forEachStartSourceLocation( - [&selectedLocationIds, &cursorColumn](SourceLocation* startLocation) - { + [&selectedLocationIds, &cursorColumn](SourceLocation* startLocation) { const SourceLocation* endLocation = startLocation->getEndLocation(); - if ((startLocation->getType() == LOCATION_TOKEN || startLocation->getType() == LOCATION_QUALIFIER - || startLocation->getType() == LOCATION_UNSOLVED) - && startLocation->getLineNumber() == endLocation->getLineNumber() - && startLocation->getColumnNumber() <= cursorColumn - && endLocation->getColumnNumber() + 1 >= cursorColumn) + if ((startLocation->getType() == LOCATION_TOKEN || + startLocation->getType() == LOCATION_QUALIFIER || + startLocation->getType() == LOCATION_UNSOLVED) && + startLocation->getLineNumber() == endLocation->getLineNumber() && + startLocation->getColumnNumber() <= cursorColumn && + endLocation->getColumnNumber() + 1 >= cursorColumn) { selectedLocationIds.push_back(startLocation->getLocationId()); } - } - ); + }); if (!selectedLocationIds.empty()) { MessageStatus( - L"Activating source location from plug-in succeeded: " + filePath.wstr() + L", row: " + - std::to_wstring(message.row) + L", col: " + std::to_wstring(message.column) - ).dispatch(); + L"Activating source location from plug-in succeeded: " + filePath.wstr() + + L", row: " + std::to_wstring(message.row) + L", col: " + + std::to_wstring(message.column)) + .dispatch(); MessageTabOpenWith(0, selectedLocationIds[0]).showNewTab(true).dispatch(); MessageActivateWindow().dispatch(); @@ -132,20 +125,22 @@ void IDECommunicationController::handleSetActiveTokenMessage( else { MessageStatus( - L"Activating source location from plug-in failed. File " + filePath.wstr() - + L" was not found in the project.", - true - ).dispatch(); + L"Activating source location from plug-in failed. File " + filePath.wstr() + + L" was not found in the project.", + true) + .dispatch(); } } } -void IDECommunicationController::handleCreateProjectMessage(const NetworkProtocolHelper::CreateProjectMessage& message) +void IDECommunicationController::handleCreateProjectMessage( + const NetworkProtocolHelper::CreateProjectMessage& message) { LOG_ERROR_STREAM(<< "Network Protocol CreateProjectMessage not supported anymore."); } -void IDECommunicationController::handleCreateCDBProjectMessage(const NetworkProtocolHelper::CreateCDBProjectMessage& message) +void IDECommunicationController::handleCreateCDBProjectMessage( + const NetworkProtocolHelper::CreateCDBProjectMessage& message) { if (message.valid) { @@ -198,13 +193,12 @@ void IDECommunicationController::handleMessage(MessageIDECreateCDB* message) void IDECommunicationController::handleMessage(MessageMoveIDECursor* message) { std::wstring networkMessage = NetworkProtocolHelper::buildSetIDECursorMessage( - message->filePath, message->row, message->column - ); + message->filePath, message->row, message->column); MessageStatus( L"Jump to source location via plug-in: " + message->filePath.wstr() + L", row: " + - std::to_wstring(message->row) + L", col: " + std::to_wstring(message->column) - ).dispatch(); + std::to_wstring(message->row) + L", col: " + std::to_wstring(message->column)) + .dispatch(); sendMessage(networkMessage); } diff --git a/src/lib/component/controller/IDECommunicationController.h b/src/lib/component/controller/IDECommunicationController.h index 160b04e0..12cf459e 100644 --- a/src/lib/component/controller/IDECommunicationController.h +++ b/src/lib/component/controller/IDECommunicationController.h @@ -6,11 +6,11 @@ #include "Controller.h" #include "NetworkProtocolHelper.h" -#include "MessageListener.h" -#include "MessageWindowFocus.h" #include "MessageIDECreateCDB.h" +#include "MessageListener.h" #include "MessageMoveIDECursor.h" #include "MessagePluginPortChange.h" +#include "MessageWindowFocus.h" class StorageAccess; @@ -56,4 +56,4 @@ private: bool m_enabled; }; -#endif // IDE_COMMUNICATION_CONTROLLER_H +#endif // IDE_COMMUNICATION_CONTROLLER_H diff --git a/src/lib/component/controller/RefreshController.cpp b/src/lib/component/controller/RefreshController.cpp index 58981325..87536f3b 100644 --- a/src/lib/component/controller/RefreshController.cpp +++ b/src/lib/component/controller/RefreshController.cpp @@ -2,17 +2,11 @@ #include "RefreshView.h" -RefreshController::RefreshController() -{ -} +RefreshController::RefreshController() {} -RefreshController::~RefreshController() -{ -} +RefreshController::~RefreshController() {} -void RefreshController::clear() -{ -} +void RefreshController::clear() {} RefreshView* RefreshController::getView() { diff --git a/src/lib/component/controller/RefreshController.h b/src/lib/component/controller/RefreshController.h index da6ba32f..97017d7f 100644 --- a/src/lib/component/controller/RefreshController.h +++ b/src/lib/component/controller/RefreshController.h @@ -5,8 +5,7 @@ class RefreshView; -class RefreshController - : public Controller +class RefreshController: public Controller { public: RefreshController(); @@ -18,4 +17,4 @@ private: RefreshView* getView(); }; -#endif // REFRESH_CONTROLLER_H +#endif // REFRESH_CONTROLLER_H diff --git a/src/lib/component/controller/ScreenSearchController.cpp b/src/lib/component/controller/ScreenSearchController.cpp index cef3f9fa..739567ee 100644 --- a/src/lib/component/controller/ScreenSearchController.cpp +++ b/src/lib/component/controller/ScreenSearchController.cpp @@ -2,9 +2,7 @@ #include "ScreenSearchView.h" -void ScreenSearchController::clear() -{ -} +void ScreenSearchController::clear() {} void ScreenSearchController::foundMatches(ScreenSearchResponder* responder, size_t matchCount) { @@ -62,7 +60,7 @@ void ScreenSearchController::search(const std::wstring& query, const std::setisVisible()) { @@ -129,7 +127,7 @@ void ScreenSearchController::clearMatches() getView()->setMatchCount(0); - for (ScreenSearchResponder* responder : m_responders) + for (ScreenSearchResponder* responder: m_responders) { responder->clearMatches(); } diff --git a/src/lib/component/controller/ScreenSearchController.h b/src/lib/component/controller/ScreenSearchController.h index 68fa2b26..f2cc0198 100644 --- a/src/lib/component/controller/ScreenSearchController.h +++ b/src/lib/component/controller/ScreenSearchController.h @@ -66,4 +66,4 @@ private: std::mutex m_matchMutex; }; -#endif // SCREEN_SEARCH_CONTROLLER_H +#endif // SCREEN_SEARCH_CONTROLLER_H diff --git a/src/lib/component/controller/SearchController.cpp b/src/lib/component/controller/SearchController.cpp index 01ed57f3..2fdcc05b 100644 --- a/src/lib/component/controller/SearchController.cpp +++ b/src/lib/component/controller/SearchController.cpp @@ -1,15 +1,12 @@ #include "SearchController.h" -#include "logging.h" #include "MessageTabState.h" #include "SearchView.h" #include "StorageAccess.h" +#include "logging.h" #include "tracing.h" -SearchController::SearchController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) -{ -} +SearchController::SearchController(StorageAccess* storageAccess): m_storageAccess(storageAccess) {} Id SearchController::getSchedulerId() const { @@ -63,7 +60,8 @@ void SearchController::handleMessage(MessageSearchAutocomplete* message) } LOG_INFO(L"autocomplete string: \"" + message->query + L"\""); - view->setAutocompletionList(m_storageAccess->getAutocompletionMatches(message->query, message->acceptedNodeTypes, true)); + view->setAutocompletionList(m_storageAccess->getAutocompletionMatches( + message->query, message->acceptedNodeTypes, true)); } SearchView* SearchController::getView() diff --git a/src/lib/component/controller/SearchController.h b/src/lib/component/controller/SearchController.h index 12f54fe1..5c05a150 100644 --- a/src/lib/component/controller/SearchController.h +++ b/src/lib/component/controller/SearchController.h @@ -3,8 +3,8 @@ #include "ActivationListener.h" #include "Controller.h" -#include "MessageListener.h" #include "MessageFind.h" +#include "MessageListener.h" #include "MessageSearchAutocomplete.h" class StorageAccess; @@ -37,4 +37,4 @@ private: StorageAccess* m_storageAccess; }; -#endif // SEARCH_CONTROLLER_H +#endif // SEARCH_CONTROLLER_H diff --git a/src/lib/component/controller/StatusBarController.cpp b/src/lib/component/controller/StatusBarController.cpp index b06c6571..bd347eb2 100644 --- a/src/lib/component/controller/StatusBarController.cpp +++ b/src/lib/component/controller/StatusBarController.cpp @@ -9,9 +9,7 @@ StatusBarController::StatusBarController(StorageAccess* storageAccess) { } -StatusBarController::~StatusBarController() -{ -} +StatusBarController::~StatusBarController() {} StatusBarView* StatusBarController::getView() { diff --git a/src/lib/component/controller/StatusBarController.h b/src/lib/component/controller/StatusBarController.h index 86deee26..a89f1bcc 100644 --- a/src/lib/component/controller/StatusBarController.h +++ b/src/lib/component/controller/StatusBarController.h @@ -5,12 +5,12 @@ #include "Controller.h" -#include "MessageListener.h" #include "MessageErrorCountClear.h" #include "MessageErrorCountUpdate.h" #include "MessageIndexingFinished.h" #include "MessageIndexingStarted.h" #include "MessageIndexingStatus.h" +#include "MessageListener.h" #include "MessagePingReceived.h" #include "MessageRefresh.h" #include "MessageStatus.h" @@ -52,4 +52,4 @@ private: StorageAccess* m_storageAccess; }; -#endif // STATUS_BAR_CONTROLLER_H +#endif // STATUS_BAR_CONTROLLER_H diff --git a/src/lib/component/controller/StatusController.cpp b/src/lib/component/controller/StatusController.cpp index e1cef9df..402c606d 100644 --- a/src/lib/component/controller/StatusController.cpp +++ b/src/lib/component/controller/StatusController.cpp @@ -9,18 +9,14 @@ StatusController::StatusController() m_statusFilter = ApplicationSettings::getInstance()->getStatusFilter(); } -StatusController::~StatusController() -{ -} +StatusController::~StatusController() {} StatusView* StatusController::getView() const { return Controller::getView(); } -void StatusController::clear() -{ -} +void StatusController::clear() {} void StatusController::handleMessage(MessageClearStatusView* message) { @@ -42,7 +38,7 @@ void StatusController::handleMessage(MessageStatus* message) std::vector stati; - for (const std::wstring& status : message->stati()) + for (const std::wstring& status: message->stati()) { stati.push_back(Status(status, message->isError)); } @@ -68,7 +64,7 @@ void StatusController::addStatus(const std::vector status) { std::vector filteredStatus; - for (const Status& s : status) + for (const Status& s: status) { if (s.type & m_statusFilter) { diff --git a/src/lib/component/controller/StatusController.h b/src/lib/component/controller/StatusController.h index 9b985351..5edf0c03 100644 --- a/src/lib/component/controller/StatusController.h +++ b/src/lib/component/controller/StatusController.h @@ -3,8 +3,8 @@ #include "Controller.h" -#include "MessageListener.h" #include "MessageClearStatusView.h" +#include "MessageListener.h" #include "MessageShowStatus.h" #include "MessageStatus.h" #include "MessageStatusFilterChanged.h" @@ -40,4 +40,4 @@ private: StatusFilter m_statusFilter; }; -#endif // STATUS_CONTROLLER_H +#endif // STATUS_CONTROLLER_H diff --git a/src/lib/component/controller/TabsController.cpp b/src/lib/component/controller/TabsController.cpp index 56696847..a66ff6ed 100644 --- a/src/lib/component/controller/TabsController.cpp +++ b/src/lib/component/controller/TabsController.cpp @@ -3,8 +3,8 @@ #include "Application.h" #include "MessageFind.h" #include "MessageIndexingFinished.h" -#include "MessageSearch.h" #include "MessageScrollToLine.h" +#include "MessageSearch.h" #include "ScreenSearchInterfaces.h" #include "TabId.h" #include "TaskLambda.h" @@ -15,8 +15,7 @@ TabsController::TabsController( ViewLayout* mainLayout, const ViewFactory* viewFactory, StorageAccess* storageAccess, - ScreenSearchSender* screenSearchSender -) + ScreenSearchSender* screenSearchSender) : m_mainLayout(mainLayout) , m_viewFactory(viewFactory) , m_storageAccess(storageAccess) @@ -50,11 +49,12 @@ void TabsController::addTab(Id tabId, SearchMatch match) TaskManager::createScheduler(tabId)->startSchedulerLoopThreaded(); - m_tabs.emplace(tabId, std::make_shared(tabId, m_viewFactory, m_storageAccess, m_screenSearchSender)); + m_tabs.emplace( + tabId, std::make_shared(tabId, m_viewFactory, m_storageAccess, m_screenSearchSender)); if (match.isValid()) { - MessageSearch msg({ match }, NodeTypeSet::all()); + MessageSearch msg({match}, NodeTypeSet::all()); msg.setSchedulerId(tabId); msg.dispatch(); @@ -92,37 +92,25 @@ void TabsController::showTab(Id tabId) m_mainLayout->showOriginalViews(); } - Task::dispatch( - TabId::app(), - std::make_shared( - [this]() - { - m_screenSearchSender->clearMatches(); - } - ) - ); + Task::dispatch(TabId::app(), std::make_shared([this]() { + m_screenSearchSender->clearMatches(); + })); } void TabsController::removeTab(Id tabId) { // use app task scheduler thread to stop running tasks of tab - Task::dispatch( - TabId::background(), - std::make_shared( - [tabId, this]() - { - m_screenSearchSender->clearMatches(); + Task::dispatch(TabId::background(), std::make_shared([tabId, this]() { + m_screenSearchSender->clearMatches(); - TaskScheduler* scheduler = TaskManager::getScheduler(tabId).get(); - scheduler->terminateRunningTasks(); - scheduler->stopSchedulerLoop(); + TaskScheduler* scheduler = TaskManager::getScheduler(tabId).get(); + scheduler->terminateRunningTasks(); + scheduler->stopSchedulerLoop(); - TaskManager::destroyScheduler(tabId); + TaskManager::destroyScheduler(tabId); - getView()->destroyTab(tabId); - } - ) - ); + getView()->destroyTab(tabId); + })); } void TabsController::destroyTab(Id tabId) @@ -193,7 +181,8 @@ void TabsController::handleMessage(MessageTabOpenWith* message) Id tokenId = message->tokenId; if (!tokenId && message->locationId) { - std::vector tokenIds = m_storageAccess->getNodeIdsForLocationIds({ message->locationId }); + std::vector tokenIds = m_storageAccess->getNodeIdsForLocationIds( + {message->locationId}); if (tokenIds.size()) { tokenId = tokenIds[0]; @@ -212,7 +201,7 @@ void TabsController::handleMessage(MessageTabOpenWith* message) if (tokenId) { - std::vector matches = m_storageAccess->getSearchMatchesForTokenIds({ tokenId }); + std::vector matches = m_storageAccess->getSearchMatchesForTokenIds({tokenId}); if (matches.size()) { match = matches[0]; diff --git a/src/lib/component/controller/TabsController.h b/src/lib/component/controller/TabsController.h index e8a0244e..1f4f910b 100644 --- a/src/lib/component/controller/TabsController.h +++ b/src/lib/component/controller/TabsController.h @@ -1,9 +1,9 @@ #ifndef TABS_CONTROLLER_H #define TABS_CONTROLLER_H -#include "MessageListener.h" #include "MessageActivateErrors.h" #include "MessageIndexingFinished.h" +#include "MessageListener.h" #include "MessageTabClose.h" #include "MessageTabOpen.h" #include "MessageTabOpenWith.h" @@ -35,8 +35,7 @@ public: ViewLayout* mainLayout, const ViewFactory* viewFactory, StorageAccess* storageAccess, - ScreenSearchSender* screenSearchSender - ); + ScreenSearchSender* screenSearchSender); // Controller implementation virtual void clear(); @@ -70,4 +69,4 @@ private: std::tuple m_scrollToLine; }; -#endif // TABS_CONTROLLER_H +#endif // TABS_CONTROLLER_H diff --git a/src/lib/component/controller/TooltipController.cpp b/src/lib/component/controller/TooltipController.cpp index fac58578..fa2ed3b9 100644 --- a/src/lib/component/controller/TooltipController.cpp +++ b/src/lib/component/controller/TooltipController.cpp @@ -2,8 +2,8 @@ #include "CodeView.h" #include "GraphView.h" -#include "TooltipView.h" #include "StorageAccess.h" +#include "TooltipView.h" #include "MessageActivateSourceLocations.h" #include "TabId.h" @@ -13,14 +13,11 @@ Id TooltipController::TooltipRequest::s_requestId = 1; TooltipController::TooltipController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) - , m_hideRequest(false) + : m_storageAccess(storageAccess), m_hideRequest(false) { } -TooltipController::~TooltipController() -{ -} +TooltipController::~TooltipController() {} void TooltipController::clear() { @@ -90,7 +87,8 @@ void TooltipController::handleMessage(MessageTooltipShow* message) message->sourceLocationIds, message->localSymbolIds); // If a tooltip list would only display one token, then just activate it instead. - // This can happen when edges pointing to the token use the same source location e.g. override edges + // This can happen when edges pointing to the token use the same source location e.g. + // override edges if (!message->force && info.snippets.size() == 1) { MessageActivateSourceLocations(message->sourceLocationIds, false).dispatch(); @@ -120,11 +118,13 @@ TooltipView* TooltipController::getView() const View* TooltipController::getViewForOrigin(TooltipOrigin origin) const { - std::string viewName = (origin == TOOLTIP_ORIGIN_CODE ? CodeView::VIEW_NAME : GraphView::VIEW_NAME); + std::string viewName = + (origin == TOOLTIP_ORIGIN_CODE ? CodeView::VIEW_NAME : GraphView::VIEW_NAME); return getView()->getViewLayout()->findFloatingView(viewName); } -void TooltipController::requestTooltipShow(const std::vector tokenIds, TooltipInfo info, TooltipOrigin origin) +void TooltipController::requestTooltipShow( + const std::vector tokenIds, TooltipInfo info, TooltipOrigin origin) { Id requestId = TooltipRequest::s_requestId++; @@ -144,10 +144,10 @@ void TooltipController::requestTooltipShow(const std::vector tokenIds, Toolt delayMS = 300; } - Task::dispatch(TabId::app(), std::make_shared(delayMS)->addChildTask( - std::make_shared( - [requestId, this]() - { + Task::dispatch( + TabId::app(), + std::make_shared(delayMS)->addChildTask( + std::make_shared([requestId, this]() { std::unique_ptr request; { std::lock_guard lock(m_showRequestMutex); @@ -160,7 +160,8 @@ void TooltipController::requestTooltipShow(const std::vector tokenIds, Toolt if (!request->info.isValid() && request->tokenIds.size()) { - request->info = m_storageAccess->getTooltipInfoForTokenIds(request->tokenIds, request->origin); + request->info = m_storageAccess->getTooltipInfoForTokenIds( + request->tokenIds, request->origin); } if (request->info.isValid()) @@ -168,9 +169,7 @@ void TooltipController::requestTooltipShow(const std::vector tokenIds, Toolt getView()->showTooltip(request->info, getViewForOrigin(request->origin)); m_hideRequest = false; } - } - ) - )); + }))); } void TooltipController::requestTooltipHide() @@ -181,17 +180,14 @@ void TooltipController::requestTooltipHide() } m_hideRequest = true; - Task::dispatch(TabId::app(), std::make_shared(500)->addChildTask( - std::make_shared( - [this]() + Task::dispatch( + TabId::app(), + std::make_shared(500)->addChildTask(std::make_shared([this]() { + if (m_hideRequest) { - if (m_hideRequest) - { - m_hideRequest = false; + m_hideRequest = false; - getView()->hideTooltip(false); - } + getView()->hideTooltip(false); } - ) - )); + }))); } diff --git a/src/lib/component/controller/TooltipController.h b/src/lib/component/controller/TooltipController.h index 235e0b87..796c7c7b 100644 --- a/src/lib/component/controller/TooltipController.h +++ b/src/lib/component/controller/TooltipController.h @@ -2,12 +2,12 @@ #define TOOLTIP_CONTROLLER_H #include "Controller.h" -#include "MessageListener.h" -#include "MessageActivateTokens.h" #include "MessageActivateLocalSymbols.h" +#include "MessageActivateTokens.h" #include "MessageFocusIn.h" #include "MessageFocusOut.h" #include "MessageGraphNodeExpand.h" +#include "MessageListener.h" #include "MessageScrollCode.h" #include "MessageScrollGraph.h" #include "MessageTooltipHide.h" @@ -18,17 +18,17 @@ class StorageAccess; class TooltipView; class TooltipController - : public Controller + : public Controller , public MessageListener , public MessageListener , public MessageListener - , public MessageListener - , public MessageListener - , public MessageListener - , public MessageListener - , public MessageListener - , public MessageListener - , public MessageListener + , public MessageListener + , public MessageListener + , public MessageListener + , public MessageListener + , public MessageListener + , public MessageListener + , public MessageListener { public: TooltipController(StorageAccess* storageAccess); @@ -74,4 +74,4 @@ private: bool m_hideRequest; }; -#endif // TOOLTIP_CONTROLLER_H +#endif // TOOLTIP_CONTROLLER_H diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index a5c15d5f..9058988b 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -5,12 +5,11 @@ #include "utility.h" #include "Application.h" -#include "UndoRedoView.h" -#include "StorageAccess.h" #include "Project.h" +#include "StorageAccess.h" +#include "UndoRedoView.h" -UndoRedoController::UndoRedoController(StorageAccess* storageAccess) - : m_storageAccess(storageAccess) +UndoRedoController::UndoRedoController(StorageAccess* storageAccess): m_storageAccess(storageAccess) { m_iterator = m_list.end(); } @@ -41,9 +40,7 @@ void UndoRedoController::clear() } UndoRedoController::Command::Command(std::shared_ptr message, Order order, bool replayLastOnly) - : message(message) - , order(order) - , replayLastOnly(replayLastOnly) + : message(message), order(order), replayLastOnly(replayLastOnly) { } @@ -64,12 +61,14 @@ void UndoRedoController::handleMessage(MessageActivateFullTextSearch* message) { if (sameMessageTypeAsLast(message) && static_cast(lastMessage())->searchTerm == message->searchTerm && - static_cast(lastMessage())->caseSensitive == message->caseSensitive) + static_cast(lastMessage())->caseSensitive == + message->caseSensitive) { return; } - Command command(std::make_shared(*message), Command::ORDER_ACTIVATE); + Command command( + std::make_shared(*message), Command::ORDER_ACTIVATE); processCommand(command); } @@ -92,14 +91,16 @@ void UndoRedoController::handleMessage(MessageActivateLocalSymbols* message) return; } - Command command(std::make_shared(*message), Command::ORDER_VIEW, true); + Command command( + std::make_shared(*message), Command::ORDER_VIEW, true); processCommand(command); } void UndoRedoController::handleMessage(MessageActivateOverview* message) { if (sameMessageTypeAsLast(message) && - static_cast(lastMessage())->acceptedNodeTypes == message->acceptedNodeTypes) + static_cast(lastMessage())->acceptedNodeTypes == + message->acceptedNodeTypes) { return; } @@ -118,8 +119,7 @@ void UndoRedoController::handleMessage(MessageActivateTokens* message) Command command( std::make_shared(*message), - message->isEdge ? Command::ORDER_ADAPT : Command::ORDER_ACTIVATE - ); + message->isEdge ? Command::ORDER_ADAPT : Command::ORDER_ACTIVATE); processCommand(command); } @@ -134,8 +134,7 @@ void UndoRedoController::handleMessage(MessageActivateTrail* message) Command command( std::make_shared(*message), - message->custom ? Command::ORDER_ACTIVATE : Command::ORDER_ADAPT - ); + message->custom ? Command::ORDER_ACTIVATE : Command::ORDER_ADAPT); processCommand(command); } @@ -153,7 +152,8 @@ void UndoRedoController::handleMessage(MessageActivateTrailEdge* message) void UndoRedoController::handleMessage(MessageChangeFileView* message) { - Command command(std::make_shared(*message), + Command command( + std::make_shared(*message), message->switchesViewMode ? Command::ORDER_ADAPT : Command::ORDER_VIEW); processCommand(command); } @@ -181,8 +181,7 @@ void UndoRedoController::handleMessage(MessageDeactivateEdge* message) do { std::advance(it, -1); - } - while (it != m_list.begin() && it->order != Command::ORDER_ACTIVATE); + } while (it != m_list.begin() && it->order != Command::ORDER_ACTIVATE); MessageBase* m = it->message.get(); bool keepContent = m->keepContent(); @@ -261,8 +260,7 @@ void UndoRedoController::handleMessage(MessageHistoryToPosition* message) do { std::advance(it, 1); - } - while (it != m_list.end() && it->order != Command::ORDER_ACTIVATE); + } while (it != m_list.end() && it->order != Command::ORDER_ACTIVATE); m_iterator = it; @@ -290,7 +288,8 @@ void UndoRedoController::handleMessage(MessageHistoryToPosition* message) } getView()->setUndoButtonEnabled(index > activeIndex + 1); - getView()->setRedoButtonEnabled(m_iterator != m_list.end() && m_iterator->order == Command::ORDER_ACTIVATE); + getView()->setRedoButtonEnabled( + m_iterator != m_list.end() && m_iterator->order == Command::ORDER_ACTIVATE); updateHistory(); } @@ -340,7 +339,7 @@ void UndoRedoController::handleMessage(MessageIndexingFinished* message) { std::list newList; - for (const Command& command : m_list) + for (const Command& command: m_list) { if (command.order == Command::ORDER_ACTIVATE) { @@ -368,12 +367,12 @@ void UndoRedoController::handleMessage(MessageRefreshUI* message) do { std::advance(startIterator, -1); - } - while (startIterator != m_list.begin() && startIterator->order != Command::ORDER_ACTIVATE); + } while (startIterator != m_list.begin() && startIterator->order != Command::ORDER_ACTIVATE); if (startIterator == m_list.begin() || - (message->isAfterIndexing && dynamic_cast(startIterator->message.get()) && - m_storageAccess->getErrorCount().total == 0)) + (message->isAfterIndexing && + dynamic_cast(startIterator->message.get()) && + m_storageAccess->getErrorCount().total == 0)) { MessageActivateOverview msg; msg.setSchedulerId(getSchedulerId()); @@ -447,8 +446,7 @@ void UndoRedoController::replayCommands() do { std::advance(startIterator, -1); - } - while (startIterator != m_list.begin() && startIterator->order != Command::ORDER_ACTIVATE); + } while (startIterator != m_list.begin() && startIterator->order != Command::ORDER_ACTIVATE); replayCommands(startIterator); } @@ -503,11 +501,11 @@ void UndoRedoController::replayCommand(std::list::iterator it) msg->searchMatches.clear(); msg->tokenIds.clear(); - for (SearchMatch match : matches) + for (SearchMatch match: matches) { // TODO: replace duplicate main definition fix with better solution - if (match.nodeType.getType() != NodeType::NODE_FUNCTION || !match.tokenNames.size() || - match.tokenNames[0].getRawName() != L"main") + if (match.nodeType.getType() != NodeType::NODE_FUNCTION || + !match.tokenNames.size() || match.tokenNames[0].getRawName() != L"main") { match.tokenIds = m_storageAccess->getNodeIdsForNameHierarchies(match.tokenNames); } @@ -524,7 +522,8 @@ void UndoRedoController::replayCommand(std::list::iterator it) } else if (m->getType() == MessageActivateErrors::getStaticType()) { - std::shared_ptr currentProject = Application::getInstance()->getCurrentProject(); + std::shared_ptr currentProject = + Application::getInstance()->getCurrentProject(); if (currentProject && currentProject->isIndexing()) { Application::getInstance()->handleDialog(L"Errors cannot be activated while indexing."); @@ -543,7 +542,6 @@ void UndoRedoController::replayCommand(std::list::iterator it) return; } - } m->setIsReplayed(true); @@ -652,11 +650,13 @@ void UndoRedoController::updateHistory() currentIndex = index; } - if (it->order == Command::ORDER_ACTIVATE && dynamic_cast(it->message.get())) + if (it->order == Command::ORDER_ACTIVATE && + dynamic_cast(it->message.get())) { index++; - std::vector matches = dynamic_cast(it->message.get())->getSearchMatches(); + std::vector matches = + dynamic_cast(it->message.get())->getSearchMatches(); if (!matches.size() || matches[0].text.empty()) { continue; @@ -670,8 +670,8 @@ void UndoRedoController::updateHistory() m_historyOffset++; } - if (historyListMatches.size() == historyListSize && - currentIndex != -1 && currentIndex - m_historyOffset != historyListSize - 1) + if (historyListMatches.size() == historyListSize && currentIndex != -1 && + currentIndex - m_historyOffset != historyListSize - 1) { break; } @@ -690,12 +690,12 @@ void UndoRedoController::dump() const { switch (it->order) { - case Command::ORDER_VIEW: - std::cout << "\t"; - case Command::ORDER_ADAPT: - std::cout << "\t"; - case Command::ORDER_ACTIVATE: - break; + case Command::ORDER_VIEW: + std::cout << "\t"; + case Command::ORDER_ADAPT: + std::cout << "\t"; + case Command::ORDER_ACTIVATE: + break; } std::cout << it->message->getType(); diff --git a/src/lib/component/controller/UndoRedoController.h b/src/lib/component/controller/UndoRedoController.h index dd2d88ae..b5bf0b3d 100644 --- a/src/lib/component/controller/UndoRedoController.h +++ b/src/lib/component/controller/UndoRedoController.h @@ -3,8 +3,6 @@ #include -#include "MessageBase.h" -#include "MessageListener.h" #include "MessageActivateErrors.h" #include "MessageActivateFullTextSearch.h" #include "MessageActivateLegend.h" @@ -13,6 +11,7 @@ #include "MessageActivateTokens.h" #include "MessageActivateTrail.h" #include "MessageActivateTrailEdge.h" +#include "MessageBase.h" #include "MessageChangeFileView.h" #include "MessageCodeShowDefinition.h" #include "MessageDeactivateEdge.h" @@ -24,6 +23,7 @@ #include "MessageHistoryToPosition.h" #include "MessageHistoryUndo.h" #include "MessageIndexingFinished.h" +#include "MessageListener.h" #include "MessageRefreshUI.h" #include "MessageScrollCode.h" #include "MessageScrollGraph.h" @@ -140,4 +140,4 @@ private: size_t m_historyOffset; }; -#endif // UNDO_REDO_CONTROLLER_H +#endif // UNDO_REDO_CONTROLLER_H diff --git a/src/lib/component/controller/helper/ActivationListener.cpp b/src/lib/component/controller/helper/ActivationListener.cpp index 2d23595a..3ef48ff5 100644 --- a/src/lib/component/controller/helper/ActivationListener.cpp +++ b/src/lib/component/controller/helper/ActivationListener.cpp @@ -42,10 +42,6 @@ void ActivationListener::handleMessageBase(const MessageActivateBase* message) handleActivation(m_searchMatches); } -void ActivationListener::handleActivation(const MessageActivateBase* message) -{ -} +void ActivationListener::handleActivation(const MessageActivateBase* message) {} -void ActivationListener::handleActivation(const std::vector& searchMatches) -{ -} +void ActivationListener::handleActivation(const std::vector& searchMatches) {} diff --git a/src/lib/component/controller/helper/ActivationListener.h b/src/lib/component/controller/helper/ActivationListener.h index 407bbb22..5b67283d 100644 --- a/src/lib/component/controller/helper/ActivationListener.h +++ b/src/lib/component/controller/helper/ActivationListener.h @@ -1,13 +1,13 @@ #ifndef ACTIVATION_LISTENER_H #define ACTIVATION_LISTENER_H -#include "MessageListener.h" #include "MessageActivateErrors.h" #include "MessageActivateFullTextSearch.h" #include "MessageActivateLegend.h" #include "MessageActivateOverview.h" #include "MessageActivateTokens.h" #include "MessageActivateTrail.h" +#include "MessageListener.h" class ActivationListener : public MessageListener @@ -36,4 +36,4 @@ private: std::vector m_searchMatches; }; -#endif // ACTIVATION_LISTENER_H +#endif // ACTIVATION_LISTENER_H diff --git a/src/lib/component/controller/helper/BucketLayouter.cpp b/src/lib/component/controller/helper/BucketLayouter.cpp index e4f06e50..022db39d 100644 --- a/src/lib/component/controller/helper/BucketLayouter.cpp +++ b/src/lib/component/controller/helper/BucketLayouter.cpp @@ -3,21 +3,9 @@ #include "DummyEdge.h" #include "GraphViewStyle.h" -Bucket::Bucket() - : i(0) - , j(0) - , m_width(0) - , m_height(0) -{ -} +Bucket::Bucket(): i(0), j(0), m_width(0), m_height(0) {} -Bucket::Bucket(int i, int j) - : i(i) - , j(j) - , m_width(0) - , m_height(0) -{ -} +Bucket::Bucket(int i, int j): i(i), j(j), m_width(0), m_height(0) {} int Bucket::getWidth() const { @@ -31,7 +19,7 @@ int Bucket::getHeight() const bool Bucket::hasNode(std::shared_ptr node) const { - for (const std::shared_ptr& n : m_nodes) + for (const std::shared_ptr& n: m_nodes) { if (node == n) { @@ -69,15 +57,17 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical std::vector colWidths; std::vector colHeights; std::vector> nodesInCol; - nodesInCol.push_back({ }); + nodesInCol.push_back({}); int heightDiff = 0; - for (const std::shared_ptr& node : m_nodes) + for (const std::shared_ptr& node: m_nodes) { if (y > height + heightDiff) { - // keep adding to the same columns if it only contains 1 element, which will end up above the middle split - if (nodesInCol.back().size() == 1 && m_nodes.size() > 1 && addVerticalSplit | forceVerticalSplit) + // keep adding to the same columns if it only contains 1 element, which will end up + // above the middle split + if (nodesInCol.back().size() == 1 && m_nodes.size() > 1 && + addVerticalSplit | forceVerticalSplit) { heightDiff = y; } @@ -90,7 +80,7 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical x += GraphViewStyle::toGridOffset(width + 45); width = 0; - nodesInCol.push_back({ }); + nodesInCol.push_back({}); heightDiff = 0; } @@ -115,7 +105,7 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical for (size_t i = 0; i < nodesInCol.size(); i++) { - for (DummyNode* node : nodesInCol[i]) + for (DummyNode* node: nodesInCol[i]) { node->columnSize.x = colWidths[i]; node->columnSize.y = colHeights[i]; @@ -131,8 +121,8 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical } // align each column vertically and leave a gap in the middle where edges can pass through - // NOTE: m_height is not gonna be correct after this, but stays unchanged to allow correct positioning next to - // active node. + // NOTE: m_height is not gonna be correct after this, but stays unchanged to allow correct + // positioning next to active node. int nodeOffset = GraphViewStyle::s_gridCellPadding + GraphViewStyle::s_gridCellSize; for (size_t i = 0; i < nodesInCol.size(); i++) @@ -147,7 +137,7 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical int aboveNodesMaxWidth = 0; int belowNodesMaxWidth = 0; - for (DummyNode* node : nodesInCol[i]) + for (DummyNode* node: nodesInCol[i]) { bool above = true; @@ -168,14 +158,15 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical } else { - offset = mid - (node->position.y + node->size.y) - GraphViewStyle::s_gridCellPadding / 2; + offset = mid - (node->position.y + node->size.y) - + GraphViewStyle::s_gridCellPadding / 2; } hasOffset = true; } - else if (node->position.y + node->size.y < mid && - mid < node->position.y + node->size.y + GraphViewStyle::s_gridCellPadding) + else if (node->position.y + node->size.y < mid && mid < node->position.y + node->size.y + GraphViewStyle::s_gridCellPadding) { - offset = mid - (node->position.y + node->size.y + GraphViewStyle::s_gridCellPadding / 2); + offset = mid - + (node->position.y + node->size.y + GraphViewStyle::s_gridCellPadding / 2); hasOffset = true; } @@ -192,12 +183,12 @@ void Bucket::preLayout(Vec2i viewSize, bool addVerticalSplit, bool forceVertical } offset += (m_height - colHeights[i]) / 2; - for (DummyNode* node : aboveNodes) + for (DummyNode* node: aboveNodes) { node->position.y() += offset - nodeOffset; node->columnSize.x() = aboveNodesMaxWidth; } - for (DummyNode* node : belowNodes) + for (DummyNode* node: belowNodes) { node->position.y() += offset + nodeOffset; node->columnSize.x() = belowNodesMaxWidth; @@ -213,9 +204,10 @@ void Bucket::layout(int x, int y, int width, int height) } Vec2i offset = Vec2i(x + (width - m_width) / 2, y + (height - m_height) / 2); - offset = GraphViewStyle::alignOnRaster((*m_nodes.begin())->position + offset) - (*m_nodes.begin())->position; + offset = GraphViewStyle::alignOnRaster((*m_nodes.begin())->position + offset) - + (*m_nodes.begin())->position; - for (const std::shared_ptr& node : m_nodes) + for (const std::shared_ptr& node: m_nodes) { node->position += offset; } @@ -231,7 +223,7 @@ int Bucket::getMiddleGapX() const int middleGapX = 0; int dist = getWidth() / 2; - for (int colWidth : m_colWidths) + for (int colWidth: m_colWidths) { int gapX = middleGapX + GraphViewStyle::toGridOffset(colWidth + 45); int d = std::abs(getWidth() / 2 - gapX); @@ -247,25 +239,22 @@ int Bucket::getMiddleGapX() const BucketLayouter::BucketLayouter(Vec2i viewSize) - : m_viewSize(viewSize) - , m_i1(0) - , m_j1(0) - , m_i2(0) - , m_j2(0) + : m_viewSize(viewSize), m_i1(0), m_j1(0), m_i2(0), m_j2(0) { m_buckets[0][0] = Bucket(0, 0); } void BucketLayouter::createBuckets( - std::vector>& nodes, const std::vector>& edges -){ + std::vector>& nodes, + const std::vector>& edges) +{ if (!nodes.size()) { return; } bool activeNodeAdded = false; - for (std::shared_ptr& node : nodes) + for (std::shared_ptr& node: nodes) { if (node->hasActiveSubNode() || !edges.size()) { @@ -301,8 +290,10 @@ void BucketLayouter::createBuckets( std::shared_ptr edge = remainingEdges.front(); remainingEdges.pop_front(); - std::shared_ptr owner = findTopMostDummyNodeRecursive(nodes, edge->ownerId, nullptr); - std::shared_ptr target = findTopMostDummyNodeRecursive(nodes, edge->targetId, nullptr); + std::shared_ptr owner = findTopMostDummyNodeRecursive( + nodes, edge->ownerId, nullptr); + std::shared_ptr target = findTopMostDummyNodeRecursive( + nodes, edge->targetId, nullptr); bool horizontal = true; @@ -318,10 +309,11 @@ void BucketLayouter::createBuckets( std::swap(owner, target); } } - else if (edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD || + else if ( + edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD || // put nodes with bidirectional edges on the left (edge->getDirection() == TokenComponentAggregation::DIRECTION_NONE && - !target->bundleInfo.isReferencing && !target->bundleInfo.isReferenced)) + !target->bundleInfo.isReferencing && !target->bundleInfo.isReferenced)) { std::swap(owner, target); } @@ -413,8 +405,8 @@ void BucketLayouter::layoutBuckets(bool addVerticalSplit) verticalOffset = (rect.y + rect.w - m_activeParentNode->size.y) / 2; } - // Calculate x offsets in the middle column to align all columns in each bucket at the column gap closest to the - // middle to avoid weird edge routing. + // Calculate x offsets in the middle column to align all columns in each bucket at the column + // gap closest to the middle to avoid weird edge routing. std::map xOffs; std::map xOffsFront; bool useFront = false; @@ -429,7 +421,8 @@ void BucketLayouter::layoutBuckets(bool addVerticalSplit) // only align if max width bucket has multiple columns if (j != maxMidWidthJ && maxWidthBucket->getColWidths().size() > 1) { - int xOff = maxWidthMiddleGapX - bucket->getMiddleGapX() - (widths[0] - bucket->getWidth()) / 2; + int xOff = maxWidthMiddleGapX - bucket->getMiddleGapX() - + (widths[0] - bucket->getWidth()) / 2; xOffs[j] = xOff; xOffsFront[j] = (bucket->getWidth() - widths[0]) / 2; @@ -505,9 +498,9 @@ std::vector> BucketLayouter::getSortedNodes() } std::shared_ptr BucketLayouter::findTopMostDummyNodeRecursive( - std::vector>& nodes, Id tokenId, std::shared_ptr top -){ - for (const std::shared_ptr& node : nodes) + std::vector>& nodes, Id tokenId, std::shared_ptr top) +{ + for (const std::shared_ptr& node: nodes) { std::shared_ptr t = (top ? top : node); diff --git a/src/lib/component/controller/helper/BucketLayouter.h b/src/lib/component/controller/helper/BucketLayouter.h index 07c1de13..ba21c0c4 100644 --- a/src/lib/component/controller/helper/BucketLayouter.h +++ b/src/lib/component/controller/helper/BucketLayouter.h @@ -71,4 +71,4 @@ private: DummyNode* m_activeParentNode = nullptr; }; -#endif // BUCKET_LAYOUTER_H +#endif // BUCKET_LAYOUTER_H diff --git a/src/lib/component/controller/helper/ControllerProxy.h b/src/lib/component/controller/helper/ControllerProxy.h index 44162f66..c65c3857 100644 --- a/src/lib/component/controller/helper/ControllerProxy.h +++ b/src/lib/component/controller/helper/ControllerProxy.h @@ -11,11 +11,7 @@ template class ControllerProxy { public: - ControllerProxy(View* view, Id schedulerId) - : m_view(view) - , m_schedulerId(schedulerId) - { - } + ControllerProxy(View* view, Id schedulerId): m_view(view), m_schedulerId(schedulerId) {} void execute(std::function callback) { @@ -31,24 +27,21 @@ public: ControllerType* controller = m_view->getController(); if (controller) { - Task::dispatch(m_schedulerId, std::make_shared( - std::bind(callback, controller) - )); + Task::dispatch( + m_schedulerId, std::make_shared(std::bind(callback, controller))); } } - template + template void executeAsTaskWithArgs(FuncType callback, const Args... args) { ControllerType* controller = m_view->getController(); if (controller) { - Task::dispatch(m_schedulerId, std::make_shared( - [func = std::bind(callback, controller, args...)]() - { - func(); - } - )); + Task::dispatch( + m_schedulerId, + std::make_shared( + [func = std::bind(callback, controller, args...)]() { func(); })); } } @@ -57,4 +50,4 @@ private: Id m_schedulerId; }; -#endif // CONTROLLER_PROXY_H +#endif // CONTROLLER_PROXY_H diff --git a/src/lib/component/controller/helper/DummyEdge.h b/src/lib/component/controller/helper/DummyEdge.h index e486a5fe..33c56bc8 100644 --- a/src/lib/component/controller/helper/DummyEdge.h +++ b/src/lib/component/controller/helper/DummyEdge.h @@ -1,8 +1,8 @@ #ifndef DUMMY_EDGE_H #define DUMMY_EDGE_H -#include "types.h" #include "Vector4.h" +#include "types.h" #include "Edge.h" #include "TokenComponentAggregation.h" @@ -101,4 +101,4 @@ struct DummyEdge TokenComponentAggregation::Direction direction; }; -#endif // DUMMY_EDGE_H +#endif // DUMMY_EDGE_H diff --git a/src/lib/component/controller/helper/DummyNode.h b/src/lib/component/controller/helper/DummyNode.h index d2e08f98..e2c9af09 100644 --- a/src/lib/component/controller/helper/DummyNode.h +++ b/src/lib/component/controller/helper/DummyNode.h @@ -7,10 +7,10 @@ #include "utility.h" #include "utilityString.h" -#include "Node.h" +#include "AccessKind.h" #include "GroupType.h" #include "NameHierarchy.h" -#include "AccessKind.h" +#include "Node.h" // temporary data structure for (visual) graph creation process struct DummyNode @@ -54,7 +54,8 @@ public: , layoutVertical(false) , isReferenced(false) , isReferencing(false) - {} + { + } static BundleInfo averageBundleInfo(const std::vector& bundleInfos) { @@ -64,21 +65,31 @@ public: size_t referencedCount = 0; size_t referencingCount = 0; - for (const BundleInfo& info : bundleInfos) + for (const BundleInfo& info: bundleInfos) { - if (info.isActive) activeCount++; - if (info.isDefined) definedCount++; - if (info.layoutVertical) verticalLayoutCount++; - if (info.isReferenced) referencedCount++; - if (info.isReferencing) referencingCount++; + if (info.isActive) + activeCount++; + if (info.isDefined) + definedCount++; + if (info.layoutVertical) + verticalLayoutCount++; + if (info.isReferenced) + referencedCount++; + if (info.isReferencing) + referencingCount++; } BundleInfo info; - if (activeCount >= std::ceil(bundleInfos.size() / 2.0f)) info.isActive = true; - if (definedCount >= std::ceil(bundleInfos.size() / 2.0f)) info.isDefined = true; - if (verticalLayoutCount >= std::ceil(bundleInfos.size() / 2.0f)) info.layoutVertical = true; - if (referencedCount >= std::ceil(bundleInfos.size() / 2.0f)) info.isReferenced = true; - if (referencingCount >= std::ceil(bundleInfos.size() / 2.0f)) info.isReferencing = true; + if (activeCount >= std::ceil(bundleInfos.size() / 2.0f)) + info.isActive = true; + if (definedCount >= std::ceil(bundleInfos.size() / 2.0f)) + info.isDefined = true; + if (verticalLayoutCount >= std::ceil(bundleInfos.size() / 2.0f)) + info.layoutVertical = true; + if (referencedCount >= std::ceil(bundleInfos.size() / 2.0f)) + info.isReferenced = true; + if (referencingCount >= std::ceil(bundleInfos.size() / 2.0f)) + info.isReferencing = true; return info; } @@ -156,7 +167,7 @@ public: bool hasVisibleSubNode() const { - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { if (node->visible) { @@ -174,7 +185,7 @@ public: return true; } - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { if (node->hasActiveSubNode()) { @@ -194,7 +205,7 @@ public: return Vec4i(pos.x, pos.y, pos.x + size.x, pos.y + size.y); } - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { Vec4i rect = node->getActiveSubNodeRect(pos); if (rect.w() > 0) @@ -215,7 +226,7 @@ public: count += 1; } - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { count += node->getActiveSubNodeCount(); } @@ -230,7 +241,7 @@ public: return true; } - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { if (node->hasConnectedSubNode()) { @@ -250,7 +261,7 @@ public: nodes.push_back(this); } - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { utility::append(nodes, node->getConnectedSubNodes()); } @@ -261,7 +272,7 @@ public: std::vector getAllBundledNodes() const { std::vector nodes; - for (const std::shared_ptr& node : bundledNodes) + for (const std::shared_ptr& node: bundledNodes) { utility::append(nodes, node->getConnectedSubNodes()); } @@ -282,7 +293,7 @@ public: { func(this); - for (const std::shared_ptr& node : subNodes) + for (const std::shared_ptr& node: subNodes) { node->forEachDummyNodeRecursive(func); } @@ -297,7 +308,7 @@ public: this->bundleId = bundleId; - for (const std::shared_ptr& node : bundledNodes) + for (const std::shared_ptr& node: bundledNodes) { bundleId = node->setBundleIdRecursive(bundleId); } @@ -316,11 +327,11 @@ public: } size_t subNodeCount = 0; - for (const std::shared_ptr& subNode : subNodes) + for (const std::shared_ptr& subNode: subNodes) { if (subNode->isAccessNode()) { - for (const std::shared_ptr& subSubNode : subNode->subNodes) + for (const std::shared_ptr& subSubNode: subNode->subNodes) { if (subSubNode->isGraphNode() && (implicit || !subSubNode->data->isImplicit())) { @@ -337,11 +348,11 @@ public: { std::map> subGraphNodes; - for (const std::shared_ptr& subNode : subNodes) + for (const std::shared_ptr& subNode: subNodes) { if (subNode->isAccessNode()) { - for (const std::shared_ptr& subSubNode : subNode->subNodes) + for (const std::shared_ptr& subSubNode: subNode->subNodes) { if (subSubNode->isGraphNode()) { @@ -356,7 +367,7 @@ public: void replaceSubGraphNodes(std::map> subGraphNodes) const { - for (const std::shared_ptr& subNode : subNodes) + for (const std::shared_ptr& subNode: subNodes) { if (subNode->isAccessNode()) { @@ -382,7 +393,7 @@ public: std::vector> getAccessNodes() const { std::vector> accessNodes; - for (const std::shared_ptr& subNode : subNodes) + for (const std::shared_ptr& subNode: subNodes) { if (subNode->isAccessNode()) { @@ -407,12 +418,12 @@ public: void sortSubNodesByName() { - std::sort(subNodes.begin(), subNodes.end(), - [](const std::shared_ptr& a, const std::shared_ptr& b) -> bool - { - return a->name < b->name; - } - ); + std::sort( + subNodes.begin(), + subNodes.end(), + [](const std::shared_ptr& a, const std::shared_ptr& b) -> bool { + return a->name < b->name; + }); } bool getsLayouted() const @@ -422,7 +433,7 @@ public: const DummyNode* getQualifierNode() const { - for (const std::shared_ptr& subNode : subNodes) + for (const std::shared_ptr& subNode: subNodes) { if (subNode->isQualifierNode()) { @@ -435,7 +446,7 @@ public: std::vector getBundleInfos() const { std::vector bundleInfos; - for (const std::shared_ptr& subNode : subNodes) + for (const std::shared_ptr& subNode: subNodes) { bundleInfos.push_back(subNode->bundleInfo); } @@ -496,4 +507,4 @@ public: int fontSizeDiff; }; -#endif // DUMMY_NODE_H +#endif // DUMMY_NODE_H diff --git a/src/lib/component/controller/helper/ListLayouter.cpp b/src/lib/component/controller/helper/ListLayouter.cpp index 114c2f39..9cb7c930 100644 --- a/src/lib/component/controller/helper/ListLayouter.cpp +++ b/src/lib/component/controller/helper/ListLayouter.cpp @@ -24,7 +24,7 @@ void ListLayouter::layoutMultiColumn(Vec2i viewSize, std::vector> visibleNodes; - for (auto node : *nodes) + for (auto node: *nodes) { if (node->getsLayouted()) { @@ -36,7 +36,8 @@ void ListLayouter::layoutMultiColumn(Vec2i viewSize, std::vector maxWidths = std::vector(cols, 0); size_t nodesPerCol = - (cols == 1 ? visibleNodes.size() : std::ceil((visibleNodes.size() + cols - 1) / double(cols))); + (cols == 1 ? visibleNodes.size() + : std::ceil((visibleNodes.size() + cols - 1) / double(cols))); int maxHeight = 0; int height = -gapY; @@ -84,7 +85,8 @@ void ListLayouter::layoutMultiColumn(Vec2i viewSize, std::vector lastTextNode; for (size_t i = 0; i < visibleNodes.size(); i++) @@ -134,7 +136,7 @@ void ListLayouter::layoutSquare(std::vector>* nodes, int gapY = GraphViewStyle::s_gridCellPadding; std::vector> visibleNodes; - for (auto node : *nodes) + for (auto node: *nodes) { if (node->getsLayouted()) { @@ -153,7 +155,8 @@ void ListLayouter::layoutSquare(std::vector>* nodes, for (size_t i = cols; i < 100; i++) { - if (layoutSquareInternal(visibleNodes, Vec2i(maxWidth, totalHeight * i / 100), Vec2i(gapX, gapY))) + if (layoutSquareInternal( + visibleNodes, Vec2i(maxWidth, totalHeight * i / 100), Vec2i(gapX, gapY))) { Vec4i rect = boundingRect(visibleNodes); @@ -182,7 +185,7 @@ bool ListLayouter::layoutSquareInternal( int width = 0; - for (std::shared_ptr node : visibleNodes) + for (std::shared_ptr node: visibleNodes) { node->position.x() = x; node->position.y() = y; @@ -207,11 +210,12 @@ bool ListLayouter::layoutSquareInternal( return true; } -void ListLayouter::layoutSkewed(std::vector>* nodes, int gapX, int gapY, int maxWidth) +void ListLayouter::layoutSkewed( + std::vector>* nodes, int gapX, int gapY, int maxWidth) { std::vector> visibleNodes; std::multiset nodeWidths; - for (auto node : *nodes) + for (auto node: *nodes) { if (node->getsLayouted()) { @@ -275,7 +279,7 @@ Vec4i ListLayouter::boundingRect(const std::vector>& { Vec4i rect; - for (auto node : nodes) + for (auto node: nodes) { if (!node->getsLayouted()) { @@ -306,7 +310,7 @@ Vec2i ListLayouter::offsetNodes(std::vector> nodes, i Vec4i rect = boundingRect(nodes); Vec2i offset(left - rect.x(), top - rect.y()); - for (auto node : nodes) + for (auto node: nodes) { if (node->getsLayouted()) { @@ -317,12 +321,13 @@ Vec2i ListLayouter::offsetNodes(std::vector> nodes, i return Vec2i(rect.z() - rect.x(), rect.w() - rect.y()); } -void ListLayouter::layoutSimple(std::vector>* nodes, int gapX, int gapY, bool horizontal) +void ListLayouter::layoutSimple( + std::vector>* nodes, int gapX, int gapY, bool horizontal) { int y = 0; int x = 0; - for (const std::shared_ptr& node : *nodes) + for (const std::shared_ptr& node: *nodes) { if (!node->getsLayouted()) { diff --git a/src/lib/component/controller/helper/ListLayouter.h b/src/lib/component/controller/helper/ListLayouter.h index f6f47640..801c87de 100644 --- a/src/lib/component/controller/helper/ListLayouter.h +++ b/src/lib/component/controller/helper/ListLayouter.h @@ -17,14 +17,17 @@ public: static void layoutMultiColumn(Vec2i viewSize, std::vector>* nodes); static void layoutSquare(std::vector>* nodes, int maxWidth); - static void layoutSkewed(std::vector>* nodes, int gapX, int gapY, int maxWidth); + static void layoutSkewed( + std::vector>* nodes, int gapX, int gapY, int maxWidth); static Vec4i boundingRect(const std::vector>& nodes); static Vec2i offsetNodes(std::vector> nodes, int top, int left); private: - static void layoutSimple(std::vector>* nodes, int gapX, int gapY, bool horizontal); - static bool layoutSquareInternal(std::vector>& visibleNodes, const Vec2i& maxSize, const Vec2i& gap); + static void layoutSimple( + std::vector>* nodes, int gapX, int gapY, bool horizontal); + static bool layoutSquareInternal( + std::vector>& visibleNodes, const Vec2i& maxSize, const Vec2i& gap); }; -#endif // LIST_LAYOUTER_H +#endif // LIST_LAYOUTER_H diff --git a/src/lib/component/controller/helper/NetworkProtocolHelper.cpp b/src/lib/component/controller/helper/NetworkProtocolHelper.cpp index f0dca5b9..0109f281 100644 --- a/src/lib/component/controller/helper/NetworkProtocolHelper.cpp +++ b/src/lib/component/controller/helper/NetworkProtocolHelper.cpp @@ -44,11 +44,12 @@ NetworkProtocolHelper::MESSAGE_TYPE NetworkProtocolHelper::getMessageType(const return MESSAGE_TYPE::UNKNOWN; } } - + return MESSAGE_TYPE::UNKNOWN; } -NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActiveTokenMessage(const std::wstring& message) +NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActiveTokenMessage( + const std::wstring& message) { std::vector subMessages = divideMessage(message); @@ -68,13 +69,9 @@ NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActi const std::wstring row = subMessages[2]; const std::wstring column = subMessages[3]; - if( - !filePath.empty() - && !row.empty() - && !column.empty() - && isDigits(row) - && isDigits(column) - ){ + if (!filePath.empty() && !row.empty() && !column.empty() && isDigits(row) && + isDigits(column)) + { networkMessage.filePath = FilePath(filePath); networkMessage.row = std::stoi(row); networkMessage.column = std::stoi(column); @@ -84,14 +81,17 @@ NetworkProtocolHelper::SetActiveTokenMessage NetworkProtocolHelper::parseSetActi } else { - LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_setActiveTokenPrefix); + LOG_ERROR( + L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + + s_setActiveTokenPrefix); } } return networkMessage; } -NetworkProtocolHelper::CreateProjectMessage NetworkProtocolHelper::parseCreateProjectMessage(const std::wstring& message) +NetworkProtocolHelper::CreateProjectMessage NetworkProtocolHelper::parseCreateProjectMessage( + const std::wstring& message) { std::vector subMessages = divideMessage(message); @@ -108,14 +108,17 @@ NetworkProtocolHelper::CreateProjectMessage NetworkProtocolHelper::parseCreatePr } else { - LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_createProjectPrefix); + LOG_ERROR( + L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + + s_createProjectPrefix); } } return networkMessage; } -NetworkProtocolHelper::CreateCDBProjectMessage NetworkProtocolHelper::parseCreateCDBProjectMessage(const std::wstring& message) +NetworkProtocolHelper::CreateCDBProjectMessage NetworkProtocolHelper::parseCreateCDBProjectMessage( + const std::wstring& message) { std::vector subMessages = divideMessage(message); @@ -164,7 +167,9 @@ NetworkProtocolHelper::CreateCDBProjectMessage NetworkProtocolHelper::parseCreat } else { - LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_createCDBProjectPrefix); + LOG_ERROR( + L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + + s_createCDBProjectPrefix); } } @@ -206,14 +211,17 @@ NetworkProtocolHelper::PingMessage NetworkProtocolHelper::parsePingMessage(const } else { - LOG_ERROR(L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + s_pingPrefix); + LOG_ERROR( + L"Failed to parse message, invalid type token: " + subMessages[0] + L". Expected " + + s_pingPrefix); } } return pingMessage; } -std::wstring NetworkProtocolHelper::buildSetIDECursorMessage(const FilePath& fileLocation, const unsigned int row, const unsigned int column) +std::wstring NetworkProtocolHelper::buildSetIDECursorMessage( + const FilePath& fileLocation, const unsigned int row, const unsigned int column) { std::wstringstream messageStream; diff --git a/src/lib/component/controller/helper/NetworkProtocolHelper.h b/src/lib/component/controller/helper/NetworkProtocolHelper.h index 828a014f..17dd91cc 100644 --- a/src/lib/component/controller/helper/NetworkProtocolHelper.h +++ b/src/lib/component/controller/helper/NetworkProtocolHelper.h @@ -12,12 +12,7 @@ public: struct SetActiveTokenMessage { public: - SetActiveTokenMessage() - : filePath(L"") - , row(0) - , column(0) - , valid(false) - {} + SetActiveTokenMessage(): filePath(L""), row(0), column(0), valid(false) {} FilePath filePath; unsigned int row; @@ -32,11 +27,7 @@ public: struct CreateCDBProjectMessage { public: - CreateCDBProjectMessage() - : cdbFileLocation(L"") - , ideId(L"") - , valid(false) - {} + CreateCDBProjectMessage(): cdbFileLocation(L""), ideId(L""), valid(false) {} FilePath cdbFileLocation; std::wstring ideId; @@ -46,10 +37,7 @@ public: struct PingMessage { public: - PingMessage() - : ideId(L"") - , valid(false) - {} + PingMessage(): ideId(L""), valid(false) {} std::wstring ideId; bool valid; @@ -71,7 +59,8 @@ public: static CreateCDBProjectMessage parseCreateCDBProjectMessage(const std::wstring& message); static PingMessage parsePingMessage(const std::wstring& message); - static std::wstring buildSetIDECursorMessage(const FilePath& fileLocation, const unsigned int row, const unsigned int column); + static std::wstring buildSetIDECursorMessage( + const FilePath& fileLocation, const unsigned int row, const unsigned int column); static std::wstring buildCreateCDBMessage(); static std::wstring buildPingMessage(); @@ -89,4 +78,4 @@ private: static std::wstring s_pingPrefix; }; -#endif // NETWORK_PROTOCOL_HELPER_H \ No newline at end of file +#endif // NETWORK_PROTOCOL_HELPER_H \ No newline at end of file diff --git a/src/lib/component/controller/helper/ScreenSearchInterfaces.h b/src/lib/component/controller/helper/ScreenSearchInterfaces.h index 01ba054e..3ce919cd 100644 --- a/src/lib/component/controller/helper/ScreenSearchInterfaces.h +++ b/src/lib/component/controller/helper/ScreenSearchInterfaces.h @@ -30,4 +30,4 @@ public: virtual void clearMatches() = 0; }; -#endif // SCREEN_SEARCH_INTERFACES_H +#endif // SCREEN_SEARCH_INTERFACES_H diff --git a/src/lib/component/controller/helper/SnippetMerger.cpp b/src/lib/component/controller/helper/SnippetMerger.cpp index 74006f07..698186fd 100644 --- a/src/lib/component/controller/helper/SnippetMerger.cpp +++ b/src/lib/component/controller/helper/SnippetMerger.cpp @@ -1,13 +1,9 @@ #include "SnippetMerger.h" -#include #include "ApplicationSettings.h" +#include -SnippetMerger::SnippetMerger(int startRow, int endRow) - : m_start(startRow) - , m_end(endRow) -{ -} +SnippetMerger::SnippetMerger(int startRow, int endRow): m_start(startRow), m_end(endRow) {} void SnippetMerger::addChild(std::shared_ptr child) { @@ -29,31 +25,29 @@ std::deque SnippetMerger::merge(std::vector mergedFromChild = m_children[i]->merge(atomicRanges); for (size_t j = 0; j < mergedFromChild.size(); j++) { - merged.push_back(getExpandedRegardingAtomicRanges(mergedFromChild[j], snippetExpandRange, atomicRanges)); + merged.push_back(getExpandedRegardingAtomicRanges( + mergedFromChild[j], snippetExpandRange, atomicRanges)); } } - std::sort(merged.begin(), merged.end(), - [](const Range& a, const Range& b) - { - return a.start.row < b.start.row; - } - ); + std::sort(merged.begin(), merged.end(), [](const Range& a, const Range& b) { + return a.start.row < b.start.row; + }); // merge children - const int snippetMergeRange = 2 * snippetExpandRange + 1; // +1 since snippets that end/start with consequtive - // lines should be merged as well. + const int snippetMergeRange = 2 * snippetExpandRange + + 1; // +1 since snippets that end/start with consequtive + // lines should be merged as well. merged = Range::mergeAdjacent(merged, snippetMergeRange); // snap to own borders const int snippetSnapRange = ApplicationSettings::getInstance()->getCodeSnippetSnapRange(); - if ((m_start < merged.front().start.row) && + if ((m_start < merged.front().start.row) && (merged.front().start.row <= m_start + snippetSnapRange)) { merged.front().start.row = m_start; merged.front().start.strong = false; } - if ((m_end - snippetSnapRange <= merged.back().end.row) && - (merged.back().end.row < m_end)) + if ((m_end - snippetSnapRange <= merged.back().end.row) && (merged.back().end.row < m_end)) { merged.back().end.row = m_end; merged.back().end.strong = false; @@ -63,22 +57,19 @@ std::deque SnippetMerger::merge(std::vector& atomicRanges -) const + Range range, const int snippetExpandRange, const std::vector& atomicRanges) const { const int rangeStartThreshold = range.start.row - snippetExpandRange; const int rangeEndThreshold = range.end.row + snippetExpandRange; for (size_t i = 0; i < atomicRanges.size(); i++) { - if ((!range.start.strong) && - (atomicRanges[i].end.row >= rangeStartThreshold) && + if ((!range.start.strong) && (atomicRanges[i].end.row >= rangeStartThreshold) && (atomicRanges[i].start.row < rangeStartThreshold)) { range.start.row = std::min(range.start.row, atomicRanges[i].start.row); range.start.strong = true; } - if ((!range.end.strong) && - (atomicRanges[i].start.row <= rangeEndThreshold) && + if ((!range.end.strong) && (atomicRanges[i].start.row <= rangeEndThreshold) && (atomicRanges[i].end.row > rangeEndThreshold)) { range.end.row = std::max(range.end.row, atomicRanges[i].end.row); @@ -87,4 +78,3 @@ SnippetMerger::Range SnippetMerger::getExpandedRegardingAtomicRanges( } return range; } - diff --git a/src/lib/component/controller/helper/SnippetMerger.h b/src/lib/component/controller/helper/SnippetMerger.h index 1ead142f..3a88b097 100644 --- a/src/lib/component/controller/helper/SnippetMerger.h +++ b/src/lib/component/controller/helper/SnippetMerger.h @@ -16,8 +16,9 @@ public: }; struct Range { - template class ContainerType> - static ContainerType> mergeAdjacent(ContainerType> ranges, int rowDifference = 1) + template