diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H index 566f42af6ca3de138db7e830d30d76dcb585871e..bcb7dad5b1c37e43c1d475973b912cffddd22b59 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,6 +52,7 @@ SourceFiles #include "word.H" #include "regExp.H" +#include "keyType.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,7 +61,6 @@ namespace Foam // Forward declaration of friend functions and operators class wordRe; - class Istream; class Ostream; @@ -118,6 +118,9 @@ public: //- Construct as copy inline wordRe(const wordRe&); + //- Construct from keyType + inline wordRe(const keyType&, const compOption=LITERAL); + //- Construct as copy of word inline wordRe(const word&); @@ -196,6 +199,10 @@ public: //- Copy word, never a regular expression inline const wordRe& operator=(const word&); + //- Copy keyType, auto-test for regular expression + // Always case sensitive + inline const wordRe& operator=(const keyType&); + //- Copy string, auto-test for regular expression // Always case sensitive inline const wordRe& operator=(const string&); diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H index 713c003064180706e4dc31781682e40a1a6b9630..fcbd1c384562015228967b69300937456b236ba1 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,18 @@ inline Foam::wordRe::wordRe(const word& str) {} +inline Foam::wordRe::wordRe(const keyType& str, const compOption opt) +: + word(str, false), + re_() +{ + if (str.isPattern()) + { + compile(opt); + } +} + + inline Foam::wordRe::wordRe(const char* str, const compOption opt) : word(str, false), @@ -236,6 +248,17 @@ inline const Foam::wordRe& Foam::wordRe::operator=(const word& str) } +inline const Foam::wordRe& Foam::wordRe::operator=(const keyType& str) +{ + string::operator=(str); + if (str.isPattern()) + { + compile(); + } + return *this; +} + + inline const Foam::wordRe& Foam::wordRe::operator=(const string& str) { string::operator=(str);