ENH: disentangle testing and quoting of regex characters

- originally had tests for regex meta characters strewn across
  regExp classes as well as wordRe, keyType, string.
  And had special-purpose quotemeta static function within string
  that relied on special naming convention for testing the meta
  characters.

  The regex meta character testing/handling now relegated entirely
  to the regExp class(es).
  Relocate quotemeta to stringOps, with a predicate.

- avoid code duplication. Reuse some regExpCxx methods in regExpPosix
This commit is contained in:
Mark Olesen
2021-04-09 10:49:13 +02:00
committed by Andrew Heather
parent cdbc3e2de6
commit 57c1fceabf
14 changed files with 273 additions and 254 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "ddt2.H"
#include "stringOps.H"
#include "stringListOps.H"
#include "volFields.H"
#include "dictionary.H"
@ -107,7 +108,7 @@ Foam::functionObjects::ddt2::ddt2
:
fvMeshFunctionObject(name, runTime, dict),
selectFields_(),
resultName_(word::null),
resultName_(),
denyField_(),
results_(),
mag_(dict.getOrDefault("mag", false))
@ -150,10 +151,8 @@ bool Foam::functionObjects::ddt2::read(const dictionary& dict)
{
denyField_.set
(
string::quotemeta<regExp>
(
resultName_
).replace("@@", "(.+)")
stringOps::quotemeta(resultName_, regExp::meta())
.replace("@@", "(.+)")
);
return true;