Changeset View
Changeset View
Standalone View
Standalone View
src/search/katematch.h
Show All 16 Lines | |||||
17 | * along with this library; see the file COPYING.LIB. If not, write to | 17 | * along with this library; see the file COPYING.LIB. If not, write to | ||
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | * Boston, MA 02110-1301, USA. | 19 | * Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef KATE_MATCH_H | 22 | #ifndef KATE_MATCH_H | ||
23 | #define KATE_MATCH_H | 23 | #define KATE_MATCH_H | ||
24 | 24 | | |||
25 | #include <memory> | ||||
26 | | ||||
25 | #include <ktexteditor/document.h> | 27 | #include <ktexteditor/document.h> | ||
28 | #include <ktexteditor/movingrange.h> | ||||
26 | 29 | | |||
27 | namespace KTextEditor { class DocumentPrivate; } | 30 | namespace KTextEditor { class DocumentPrivate; } | ||
28 | 31 | | |||
29 | class KateMatch | 32 | class KateMatch | ||
30 | { | 33 | { | ||
31 | public: | 34 | public: | ||
32 | KateMatch(KTextEditor::DocumentPrivate *document, KTextEditor::SearchOptions options); | 35 | KateMatch(KTextEditor::DocumentPrivate *document, KTextEditor::SearchOptions options); | ||
33 | KTextEditor::Range searchText(const KTextEditor::Range &range, const QString &pattern); | 36 | KTextEditor::Range searchText(const KTextEditor::Range &range, const QString &pattern); | ||
34 | KTextEditor::Range replace(const QString &replacement, bool blockMode, int replacementCounter = 1); | 37 | KTextEditor::Range replace(const QString &replacement, bool blockMode, int replacementCounter = 1); | ||
35 | bool isValid() const; | 38 | bool isValid() const; | ||
36 | bool isEmpty() const; | 39 | bool isEmpty() const; | ||
37 | KTextEditor::Range range() const; | 40 | KTextEditor::Range range() const; | ||
38 | 41 | | |||
39 | private: | 42 | private: | ||
40 | /** | 43 | /** | ||
41 | * Resolve references and escape sequences. | 44 | * Resolve references and escape sequences. | ||
42 | */ | 45 | */ | ||
43 | QString buildReplacement(const QString &replacement, bool blockMode, int replacementCounter) const; | 46 | QString buildReplacement(const QString &replacement, bool blockMode, int replacementCounter) const; | ||
44 | 47 | | |||
45 | private: | 48 | private: | ||
46 | KTextEditor::DocumentPrivate *const m_document; | 49 | KTextEditor::DocumentPrivate *const m_document; | ||
47 | const KTextEditor::SearchOptions m_options; | 50 | const KTextEditor::SearchOptions m_options; | ||
48 | QVector<KTextEditor::Range> m_resultRanges; | 51 | QVector<KTextEditor::Range> m_resultRanges; | ||
52 | | ||||
53 | /** | ||||
54 | * moving range to track replace changes | ||||
55 | * kept for later reuse | ||||
56 | */ | ||||
57 | std::unique_ptr<KTextEditor::MovingRange> m_afterReplaceRange; | ||||
49 | }; | 58 | }; | ||
50 | 59 | | |||
51 | #endif // KATE_MATCH_H | 60 | #endif // KATE_MATCH_H | ||
52 | 61 | |