~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to addons/search/search_open_files.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*   Kate search plugin
 
2
 * 
 
3
 * Copyright (C) 2011-2013 by Kåre Särs <kare.sars@iki.fi>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program in a file called COPYING; if not, write to
 
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
18
 * MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef _SEARCH_OPEN_FILES_H_
 
22
#define _SEARCH_OPEN_FILES_H_
 
23
 
 
24
#include <QObject>
 
25
#include <QRegExp>
 
26
#include <QTime>
 
27
#include <ktexteditor/document.h>
 
28
 
 
29
class SearchOpenFiles: public QObject
 
30
{
 
31
    Q_OBJECT
 
32
 
 
33
public:
 
34
    SearchOpenFiles(QObject *parent = 0);
 
35
 
 
36
    void startSearch(const QList<KTextEditor::Document*> &list,const QRegExp &regexp);
 
37
    bool searching();
 
38
 
 
39
public Q_SLOTS:
 
40
    void cancelSearch();
 
41
 
 
42
    /// return 0 on success or a line number where we stopped.
 
43
    int searchOpenFile(KTextEditor::Document *doc, const QRegExp &regExp, int startLine);
 
44
 
 
45
private Q_SLOTS:
 
46
    void doSearchNextFile(int startLine);
 
47
 
 
48
private:
 
49
    int searchSingleLineRegExp(KTextEditor::Document *doc, const QRegExp &regExp, int startLine);
 
50
    int searchMultiLineRegExp(KTextEditor::Document *doc, const QRegExp &regExp, int startLine);
 
51
 
 
52
Q_SIGNALS:
 
53
    void searchNextFile(int startLine);
 
54
    void matchFound(const QString &url, const QString &fileName, int line, int column, const QString &lineContent, int matchLen);
 
55
    void searchDone();
 
56
    void searching(const QString &file);
 
57
 
 
58
private:
 
59
    QList<KTextEditor::Document*> m_docList;
 
60
    int                           m_nextIndex;
 
61
    QRegExp                       m_regExp;
 
62
    bool                          m_cancelSearch;
 
63
    QString                       m_fullDoc;
 
64
    QVector<int>                  m_lineStart;
 
65
    QTime                         m_statusTime;
 
66
};
 
67
 
 
68
 
 
69
#endif