Made symbol searching plug-able through indexing support.

The indexing support for the built-in code model is moved to its own
file. Symbol searching will now call for a searcher through that support
interface, which will create a fully configured and ready-to-go searcher
that can be started in the/a future.

Change-Id: Idc3ee1c7c789a69fa05ee1d42415313dcea94cf8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2012-11-23 11:47:39 +01:00
parent 65942d2d8d
commit 271fb797cb
15 changed files with 372 additions and 270 deletions

View File

@@ -32,19 +32,62 @@
#include "cpptools_global.h"
#include <find/searchresultwindow.h>
#include <find/textfindconstants.h>
#include <QFuture>
#include <QStringList>
namespace CppTools {
class SymbolSearcher: public QObject
{
Q_OBJECT
public:
enum SymbolType {
Classes = 0x1,
Functions = 0x2,
Enums = 0x4,
Declarations = 0x8
};
Q_DECLARE_FLAGS(SymbolTypes, SymbolType)
enum SearchScope {
SearchProjectsOnly,
SearchGlobal
};
struct Parameters
{
QString text;
Find::FindFlags flags;
SymbolTypes types;
SearchScope scope;
};
public:
SymbolSearcher(QObject *parent = 0);
virtual ~SymbolSearcher() = 0;
virtual void runSearch(QFutureInterface<Find::SearchResultItem> &future) = 0;
};
class CPPTOOLS_EXPORT CppIndexingSupport
{
public:
virtual ~CppIndexingSupport() = 0;
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles) = 0;
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames) = 0;
};
} // namespace CppTools
Q_DECLARE_METATYPE(CppTools::SymbolSearcher::SearchScope)
Q_DECLARE_METATYPE(CppTools::SymbolSearcher::Parameters)
Q_DECLARE_METATYPE(CppTools::SymbolSearcher::SymbolTypes)
#endif // CPPTOOLS_CPPINDEXINGSUPPORT_H