Commit 2343a1eb authored by Laurent Montel's avatar Laurent Montel 😁

Rename class

parent 1c11cb17
......@@ -2,7 +2,7 @@ set(adblocklibprivate_SRCS
adblockmanager.cpp
adblocksearchtree.cpp
adblockrule.cpp
qzregexp.cpp
adblockregexp.cpp
adblockutil.cpp
adblockmatcher.cpp
adblocksubscription.cpp
......
......@@ -31,17 +31,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "qzregexp.h"
#include "adblockregexp.h"
#include "adblockutil.h"
using namespace AdBlock;
QzRegExp::QzRegExp()
AdblockRegExp::AdblockRegExp()
: QRegularExpression(QString(), QRegularExpression::DotMatchesEverythingOption)
, m_matchedLength(-1)
{
}
QzRegExp::QzRegExp(const QString &pattern, Qt::CaseSensitivity cs)
AdblockRegExp::AdblockRegExp(const QString &pattern, Qt::CaseSensitivity cs)
: QRegularExpression(pattern, QRegularExpression::DotMatchesEverythingOption)
, m_matchedLength(-1)
{
......@@ -50,13 +50,13 @@ QzRegExp::QzRegExp(const QString &pattern, Qt::CaseSensitivity cs)
}
}
QzRegExp::QzRegExp(const QzRegExp &re)
AdblockRegExp::AdblockRegExp(const AdblockRegExp &re)
: QRegularExpression(re)
, m_matchedLength(-1)
{
}
void QzRegExp::setMinimal(bool minimal)
void AdblockRegExp::setMinimal(bool minimal)
{
QRegularExpression::PatternOptions opt;
......@@ -69,9 +69,9 @@ void QzRegExp::setMinimal(bool minimal)
setPatternOptions(opt);
}
int QzRegExp::indexIn(const QString &str, int offset) const
int AdblockRegExp::indexIn(const QString &str, int offset) const
{
QzRegExp *that = const_cast<QzRegExp *>(this);
AdblockRegExp *that = const_cast<AdblockRegExp *>(this);
QRegularExpressionMatch m = match(str, offset);
if (!m.hasMatch()) {
......@@ -85,12 +85,12 @@ int QzRegExp::indexIn(const QString &str, int offset) const
return m.capturedStart();
}
int QzRegExp::matchedLength() const
int AdblockRegExp::matchedLength() const
{
return m_matchedLength;
}
QString QzRegExp::cap(int nth) const
QString AdblockRegExp::cap(int nth) const
{
if (!AdblockUtil::containsIndex(m_capturedTexts, nth)) {
return QString();
......
......@@ -31,20 +31,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef QZREGEXP_H
#define QZREGEXP_H
#ifndef ADBLOCKREGEXP_H
#define ADBLOCKREGEXP_H
#include <QRegularExpression>
#include <QStringList>
namespace AdBlock
{
class QzRegExp : public QRegularExpression
class AdblockRegExp : public QRegularExpression
{
public:
QzRegExp();
QzRegExp(const QString &pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QzRegExp(const QzRegExp &re);
AdblockRegExp();
AdblockRegExp(const QString &pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive);
AdblockRegExp(const AdblockRegExp &re);
void setMinimal(bool minimal);
int indexIn(const QString &str, int offset = 0) const;
......@@ -56,4 +56,4 @@ private:
int m_matchedLength;
};
}
#endif // QZREGEXP_H
#endif
......@@ -63,7 +63,7 @@
#include "adblockrule.h"
#include "adblocksubscription.h"
#include "adblockutil.h"
#include "qzregexp.h"
#include "adblockregexp.h"
#include <QUrl>
#include <QString>
......@@ -494,7 +494,7 @@ void AdBlockRule::parseFilter()
m_type = RegExpMatchRule;
m_regExp = new RegExp;
m_regExp->regExp = QzRegExp(parsedLine, m_caseSensitivity);
m_regExp->regExp = AdblockRegExp(parsedLine, m_caseSensitivity);
m_regExp->matchers = createStringMatchers(parseRegExpFilter(parsedLine));
return;
}
......@@ -535,7 +535,7 @@ void AdBlockRule::parseFilter()
) {
m_type = RegExpMatchRule;
m_regExp = new RegExp;
m_regExp->regExp = QzRegExp(createRegExpFromFilter(parsedLine), m_caseSensitivity);
m_regExp->regExp = AdblockRegExp(createRegExpFromFilter(parsedLine), m_caseSensitivity);
m_regExp->matchers = createStringMatchers(parseRegExpFilter(parsedLine));
return;
}
......
......@@ -65,7 +65,7 @@
#include <QObject>
#include <QStringList>
#include <QStringMatcher>
#include "qzregexp.h"
#include "adblockregexp.h"
class QUrl;
class QWebEngineUrlRequestInfo;
......@@ -186,7 +186,7 @@ private:
QStringList m_blockedDomains;
struct RegExp {
QzRegExp regExp;
AdblockRegExp regExp;
QList<QStringMatcher> matchers;
};
......
......@@ -31,8 +31,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef QZTOOLS_H
#define QZTOOLS_H
#ifndef ADBLOCKUTILS_H
#define ADBLOCKUTILS_H
#include <QString>
......@@ -49,4 +49,4 @@ public:
}
};
}
#endif // QZTOOLS_H
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment