BUG: wordRe: assignment from keyType not handled

This commit is contained in:
mattijs
2011-04-13 17:11:36 +01:00
parent bf443b6e02
commit a653f2d027
2 changed files with 33 additions and 3 deletions

View File

@ -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&);

View File

@ -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);