KTextEditor

katematch.h
1/*
2 SPDX-FileCopyrightText: 2010 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
3 SPDX-FileCopyrightText: 2007 Sebastian Pipping <webmaster@hartwork.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KATE_MATCH_H
9#define KATE_MATCH_H
10
11#include <memory>
12
13#include <ktexteditor/document.h>
14#include <ktexteditor/movingrange.h>
15
16namespace KTextEditor
17{
18class DocumentPrivate;
19}
20
21class KateMatch
22{
23public:
24 KateMatch(KTextEditor::DocumentPrivate *document, KTextEditor::SearchOptions options);
25 KTextEditor::Range searchText(KTextEditor::Range range, const QString &pattern);
26 KTextEditor::Range replace(const QString &replacement, bool blockMode, int replacementCounter = 1);
27 bool isValid() const;
28 bool isEmpty() const;
29 KTextEditor::Range range() const;
30
31private:
32 /**
33 * Resolve references and escape sequences.
34 */
35 QString buildReplacement(const QString &replacement, bool blockMode, int replacementCounter) const;
36
37private:
38 KTextEditor::DocumentPrivate *const m_document;
39 const KTextEditor::SearchOptions m_options;
40 QList<KTextEditor::Range> m_resultRanges;
41
42 /**
43 * moving range to track replace changes
44 * kept for later reuse
45 */
46 std::unique_ptr<KTextEditor::MovingRange> m_afterReplaceRange;
47};
48
49#endif // KATE_MATCH_H
An object representing a section of text, from one Cursor to another.
QFlags< SearchOption > SearchOptions
Stores a combination of #SearchOption values.
Definition document.h:65
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:02:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.