From 3ceb55c307b043fdd941cc1d1f14e823021ac75e Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Fri, 8 Dec 2017 15:30:44 +0100 Subject: [PATCH] src: switch to using forward declarations for NodeType and NodeTypeSet where possible --- src/lib/data/NodeTypeSet.cpp | 1 + src/lib/data/NodeTypeSet.h | 8 +++---- src/lib/data/access/StorageAccess.h | 2 +- src/lib/data/access/StorageAccessProxy.cpp | 1 + src/lib/data/search/SearchMatch.cpp | 1 + src/lib/data/search/SearchMatch.h | 3 ++- src/lib/data/storage/PersistentStorage.cpp | 22 +++++++++---------- .../utility/messaging/type/MessageSearch.h | 1 + src/lib_gui/qt/element/QtSmartSearchBox.cpp | 16 +++++++------- src/lib_gui/qt/element/QtSmartSearchBox.h | 3 ++- 10 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/lib/data/NodeTypeSet.cpp b/src/lib/data/NodeTypeSet.cpp index 60ee1e1a..fdee2af5 100644 --- a/src/lib/data/NodeTypeSet.cpp +++ b/src/lib/data/NodeTypeSet.cpp @@ -1,5 +1,6 @@ #include "data/NodeTypeSet.h" +#include "data/NodeType.h" #include "utility/utility.h" #include "utility/utilityMath.h" diff --git a/src/lib/data/NodeTypeSet.h b/src/lib/data/NodeTypeSet.h index 41b1b7c3..b4db22ee 100644 --- a/src/lib/data/NodeTypeSet.h +++ b/src/lib/data/NodeTypeSet.h @@ -1,12 +1,13 @@ #ifndef NODE_TYPE_SET_H #define NODE_TYPE_SET_H -#include -#include +#include +#include -#include "data/NodeType.h" #include "utility/types.h" +class NodeType; + class NodeTypeSet { public: @@ -43,7 +44,6 @@ private: static const std::vector s_allNodeTypes; MaskType m_nodeTypeMask; - //std::set m_nodeTypes; }; #endif // NODE_TYPE_SET_H diff --git a/src/lib/data/access/StorageAccess.h b/src/lib/data/access/StorageAccess.h index 92d77446..f7a9dfea 100644 --- a/src/lib/data/access/StorageAccess.h +++ b/src/lib/data/access/StorageAccess.h @@ -19,10 +19,10 @@ #include "data/ErrorCountInfo.h" #include "data/ErrorFilter.h" #include "data/ErrorInfo.h" -#include "data/NodeTypeSet.h" class FilePath; class Graph; +class NodeTypeSet; class SourceLocationCollection; class SourceLocationFile; class TextAccess; diff --git a/src/lib/data/access/StorageAccessProxy.cpp b/src/lib/data/access/StorageAccessProxy.cpp index 4d1abc52..91855e6a 100644 --- a/src/lib/data/access/StorageAccessProxy.cpp +++ b/src/lib/data/access/StorageAccessProxy.cpp @@ -3,6 +3,7 @@ #include "data/graph/Graph.h" #include "data/location/SourceLocationCollection.h" #include "data/location/SourceLocationFile.h" +#include "data/NodeTypeSet.h" #include "utility/file/FileInfo.h" #include "utility/file/FilePath.h" diff --git a/src/lib/data/search/SearchMatch.cpp b/src/lib/data/search/SearchMatch.cpp index 9e855566..80a935fe 100644 --- a/src/lib/data/search/SearchMatch.cpp +++ b/src/lib/data/search/SearchMatch.cpp @@ -2,6 +2,7 @@ #include +#include "data/NodeTypeSet.h" #include "utility/logging/logging.h" void SearchMatch::log(const std::vector& matches, const std::string& query) diff --git a/src/lib/data/search/SearchMatch.h b/src/lib/data/search/SearchMatch.h index c42a6b60..02a32b7c 100644 --- a/src/lib/data/search/SearchMatch.h +++ b/src/lib/data/search/SearchMatch.h @@ -7,9 +7,10 @@ #include #include "data/graph/Node.h" -#include "data/NodeTypeSet.h" #include "utility/types.h" +class NodeTypeSet; + struct SearchMatch { enum SearchType diff --git a/src/lib/data/storage/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp index 98bccae6..efad83f4 100644 --- a/src/lib/data/storage/PersistentStorage.cpp +++ b/src/lib/data/storage/PersistentStorage.cpp @@ -3,17 +3,6 @@ #include #include -#include "utility/Cache.h" -#include "utility/file/FileInfo.h" -#include "utility/file/FilePath.h" -#include "utility/logging/logging.h" -#include "utility/messaging/type/MessageNewErrors.h" -#include "utility/messaging/type/MessageStatus.h" -#include "utility/text/TextAccess.h" -#include "utility/TimeStamp.h" -#include "utility/tracing.h" -#include "utility/utility.h" - #include "data/graph/token_component/TokenComponentAccess.h" #include "data/graph/token_component/TokenComponentAggregation.h" #include "data/graph/token_component/TokenComponentFilePath.h" @@ -23,7 +12,18 @@ #include "data/location/SourceLocationFile.h" #include "data/parser/AccessKind.h" #include "data/parser/ParseLocation.h" +#include "data/NodeTypeSet.h" #include "settings/ApplicationSettings.h" +#include "utility/Cache.h" +#include "utility/file/FileInfo.h" +#include "utility/file/FilePath.h" +#include "utility/logging/logging.h" +#include "utility/messaging/type/MessageNewErrors.h" +#include "utility/messaging/type/MessageStatus.h" +#include "utility/text/TextAccess.h" +#include "utility/TimeStamp.h" +#include "utility/tracing.h" +#include "utility/utility.h" PersistentStorage::PersistentStorage(const FilePath& dbPath, const FilePath& bookmarkPath) : m_sqliteIndexStorage(dbPath) diff --git a/src/lib/utility/messaging/type/MessageSearch.h b/src/lib/utility/messaging/type/MessageSearch.h index ae3db1fe..157bd0b0 100644 --- a/src/lib/utility/messaging/type/MessageSearch.h +++ b/src/lib/utility/messaging/type/MessageSearch.h @@ -3,6 +3,7 @@ #include "utility/messaging/Message.h" +#include "data/NodeTypeSet.h" #include "data/search/SearchMatch.h" class MessageSearch diff --git a/src/lib_gui/qt/element/QtSmartSearchBox.cpp b/src/lib_gui/qt/element/QtSmartSearchBox.cpp index 082bea50..06a3f6c1 100644 --- a/src/lib_gui/qt/element/QtSmartSearchBox.cpp +++ b/src/lib_gui/qt/element/QtSmartSearchBox.cpp @@ -6,15 +6,15 @@ #include #include +#include "component/view/GraphViewStyle.h" +#include "data/NodeTypeSet.h" +#include "settings/ColorScheme.h" #include "utility/messaging/type/MessageSearch.h" #include "utility/messaging/type/MessageSearchFullText.h" #include "utility/messaging/type/MessageSearchAutocomplete.h" #include "utility/utility.h" #include "utility/utilityString.h" -#include "component/view/GraphViewStyle.h" -#include "settings/ColorScheme.h" - QtSearchElement::QtSearchElement(const QString& text, QWidget* parent) : QPushButton(text, parent) { @@ -1058,13 +1058,13 @@ std::deque QtSmartSearchBox::getMatchesForInput(const std::string& NodeTypeSet QtSmartSearchBox::getMatchAcceptedNodeTypes() const { - NodeTypeSet types; + NodeTypeSet acceptedTypes; for (const SearchMatch& match : m_matches) { if (match.isFilterCommand()) { - types.add(match.nodeType); + acceptedTypes.add(match.nodeType); } else { @@ -1072,12 +1072,12 @@ NodeTypeSet QtSmartSearchBox::getMatchAcceptedNodeTypes() const } } - if (types.isEmpty()) + if (acceptedTypes.isEmpty()) { - types.invert(); + acceptedTypes.invert(); } - return types; + return acceptedTypes; } bool QtSmartSearchBox::lastMatchIsNoFilter() const diff --git a/src/lib_gui/qt/element/QtSmartSearchBox.h b/src/lib_gui/qt/element/QtSmartSearchBox.h index 2e4b7c91..92134316 100644 --- a/src/lib_gui/qt/element/QtSmartSearchBox.h +++ b/src/lib_gui/qt/element/QtSmartSearchBox.h @@ -8,9 +8,10 @@ #include #include "data/search/SearchMatch.h" -#include "data/NodeTypeSet.h" #include "qt/element/QtAutocompletionList.h" +class NodeTypeSet; + class QtSearchElement : public QPushButton {