From cc571ba111071998d7863af12c80ebd338357e9f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 12 Dec 2008 09:48:25 +0100 Subject: [PATCH] removed last bits of wildcard vs. pattern --- src/OpenFOAM/db/dictionary/dictionary.C | 66 +++++++++---------- src/OpenFOAM/db/dictionary/dictionary.H | 4 +- .../dictionaryEntry/dictionaryEntry.H | 14 ++-- .../primitiveEntry/primitiveEntry.H | 30 ++++----- .../primitives/strings/keyType/keyType.H | 3 +- .../primitives/strings/keyType/keyTypeI.H | 22 +++---- 6 files changed, 69 insertions(+), 70 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 3d61e7b024..5d0ee2af65 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -46,9 +46,9 @@ bool Foam::dictionary::findInPatterns DLList >::const_iterator& reLink ) const { - if (wildCardEntries_.size() > 0) + if (patternEntries_.size() > 0) { - while (wcLink != wildCardEntries_.end()) + while (wcLink != patternEntries_.end()) { if ( @@ -76,9 +76,9 @@ bool Foam::dictionary::findInPatterns DLList >::iterator& reLink ) { - if (wildCardEntries_.size() > 0) + if (patternEntries_.size() > 0) { - while (wcLink != wildCardEntries_.end()) + while (wcLink != patternEntries_.end()) { if ( @@ -127,8 +127,8 @@ Foam::dictionary::dictionary if (iter().keyword().isPattern()) { - wildCardEntries_.insert(&iter()); - wildCardRegexps_.insert + patternEntries_.insert(&iter()); + patternRegexps_.insert ( autoPtr(new regExp(iter().keyword())) ); @@ -157,8 +157,8 @@ Foam::dictionary::dictionary if (iter().keyword().isPattern()) { - wildCardEntries_.insert(&iter()); - wildCardRegexps_.insert + patternEntries_.insert(&iter()); + patternRegexps_.insert ( autoPtr(new regExp(iter().keyword())) ); @@ -217,11 +217,11 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const } else { - if (wildCardEntries_.size() > 0) + if (patternEntries_.size() > 0) { - DLList::const_iterator wcLink = wildCardEntries_.begin(); + DLList::const_iterator wcLink = patternEntries_.begin(); DLList >::const_iterator reLink = - wildCardRegexps_.begin(); + patternRegexps_.begin(); // Find in patterns using regular expressions only if (findInPatterns(true, keyword, wcLink, reLink)) @@ -253,12 +253,12 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr if (iter == hashedEntries_.end()) { - if (patternMatch && wildCardEntries_.size() > 0) + if (patternMatch && patternEntries_.size() > 0) { DLList::const_iterator wcLink = - wildCardEntries_.begin(); + patternEntries_.begin(); DLList >::const_iterator reLink = - wildCardRegexps_.begin(); + patternRegexps_.begin(); // Find in patterns using regular expressions only if (findInPatterns(patternMatch, keyword, wcLink, reLink)) @@ -292,12 +292,12 @@ Foam::entry* Foam::dictionary::lookupEntryPtr if (iter == hashedEntries_.end()) { - if (patternMatch && wildCardEntries_.size() > 0) + if (patternMatch && patternEntries_.size() > 0) { DLList::iterator wcLink = - wildCardEntries_.begin(); + patternEntries_.begin(); DLList >::iterator reLink = - wildCardRegexps_.begin(); + patternRegexps_.begin(); // Find in patterns using regular expressions only if (findInPatterns(patternMatch, keyword, wcLink, reLink)) @@ -499,8 +499,8 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) if (entryPtr->keyword().isPattern()) { - wildCardEntries_.insert(entryPtr); - wildCardRegexps_.insert + patternEntries_.insert(entryPtr); + patternRegexps_.insert ( autoPtr(new regExp(entryPtr->keyword())) ); @@ -528,8 +528,8 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) if (entryPtr->keyword().isPattern()) { - wildCardEntries_.insert(entryPtr); - wildCardRegexps_.insert + patternEntries_.insert(entryPtr); + patternRegexps_.insert ( autoPtr(new regExp(entryPtr->keyword())) ); @@ -622,14 +622,14 @@ bool Foam::dictionary::remove(const word& Keyword) if (iter != hashedEntries_.end()) { // Delete from patterns first - DLList::iterator wcLink = wildCardEntries_.begin(); - DLList >::iterator reLink = wildCardRegexps_.begin(); + DLList::iterator wcLink = patternEntries_.begin(); + DLList >::iterator reLink = patternRegexps_.begin(); // Find in pattern using exact match only if (findInPatterns(false, Keyword, wcLink, reLink)) { - wildCardEntries_.remove(wcLink); - wildCardRegexps_.remove(reLink); + patternEntries_.remove(wcLink); + patternRegexps_.remove(reLink); } IDLList::remove(iter()); @@ -689,15 +689,15 @@ bool Foam::dictionary::changeKeyword { // Delete from patterns first DLList::iterator wcLink = - wildCardEntries_.begin(); + patternEntries_.begin(); DLList >::iterator reLink = - wildCardRegexps_.begin(); + patternRegexps_.begin(); // Find in patterns using exact match only if (findInPatterns(false, iter2()->keyword(), wcLink, reLink)) { - wildCardEntries_.remove(wcLink); - wildCardRegexps_.remove(reLink); + patternEntries_.remove(wcLink); + patternRegexps_.remove(reLink); } } @@ -726,8 +726,8 @@ bool Foam::dictionary::changeKeyword if (newKeyword.isPattern()) { - wildCardEntries_.insert(iter()); - wildCardRegexps_.insert + patternEntries_.insert(iter()); + patternRegexps_.insert ( autoPtr(new regExp(newKeyword)) ); @@ -793,8 +793,8 @@ void Foam::dictionary::clear() { IDLList::clear(); hashedEntries_.clear(); - wildCardEntries_.clear(); - wildCardRegexps_.clear(); + patternEntries_.clear(); + patternRegexps_.clear(); } diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index 560d86588a..a4020b6f32 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -93,10 +93,10 @@ class dictionary const dictionary& parent_; //- Entries of matching patterns - DLList wildCardEntries_; + DLList patternEntries_; //- Patterns as precompiled regular expressions - DLList > wildCardRegexps_; + DLList > patternRegexps_; // Private Member Functions diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H index 1909f4851d..2b86c53d01 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H +++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H @@ -74,20 +74,20 @@ public: // Constructors //- Construct from the parent dictionary and Istream - dictionaryEntry(const dictionary& parentDict, Istream& is); + dictionaryEntry(const dictionary& parentDict, Istream&); //- Construct from the keyword, parent dictionary and a Istream dictionaryEntry ( - const keyType& keyword, + const keyType&, const dictionary& parentDict, - Istream& is + Istream& ); //- Construct from the keyword, parent dictionary and a dictionary dictionaryEntry ( - const keyType& keyword, + const keyType&, const dictionary& parentDict, const dictionary& dict ); @@ -96,7 +96,7 @@ public: dictionaryEntry ( const dictionary& parentDict, - const dictionaryEntry& dictEnt + const dictionaryEntry& ); autoPtr clone(const dictionary& parentDict) const @@ -158,10 +158,8 @@ public: }; -#if defined (__GNUC__) template<> -#endif -Ostream& operator<<(Ostream& os, const InfoProxy& ip); +Ostream& operator<<(Ostream&, const InfoProxy&); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H index 86d8afd61d..1e5858abaf 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H @@ -75,32 +75,32 @@ public: void append ( const token& currToken, - const dictionary& dict, - Istream& is + const dictionary&, + Istream& ); //- Append the given tokens starting at the current tokenIndex - void append(const tokenList& varTokens); + void append(const tokenList&); //- Expand the given variable (keyword starts with $) - bool expandVariable(const word& keyword, const dictionary& dict); + bool expandVariable(const word&, const dictionary&); //- Expand the given function (keyword starts with #) bool expandFunction ( - const word& keyword, - const dictionary& dict, - Istream& is + const word&, + const dictionary&, + Istream& ); //- Read tokens from the given stream - bool read(const dictionary& dict, Istream&); + bool read(const dictionary&, Istream&); //- Read the complete entry from the given stream - void readEntry(const dictionary& dict, Istream&); + void readEntry(const dictionary&, Istream&); //- Insert the given tokens at token i - void insert(const tokenList& varTokens, const label i); + void insert(const tokenList&, const label i); public: @@ -108,13 +108,13 @@ public: // Constructors //- Construct from keyword and a Istream - primitiveEntry(const keyType& keyword, Istream&); + primitiveEntry(const keyType&, Istream&); - //- Construct from keyword, parent dictionary and a Istream - primitiveEntry(const keyType& keyword, const dictionary&, Istream&); + //- Construct from keyword, parent dictionary and Istream + primitiveEntry(const keyType&, const dictionary& parentDict, Istream&); //- Construct from keyword and a ITstream - primitiveEntry(const keyType& keyword, const ITstream&); + primitiveEntry(const keyType&, const ITstream&); //- Construct from keyword and a token primitiveEntry(const keyType&, const token&); @@ -182,7 +182,7 @@ public: template<> -Ostream& operator<<(Ostream& os, const InfoProxy& ip); +Ostream& operator<<(Ostream&, const InfoProxy&); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/strings/keyType/keyType.H b/src/OpenFOAM/primitives/strings/keyType/keyType.H index def0dc585e..6525a5404c 100644 --- a/src/OpenFOAM/primitives/strings/keyType/keyType.H +++ b/src/OpenFOAM/primitives/strings/keyType/keyType.H @@ -62,7 +62,8 @@ class keyType { // Private member data - bool isWildCard_; + //- Is the keyType a pattern (regular expression) + bool isPattern_; // Private Member Functions diff --git a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H index af6a91b96b..d76205d795 100644 --- a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H +++ b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H @@ -33,21 +33,21 @@ License inline Foam::keyType::keyType() : word(), - isWildCard_(false) + isPattern_(false) {} inline Foam::keyType::keyType(const keyType& s) : word(s, false), - isWildCard_(s.isPattern()) + isPattern_(s.isPattern()) {} inline Foam::keyType::keyType(const word& s) : word(s, false), - isWildCard_(false) + isPattern_(false) {} @@ -55,7 +55,7 @@ inline Foam::keyType::keyType(const word& s) inline Foam::keyType::keyType(const string& s) : word(s, false), - isWildCard_(true) + isPattern_(true) {} @@ -63,7 +63,7 @@ inline Foam::keyType::keyType(const string& s) inline Foam::keyType::keyType(const char* s) : word(s, false), - isWildCard_(false) + isPattern_(false) {} @@ -75,7 +75,7 @@ inline Foam::keyType::keyType ) : word(s, false), - isWildCard_(isPattern) + isPattern_(isPattern) {} @@ -89,7 +89,7 @@ inline bool Foam::keyType::valid(char c) bool Foam::keyType::isPattern() const { - return isWildCard_; + return isPattern_; } @@ -99,14 +99,14 @@ inline void Foam::keyType::operator=(const keyType& s) { // Bypass checking string::operator=(s); - isWildCard_ = s.isPattern(); + isPattern_ = s.isPattern_; } inline void Foam::keyType::operator=(const word& s) { word::operator=(s); - isWildCard_ = false; + isPattern_ = false; } @@ -114,7 +114,7 @@ inline void Foam::keyType::operator=(const string& s) { // Bypass checking string::operator=(s); - isWildCard_ = true; + isPattern_ = true; } @@ -122,7 +122,7 @@ inline void Foam::keyType::operator=(const char* s) { // Bypass checking string::operator=(s); - isWildCard_ = false; + isPattern_ = false; }