mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 14:30:04 +00:00
Finish migrating std::regex to RE2
This commit is contained in:
parent
2757c51828
commit
2bd5ec8705
4 changed files with 26 additions and 33 deletions
|
|
@ -2,13 +2,12 @@
|
|||
#include <scwx/util/environment.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QMapLibreGL/QMapLibreGL>
|
||||
#include <QTimer>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <re2/re2.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -108,14 +107,15 @@ TEST_P(ByMapProviderTest, MapProviderLayers)
|
|||
const std::string layer = qlayer.toStdString();
|
||||
|
||||
// Draw below layers defined in map style
|
||||
auto it = std::find_if(
|
||||
mapStyle.drawBelow_.cbegin(),
|
||||
mapStyle.drawBelow_.cend(),
|
||||
[&layer](const std::string& styleLayer) -> bool
|
||||
{
|
||||
std::regex re {styleLayer, std::regex_constants::icase};
|
||||
return std::regex_match(layer, re);
|
||||
});
|
||||
auto it =
|
||||
std::find_if(mapStyle.drawBelow_.cbegin(),
|
||||
mapStyle.drawBelow_.cend(),
|
||||
[&layer](const std::string& styleLayer) -> bool
|
||||
{
|
||||
// Perform case insensitive matching
|
||||
RE2 re {"(?i)" + styleLayer};
|
||||
return RE2::FullMatch(layer, re);
|
||||
});
|
||||
|
||||
if (it != mapStyle.drawBelow_.cend())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue