Skip to content
Snippets Groups Projects
Commit 215349aa authored by Mark Olesen's avatar Mark Olesen
Browse files

BUG: in wordRe::operator=(const keyType&)

- the regex was not being unset on assignment.
- drop unused recompile() method as being dubious
parent b3bfdd0b
Branches
Tags
No related merge requests found
...@@ -75,8 +75,8 @@ int main(int argc, char *argv[]) ...@@ -75,8 +75,8 @@ int main(int argc, char *argv[])
wre.info(Info) << " after DETECT" << endl; wre.info(Info) << " after DETECT" << endl;
wre.uncompile(); wre.uncompile();
wre.info(Info) << " uncompiled" << endl; wre.info(Info) << " uncompiled" << endl;
wre.recompile(); wre.compile();
wre.info(Info) << " recompiled" << endl; wre.info(Info) << " re-compiled" << endl;
wre.set("something .* value", wordRe::LITERAL); wre.set("something .* value", wordRe::LITERAL);
wre.info(Info) << " set as LITERAL" << endl; wre.info(Info) << " set as LITERAL" << endl;
......
...@@ -39,8 +39,8 @@ Description ...@@ -39,8 +39,8 @@ Description
Note Note
If the string contents are changed - eg, by the operator+=() or by If the string contents are changed - eg, by the operator+=() or by
string::replace(), etc - it will be necessary to use compile() or string::replace(), etc - it will be necessary to use compile() to
recompile() to synchronize the regular expression. synchronize the regular expression.
SourceFiles SourceFiles
wordRe.C wordRe.C
...@@ -161,9 +161,6 @@ public: ...@@ -161,9 +161,6 @@ public:
//- Possibly compile the regular expression, with greater control //- Possibly compile the regular expression, with greater control
inline bool compile(const compOption) const; inline bool compile(const compOption) const;
//- Recompile an existing regular expression
inline bool recompile() const;
//- Frees precompiled regular expression, making wordRe a literal. //- Frees precompiled regular expression, making wordRe a literal.
// Optionally strips invalid word characters // Optionally strips invalid word characters
inline void uncompile(const bool doStripInvalid = false) const; inline void uncompile(const bool doStripInvalid = false) const;
......
...@@ -165,17 +165,6 @@ inline bool Foam::wordRe::compile() const ...@@ -165,17 +165,6 @@ inline bool Foam::wordRe::compile() const
} }
inline bool Foam::wordRe::recompile() const
{
if (re_.exists())
{
re_ = *this;
}
return re_.exists();
}
inline void Foam::wordRe::uncompile(const bool doStripInvalid) const inline void Foam::wordRe::uncompile(const bool doStripInvalid) const
{ {
if (re_.clear()) if (re_.clear())
...@@ -265,6 +254,10 @@ inline void Foam::wordRe::operator=(const keyType& str) ...@@ -265,6 +254,10 @@ inline void Foam::wordRe::operator=(const keyType& str)
{ {
compile(); compile();
} }
else
{
re_.clear();
}
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment