2021-08-02 17:24:11 +08:00
|
|
|
#ifndef SYNSEARCHREGEX_H
|
|
|
|
#define SYNSEARCHREGEX_H
|
|
|
|
#include "SearchBase.h"
|
|
|
|
|
|
|
|
#include <QRegularExpression>
|
|
|
|
|
|
|
|
class SynSearchRegex : public SynSearchBase
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit SynSearchRegex(QObject* parent=nullptr);
|
|
|
|
|
|
|
|
// SynSearchBase interface
|
|
|
|
public:
|
|
|
|
int length(int aIndex) override;
|
|
|
|
int result(int aIndex) override;
|
|
|
|
int resultCount() override;
|
2021-10-04 12:49:55 +08:00
|
|
|
int findAll(const QString &text) override;
|
2021-08-02 17:24:11 +08:00
|
|
|
QString replace(const QString &aOccurrence, const QString &aReplacement) override;
|
|
|
|
void setPattern(const QString &value) override;
|
|
|
|
void setOptions(const SynSearchOptions &options) override;
|
|
|
|
private:
|
|
|
|
void updateRegexOptions();
|
|
|
|
private:
|
|
|
|
QRegularExpression mRegex;
|
|
|
|
QList<int> mLengths;
|
|
|
|
QList<int> mResults;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SYNSEARCHREGEX_H
|