File indexing completed on 2024-09-01 13:30:21
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2002 David Faure <david@mandrakesoft.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KREPLACETEST_H 0009 #define KREPLACETEST_H 0010 0011 #include <QObject> 0012 #include <QStringList> 0013 #include <memory> 0014 0015 class KReplace; 0016 class KReplaceTest : public QObject 0017 { 0018 Q_OBJECT 0019 public: 0020 KReplaceTest(const QStringList &text, const QString &buttonName); 0021 ~KReplaceTest() override; 0022 0023 void replace(const QString &pattern, const QString &replacement, long options); 0024 void print(); 0025 const QStringList &textLines() const 0026 { 0027 return m_text; 0028 } 0029 0030 public Q_SLOTS: 0031 void slotHighlight(const QString &, int, int); 0032 void slotReplaceNext(); 0033 void slotReplace(const QString &text, int replacementIndex, int replacedLength, int matchedLength); 0034 0035 Q_SIGNALS: 0036 void exitLoop(); 0037 0038 private: 0039 void enterLoop(); 0040 0041 QStringList::Iterator m_currentPos; 0042 QStringList m_text; 0043 std::unique_ptr<KReplace> m_replace; 0044 bool m_needEventLoop; 0045 QString m_buttonName; 0046 }; 0047 0048 #endif