File: kreplacetest.h

package info (click to toggle)
ktextwidgets 5.78.0-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 2,844 kB
  • sloc: cpp: 5,454; sh: 21; makefile: 7
file content (48 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
    This file is part of the KDE project
    SPDX-FileCopyrightText: 2002 David Faure <david@mandrakesoft.com>

    SPDX-License-Identifier: LGPL-2.0-only
*/

#ifndef KREPLACETEST_H
#define KREPLACETEST_H

#include <QObject>
#include <QStringList>

class KReplace;

class KReplaceTest : public QObject
{
    Q_OBJECT
public:
    KReplaceTest(const QStringList &text, const QString &buttonName)
        : QObject(nullptr), m_text(text), m_replace(nullptr), m_buttonName(buttonName) {}

    void replace(const QString &pattern, const QString &replacement, long options);
    void print();
    const QStringList &textLines() const
    {
        return m_text;
    }

public Q_SLOTS:
    void slotHighlight(const QString &, int, int);
    void slotReplaceNext();
    void slotReplace(const QString &text, int replacementIndex, int replacedLength, int matchedLength);

Q_SIGNALS:
    void exitLoop();

private:
    void enterLoop();

    QStringList::Iterator m_currentPos;
    QStringList m_text;
    KReplace *m_replace;
    bool m_needEventLoop;
    QString m_buttonName;
};

#endif