mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-24 03:35:54 +01:00
A better regexp handling
This commit is contained in:
parent
60691060ea
commit
29d4008068
@ -205,14 +205,14 @@ bool Style::Layer::Filter::match(const PBF::Feature &feature) const
|
|||||||
|
|
||||||
QString Style::Layer::Template::value(int zoom, const PBF::Feature &feature) const
|
QString Style::Layer::Template::value(int zoom, const PBF::Feature &feature) const
|
||||||
{
|
{
|
||||||
QRegularExpression rx("(\\{[^\\}]*\\})");
|
QRegularExpression rx("\\{[^\\}]*\\}");
|
||||||
QString text(_field.value(zoom));
|
QString text(_field.value(zoom));
|
||||||
QRegularExpressionMatchIterator it = rx.globalMatch(text);
|
QRegularExpressionMatchIterator it = rx.globalMatch(text);
|
||||||
QStringList keys;
|
QStringList keys;
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QRegularExpressionMatch match = it.next();
|
QRegularExpressionMatch match = it.next();
|
||||||
QString val = match.captured(1);
|
QString val = match.captured(0);
|
||||||
keys.append(val.mid(1, val.size() - 2));
|
keys.append(val.mid(1, val.size() - 2));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (int i = 0; i < keys.size(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user