diff --git a/applications/test/dictionary/dictionaryTest.C b/applications/test/dictionary/dictionaryTest.C index d8580bdf54..558ec7fec6 100644 --- a/applications/test/dictionary/dictionaryTest.C +++ b/applications/test/dictionary/dictionaryTest.C @@ -41,34 +41,44 @@ using namespace Foam; int main(int argc, char *argv[]) { - Info<< dictionary(IFstream("testDict")()) << endl; + { + dictionary dict(IFstream("testDict")()); + Info<< "dict: " << dict << nl + << "toc: " << dict.toc() << nl + << "keys: " << dict.keys() << nl + << "patterns: " << dict.keys(true) << endl; + } + IOobject::writeDivider(Info); { dictionary dict(IFstream("testDictRegex")()); + dict.add(keyType("fooba[rz]", true), "anything"); - Info<< "dict:" << dict << endl; + Info<< "dict:" << dict << nl + << "toc: " << dict.toc() << nl + << "keys: " << dict.keys() << nl + << "patterns: " << dict.keys(true) << endl; - // Wildcard find. - Info<< "Wildcard find \"abc\" in top directory : " + Info<< "Pattern find \"abc\" in top directory : " << dict.lookup("abc") << endl; - Info<< "Wildcard find \"abc\" in sub directory : " + Info<< "Pattern find \"abc\" in sub directory : " << dict.subDict("someDict").lookup("abc") << endl; - Info<< "Recursive wildcard find \"def\" in sub directory : " + Info<< "Recursive pattern find \"def\" in sub directory : " << dict.subDict("someDict").lookup("def", true) << endl; - Info<< "Recursive wildcard find \"foo\" in sub directory : " + Info<< "Recursive pattern find \"foo\" in sub directory : " << dict.subDict("someDict").lookup("foo", true) << endl; - Info<< "Recursive wildcard find \"fooz\" in sub directory : " + Info<< "Recursive pattern find \"fooz\" in sub directory : " << dict.subDict("someDict").lookup("fooz", true) << endl; - Info<< "Recursive wildcard find \"bar\" in sub directory : " + Info<< "Recursive pattern find \"bar\" in sub directory : " << dict.subDict("someDict").lookup("bar", true) << endl; - Info<< "Recursive wildcard find \"xxx\" in sub directory : " + Info<< "Recursive pattern find \"xxx\" in sub directory : " << dict.subDict("someDict").lookup("xxx", true) << endl; } diff --git a/applications/test/dictionary/testDictRegex b/applications/test/dictionary/testDictRegex index d4252cd3be..01d4274ba8 100644 --- a/applications/test/dictionary/testDictRegex +++ b/applications/test/dictionary/testDictRegex @@ -18,8 +18,10 @@ FoamFile ".*" parentValue1; "[n-z].*" parentValue2; "f.*" parentValue3; +keyX parentValue4; +keyY parentValue5; -someDict +"(.*)Dict" { foo subdictValue0; bar $f.*; // should this really match 'foo'? @@ -28,7 +30,7 @@ someDict "a.*c" subdictValue3; "ab.*" subdictValue2; "a.*" subdictValue1; - abcd subdictValue4; + abcd \1; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C index 577494aa1c..98752700a1 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C @@ -32,22 +32,22 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Write keyType -Foam::Ostream& Foam::Ostream::write(const keyType& s) +// Write keyType +Foam::Ostream& Foam::Ostream::write(const keyType& kw) { - // Write as word? - if (s.isWildCard()) + // Write as word or string + if (kw.isPattern()) { - return write(static_cast(s)); + return write(static_cast(kw)); } else { - return write(static_cast(s)); + return write(static_cast(kw)); } } -//- Decrememt the indent level +// Decrement the indent level void Foam::Ostream::decrIndent() { if (indentLevel_ == 0) @@ -62,15 +62,26 @@ void Foam::Ostream::decrIndent() } -// Write the keyword to the Ostream followed by appropriate indentation -Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::keyType& keyword) +// Write the keyword followed by appropriate indentation +Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw) { indent(); - write(keyword); + write(kw); - label nSpaces = max(entryIndentation_ - label(keyword.size()), 1); + label nSpaces = entryIndentation_ - label(kw.size()); - for (label i=0; i::const_iterator& wcLink, DLList >::const_iterator& reLink @@ -50,11 +50,11 @@ bool Foam::dictionary::findInWildcards { while (wcLink != wildCardEntries_.end()) { - if (!wildCardMatch && wcLink()->keyword() == Keyword) - { - return true; - } - else if (wildCardMatch && reLink()->match(Keyword)) + if + ( + patternMatch ? reLink()->match(Keyword) + : wcLink()->keyword() == Keyword + ) { return true; } @@ -68,9 +68,9 @@ bool Foam::dictionary::findInWildcards } -bool Foam::dictionary::findInWildcards +bool Foam::dictionary::findInPatterns ( - const bool wildCardMatch, + const bool patternMatch, const word& Keyword, DLList::iterator& wcLink, DLList >::iterator& reLink @@ -80,11 +80,11 @@ bool Foam::dictionary::findInWildcards { while (wcLink != wildCardEntries_.end()) { - if (!wildCardMatch && wcLink()->keyword() == Keyword) - { - return true; - } - else if (wildCardMatch && reLink()->match(Keyword)) + if + ( + patternMatch ? reLink()->match(Keyword) + : wcLink()->keyword() == Keyword + ) { return true; } @@ -125,7 +125,7 @@ Foam::dictionary::dictionary { hashedEntries_.insert(iter().keyword(), &iter()); - if (iter().keyword().isWildCard()) + if (iter().keyword().isPattern()) { wildCardEntries_.insert(&iter()); wildCardRegexps_.insert @@ -155,7 +155,7 @@ Foam::dictionary::dictionary { hashedEntries_.insert(iter().keyword(), &iter()); - if (iter().keyword().isWildCard()) + if (iter().keyword().isPattern()) { wildCardEntries_.insert(&iter()); wildCardRegexps_.insert @@ -223,8 +223,8 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const DLList >::const_iterator reLink = wildCardRegexps_.begin(); - // Find in wildcards using regular expressions only - if (findInWildcards(true, keyword, wcLink, reLink)) + // Find in patterns using regular expressions only + if (findInPatterns(true, keyword, wcLink, reLink)) { return true; } @@ -246,22 +246,22 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr ( const word& keyword, bool recursive, - bool wildCardMatch + bool patternMatch ) const { HashTable::const_iterator iter = hashedEntries_.find(keyword); if (iter == hashedEntries_.end()) { - if (wildCardMatch && wildCardEntries_.size() > 0) + if (patternMatch && wildCardEntries_.size() > 0) { DLList::const_iterator wcLink = wildCardEntries_.begin(); DLList >::const_iterator reLink = wildCardRegexps_.begin(); - // Find in wildcards using regular expressions only - if (findInWildcards(wildCardMatch, keyword, wcLink, reLink)) + // Find in patterns using regular expressions only + if (findInPatterns(patternMatch, keyword, wcLink, reLink)) { return wcLink(); } @@ -269,7 +269,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr if (recursive && &parent_ != &dictionary::null) { - return parent_.lookupEntryPtr(keyword, recursive, wildCardMatch); + return parent_.lookupEntryPtr(keyword, recursive, patternMatch); } else { @@ -285,21 +285,22 @@ Foam::entry* Foam::dictionary::lookupEntryPtr ( const word& keyword, bool recursive, - bool wildCardMatch + bool patternMatch ) { HashTable::iterator iter = hashedEntries_.find(keyword); if (iter == hashedEntries_.end()) { - if (wildCardMatch && wildCardEntries_.size() > 0) + if (patternMatch && wildCardEntries_.size() > 0) { DLList::iterator wcLink = wildCardEntries_.begin(); DLList >::iterator reLink = wildCardRegexps_.begin(); - // Find in wildcards using regular expressions only - if (findInWildcards(wildCardMatch, keyword, wcLink, reLink)) + + // Find in patterns using regular expressions only + if (findInPatterns(patternMatch, keyword, wcLink, reLink)) { return wcLink(); } @@ -311,7 +312,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr ( keyword, recursive, - wildCardMatch + patternMatch ); } else @@ -328,10 +329,10 @@ const Foam::entry& Foam::dictionary::lookupEntry ( const word& keyword, bool recursive, - bool wildCardMatch + bool patternMatch ) const { - const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch); + const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch); if (entryPtr == NULL) { @@ -352,16 +353,16 @@ Foam::ITstream& Foam::dictionary::lookup ( const word& keyword, bool recursive, - bool wildCardMatch + bool patternMatch ) const { - return lookupEntry(keyword, recursive, wildCardMatch).stream(); + return lookupEntry(keyword, recursive, patternMatch).stream(); } bool Foam::dictionary::isDict(const word& keyword) const { - // Find non-recursive with wildcards + // Find non-recursive with patterns const entry* entryPtr = lookupEntryPtr(keyword, false, true); if (entryPtr) @@ -430,7 +431,7 @@ Foam::wordList Foam::dictionary::toc() const { wordList keys(size()); - label i = 0; + label nKeys = 0; for ( IDLList::const_iterator iter = begin(); @@ -438,13 +439,36 @@ Foam::wordList Foam::dictionary::toc() const ++iter ) { - keys[i++] = iter().keyword(); + keys[nKeys++] = iter().keyword(); } return keys; } +Foam::List Foam::dictionary::keys(bool patterns) const +{ + List keys(size()); + + label nKeys = 0; + for + ( + IDLList::const_iterator iter = begin(); + iter != end(); + ++iter + ) + { + if (iter().keyword().isPattern() ? patterns : !patterns) + { + keys[nKeys++] = iter().keyword(); + } + } + keys.setSize(nKeys); + + return keys; +} + + bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) { HashTable::iterator iter = hashedEntries_.find @@ -473,7 +497,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) { entryPtr->name() = name_ + "::" + entryPtr->keyword(); - if (entryPtr->keyword().isWildCard()) + if (entryPtr->keyword().isPattern()) { wildCardEntries_.insert(entryPtr); wildCardRegexps_.insert @@ -502,7 +526,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) entryPtr->name() = name_ + "::" + entryPtr->keyword(); IDLList::append(entryPtr); - if (entryPtr->keyword().isWildCard()) + if (entryPtr->keyword().isPattern()) { wildCardEntries_.insert(entryPtr); wildCardRegexps_.insert @@ -597,13 +621,12 @@ bool Foam::dictionary::remove(const word& Keyword) if (iter != hashedEntries_.end()) { - // Delete from wildcards first - DLList::iterator wcLink = - wildCardEntries_.begin(); + // Delete from patterns first + DLList::iterator wcLink = wildCardEntries_.begin(); DLList >::iterator reLink = wildCardRegexps_.begin(); - // Find in wildcards using exact match only - if (findInWildcards(false, Keyword, wcLink, reLink)) + // Find in pattern using exact match only + if (findInPatterns(false, Keyword, wcLink, reLink)) { wildCardEntries_.remove(wcLink); wildCardRegexps_.remove(reLink); @@ -643,14 +666,14 @@ bool Foam::dictionary::changeKeyword return false; } - if (iter()->keyword().isWildCard()) + if (iter()->keyword().isPattern()) { FatalErrorIn ( "dictionary::changeKeyword(const word&, const word&, bool)" ) << "Old keyword "<< oldKeyword - << " is a wildcard." - << "Wildcard replacement not yet implemented." + << " is a pattern." + << "Pattern replacement not yet implemented." << exit(FatalError); } @@ -662,16 +685,16 @@ bool Foam::dictionary::changeKeyword { if (forceOverwrite) { - if (iter2()->keyword().isWildCard()) + if (iter2()->keyword().isPattern()) { - // Delete from wildcards first + // Delete from patterns first DLList::iterator wcLink = wildCardEntries_.begin(); DLList >::iterator reLink = wildCardRegexps_.begin(); - // Find in wildcards using exact match only - if (findInWildcards(false, iter2()->keyword(), wcLink, reLink)) + // Find in patterns using exact match only + if (findInPatterns(false, iter2()->keyword(), wcLink, reLink)) { wildCardEntries_.remove(wcLink); wildCardRegexps_.remove(reLink); @@ -701,7 +724,7 @@ bool Foam::dictionary::changeKeyword hashedEntries_.erase(oldKeyword); hashedEntries_.insert(newKeyword, iter()); - if (newKeyword.isWildCard()) + if (newKeyword.isPattern()) { wildCardEntries_.insert(iter()); wildCardRegexps_.insert diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index 1d87a08fd6..560d86588a 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -27,12 +27,12 @@ Class Description A list of keyword definitions, which are a keyword followed by any number - of values (e.g. words and numbers). The keywords can represent wildcards + of values (e.g. words and numbers). The keywords can represent patterns which are matched using Posix regular expressions. The general order for - searching is + searching is as follows: - exact match - - wildcard match (in reverse order) - - optional recursion into subdictionaries + - pattern match (in reverse order) + - optional recursion into the enclosing (parent) dictionaries The dictionary class is the base class for IOdictionary. It also serves as a bootstrap dictionary for the objectRegistry data @@ -92,29 +92,27 @@ class dictionary //- Parent dictionary const dictionary& parent_; - //- Wildcard entries + //- Entries of matching patterns DLList wildCardEntries_; - //- Wildcard precompiled regular expressions + //- Patterns as precompiled regular expressions DLList > wildCardRegexps_; // Private Member Functions - //- Search wildcard table either for exact match or for regular - // expression match. - bool findInWildcards + //- Search patterns table for exact match or regular expression match + bool findInPatterns ( - const bool wildCardMatch, + const bool patternMatch, const word& Keyword, DLList::const_iterator& wcLink, DLList >::const_iterator& reLink ) const; - //- Search wildcard table either for exact match or for regular - // expression match. - bool findInWildcards + //- Search patterns table for exact match or regular expression match + bool findInPatterns ( - const bool wildCardMatch, + const bool patternMatch, const word& Keyword, DLList::iterator& wcLink, DLList >::iterator& reLink @@ -210,83 +208,88 @@ public: // Search and lookup //- Search dictionary for given keyword - // If recursive search parent dictionaries + // If recursive, search parent dictionaries bool found(const word&, bool recursive=false) const; //- Find and return an entry data stream pointer if present // otherwise return NULL. - // If recursive search parent dictionaries. - // If wildCardMatch use wildcards. + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions const entry* lookupEntryPtr ( const word&, bool recursive, - bool wildCardMatch + bool patternMatch ) const; //- Find and return an entry data stream pointer for manipulation // if present otherwise return NULL. - // If recursive search parent dictionaries. - // If wildCardMatch use wildcards. + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions. entry* lookupEntryPtr ( const word&, bool recursive, - bool wildCardMatch + bool patternMatch ); //- Find and return an entry data stream if present otherwise error. - // If recursive search parent dictionaries. - // If wildCardMatch use wildcards. + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions. const entry& lookupEntry ( const word&, bool recursive, - bool wildCardMatch + bool patternMatch ) const; //- Find and return an entry data stream - // If recursive search parent dictionaries + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions. ITstream& lookup ( const word&, bool recursive=false, - bool wildCardMatch=true + bool patternMatch=true ) const; //- Find and return a T, // if not found return the given default value - // If recursive search parent dictionaries + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions. template T lookupOrDefault ( const word&, const T&, bool recursive=false, - bool wildCardMatch=true + bool patternMatch=true ) const; //- Find and return a T, if not found return the given // default value, and add to dictionary. - // If recursive search parent dictionaries + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions. template T lookupOrAddDefault ( const word&, const T&, bool recursive=false, - bool wildCardMatch=true + bool patternMatch=true ); //- Find an entry if present, and assign to T - // Returns true if the entry was found + // Returns true if the entry was found. + // If recursive, search parent dictionaries. + // If patternMatch, use regular expressions. template bool readIfPresent ( const word&, T&, bool recursive=false, - bool wildCardMatch=true + bool patternMatch=true ) const; //- Check if entry is a sub-dictionary @@ -305,6 +308,9 @@ public: //- Return the table of contents wordList toc() const; + //- Return the list of available keys or patterns + List keys(bool patterns=false) const; + // Editing //- Add a new entry @@ -393,7 +399,7 @@ public: void operator=(const dictionary&); //- Include entries from the given dictionary. - // Warn, but do not overwrite existing entries + // Warn, but do not overwrite existing entries. void operator+=(const dictionary&); //- Conditionally include entries from the given dictionary. @@ -417,13 +423,13 @@ public: // Global Operators -//- Combine dictionaries starting from the entries in dict1 and then including -// those from dict2. +//- Combine dictionaries. +// Starting from the entries in dict1 and then including those from dict2. // Warn, but do not overwrite the entries from dict1. dictionary operator+(const dictionary& dict1, const dictionary& dict2); -//- Combine dictionaries starting from the entries in dict1 and then including -// those from dict2. +//- Combine dictionaries. +// Starting from the entries in dict1 and then including those from dict2. // Do not overwrite the entries from dict1. dictionary operator|(const dictionary& dict1, const dictionary& dict2); diff --git a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C index a47a976814..65883ba535 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C +++ b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C @@ -35,18 +35,18 @@ T Foam::dictionary::lookupOrDefault const word& keyword, const T& deflt, bool recursive, - bool wildCardMatch + bool patternMatch ) const { - const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch); + const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch); - if (entryPtr == NULL) + if (entryPtr) { - return deflt; + return pTraits(entryPtr->stream()); } else { - return pTraits(entryPtr->stream()); + return deflt; } } @@ -57,19 +57,19 @@ T Foam::dictionary::lookupOrAddDefault const word& keyword, const T& deflt, bool recursive, - bool wildCardMatch + bool patternMatch ) { - const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch); + const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch); - if (entryPtr == NULL) + if (entryPtr) { - add(new primitiveEntry(keyword, deflt)); - return deflt; + return pTraits(entryPtr->stream()); } else { - return pTraits(entryPtr->stream()); + add(new primitiveEntry(keyword, deflt)); + return deflt; } } @@ -80,20 +80,20 @@ bool Foam::dictionary::readIfPresent const word& k, T& val, bool recursive, - bool wildCardMatch + bool patternMatch ) const { - const entry* entryPtr = lookupEntryPtr(k, recursive, wildCardMatch); + const entry* entryPtr = lookupEntryPtr(k, recursive, patternMatch); - if (entryPtr == NULL) - { - return false; - } - else + if (entryPtr) { entryPtr->stream() >> val; return true; } + else + { + return false; + } } diff --git a/src/OpenFOAM/primitives/strings/keyType/keyType.H b/src/OpenFOAM/primitives/strings/keyType/keyType.H index 4d4c358d5d..def0dc585e 100644 --- a/src/OpenFOAM/primitives/strings/keyType/keyType.H +++ b/src/OpenFOAM/primitives/strings/keyType/keyType.H @@ -28,8 +28,8 @@ Class Description A class for handling keywords in dictionaries. - A keyType is the keyword of a dictionary. It differs from word in that - it accepts wildcards. + A keyType is the keyword of a dictionary. + It differs from word in that it accepts patterns (regular expressions). SourceFiles keyType.C @@ -53,7 +53,7 @@ class Ostream; /*---------------------------------------------------------------------------*\ - Class keyType Declaration + Class keyType Declaration \*---------------------------------------------------------------------------*/ class keyType @@ -78,22 +78,22 @@ public: inline keyType(); //- Construct as copy - inline keyType(const keyType& s); + inline keyType(const keyType&); //- Construct as copy of word - inline keyType(const word& s); + inline keyType(const word&); //- Construct as copy of string. Expect it to be regular expression. - inline keyType(const string& s); + inline keyType(const string&); //- Construct as copy of character array - inline keyType(const char* s); + inline keyType(const char*); //- Construct as copy of std::string - inline keyType(const std::string& s, const bool isWildCard); + inline keyType(const std::string&, const bool isPattern); //- Construct from Istream - keyType(Istream& is); + keyType(Istream&); // Member functions @@ -101,29 +101,25 @@ public: //- Is this character valid for a keyType inline static bool valid(char c); - //- Is the type a wildcard? - inline bool isWildCard() const; - + //- Should be treated as a match rather than a literal string + inline bool isPattern() const; // Member operators // Assignment - inline void operator=(const keyType& s); + inline void operator=(const keyType&); + inline void operator=(const word&); //- Assign from regular expression. - inline void operator=(const string& s); - - inline void operator=(const word& s); - + inline void operator=(const string&); inline void operator=(const char*); // IOstream operators - friend Istream& operator>>(Istream& is, keyType& w); - - friend Ostream& operator<<(Ostream& os, const keyType& w); + friend Istream& operator>>(Istream&, keyType&); + friend Ostream& operator<<(Ostream&, const keyType&); }; diff --git a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H index f3785ebbff..af6a91b96b 100644 --- a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H +++ b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H @@ -30,7 +30,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -//- Construct null inline Foam::keyType::keyType() : word(), @@ -38,15 +37,13 @@ inline Foam::keyType::keyType() {} -//- Construct as copy inline Foam::keyType::keyType(const keyType& s) : word(s, false), - isWildCard_(s.isWildCard()) + isWildCard_(s.isPattern()) {} -//- Construct as copy of word inline Foam::keyType::keyType(const word& s) : word(s, false), @@ -54,7 +51,7 @@ inline Foam::keyType::keyType(const word& s) {} -//- Construct as copy of string. Expect it to be regular expression +// Construct as copy of string. Expect it to be regular expression inline Foam::keyType::keyType(const string& s) : word(s, false), @@ -62,7 +59,7 @@ inline Foam::keyType::keyType(const string& s) {} -//- Construct as copy of character array +// Construct as copy of character array inline Foam::keyType::keyType(const char* s) : word(s, false), @@ -74,11 +71,11 @@ inline Foam::keyType::keyType(const char* s) inline Foam::keyType::keyType ( const std::string& s, - const bool isWildCard + const bool isPattern ) : word(s, false), - isWildCard_(isWildCard) + isWildCard_(isPattern) {} @@ -90,7 +87,7 @@ inline bool Foam::keyType::valid(char c) } -bool Foam::keyType::isWildCard() const +bool Foam::keyType::isPattern() const { return isWildCard_; } @@ -102,7 +99,7 @@ inline void Foam::keyType::operator=(const keyType& s) { // Bypass checking string::operator=(s); - isWildCard_ = s.isWildCard(); + isWildCard_ = s.isPattern(); } diff --git a/src/OpenFOAM/primitives/strings/word/word.H b/src/OpenFOAM/primitives/strings/word/word.H index 6565c28b4f..96d2c73cfb 100644 --- a/src/OpenFOAM/primitives/strings/word/word.H +++ b/src/OpenFOAM/primitives/strings/word/word.H @@ -87,7 +87,7 @@ public: inline word(const word&); //- Construct as copy of character array - inline word(const char*, const bool doStripInvalid = true); + inline word(const char*, const bool doStripInvalid=true); //- Construct as copy with a maximum number of characters inline word @@ -98,10 +98,10 @@ public: ); //- Construct as copy of string - inline word(const string&, const bool doStripInvalid = true); + inline word(const string&, const bool doStripInvalid=true); //- Construct as copy of std::string - inline word(const std::string&, const bool doStripInvalid = true); + inline word(const std::string&, const bool doStripInvalid=true); //- Construct from Istream word(Istream&);