mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 10:15:38 +00:00
Merge branch 'slowfilter' into 'master'
Speedup filter in the CS See merge request OpenMW/openmw!2901
This commit is contained in:
commit
c8f41f1c34
2 changed files with 6 additions and 3 deletions
|
@ -13,6 +13,8 @@
|
|||
CSMFilter::TextNode::TextNode(int columnId, const std::string& text)
|
||||
: mColumnId(columnId)
|
||||
, mText(text)
|
||||
, mRegExp(QRegularExpression::anchoredPattern(QString::fromUtf8(mText.c_str())),
|
||||
QRegularExpression::CaseInsensitiveOption)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -57,9 +59,7 @@ bool CSMFilter::TextNode::test(const CSMWorld::IdTableBase& table, int row, cons
|
|||
return false;
|
||||
|
||||
/// \todo make pattern syntax configurable
|
||||
QRegularExpression regExp(QRegularExpression::anchoredPattern(QString::fromUtf8(mText.c_str())),
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
QRegularExpressionMatch match = regExp.match(string);
|
||||
QRegularExpressionMatch match = mRegExp.match(string);
|
||||
|
||||
return match.hasMatch();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <apps/opencs/model/world/idtablebase.hpp>
|
||||
|
||||
#include "leafnode.hpp"
|
||||
|
@ -15,6 +17,7 @@ namespace CSMFilter
|
|||
{
|
||||
int mColumnId;
|
||||
std::string mText;
|
||||
QRegularExpression mRegExp;
|
||||
|
||||
public:
|
||||
TextNode(int columnId, const std::string& text);
|
||||
|
|
Loading…
Reference in a new issue