mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
removed last bits of wildcard vs. pattern
This commit is contained in:
@ -46,9 +46,9 @@ bool Foam::dictionary::findInPatterns
|
|||||||
DLList<autoPtr<regExp> >::const_iterator& reLink
|
DLList<autoPtr<regExp> >::const_iterator& reLink
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (wildCardEntries_.size() > 0)
|
if (patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
while (wcLink != wildCardEntries_.end())
|
while (wcLink != patternEntries_.end())
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -76,9 +76,9 @@ bool Foam::dictionary::findInPatterns
|
|||||||
DLList<autoPtr<regExp> >::iterator& reLink
|
DLList<autoPtr<regExp> >::iterator& reLink
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (wildCardEntries_.size() > 0)
|
if (patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
while (wcLink != wildCardEntries_.end())
|
while (wcLink != patternEntries_.end())
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -127,8 +127,8 @@ Foam::dictionary::dictionary
|
|||||||
|
|
||||||
if (iter().keyword().isPattern())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(&iter());
|
patternEntries_.insert(&iter());
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||||
);
|
);
|
||||||
@ -157,8 +157,8 @@ Foam::dictionary::dictionary
|
|||||||
|
|
||||||
if (iter().keyword().isPattern())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(&iter());
|
patternEntries_.insert(&iter());
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||||
);
|
);
|
||||||
@ -217,11 +217,11 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wildCardEntries_.size() > 0)
|
if (patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
DLList<entry*>::const_iterator wcLink = wildCardEntries_.begin();
|
DLList<entry*>::const_iterator wcLink = patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::const_iterator reLink =
|
DLList<autoPtr<regExp> >::const_iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInPatterns(true, keyword, wcLink, reLink))
|
if (findInPatterns(true, keyword, wcLink, reLink))
|
||||||
@ -253,12 +253,12 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
|
|
||||||
if (iter == hashedEntries_.end())
|
if (iter == hashedEntries_.end())
|
||||||
{
|
{
|
||||||
if (patternMatch && wildCardEntries_.size() > 0)
|
if (patternMatch && patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
DLList<entry*>::const_iterator wcLink =
|
DLList<entry*>::const_iterator wcLink =
|
||||||
wildCardEntries_.begin();
|
patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::const_iterator reLink =
|
DLList<autoPtr<regExp> >::const_iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
@ -292,12 +292,12 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
|
|
||||||
if (iter == hashedEntries_.end())
|
if (iter == hashedEntries_.end())
|
||||||
{
|
{
|
||||||
if (patternMatch && wildCardEntries_.size() > 0)
|
if (patternMatch && patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
DLList<entry*>::iterator wcLink =
|
DLList<entry*>::iterator wcLink =
|
||||||
wildCardEntries_.begin();
|
patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::iterator reLink =
|
DLList<autoPtr<regExp> >::iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
@ -499,8 +499,8 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
|
|
||||||
if (entryPtr->keyword().isPattern())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(entryPtr);
|
patternEntries_.insert(entryPtr);
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||||
);
|
);
|
||||||
@ -528,8 +528,8 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
|
|
||||||
if (entryPtr->keyword().isPattern())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(entryPtr);
|
patternEntries_.insert(entryPtr);
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||||
);
|
);
|
||||||
@ -622,14 +622,14 @@ bool Foam::dictionary::remove(const word& Keyword)
|
|||||||
if (iter != hashedEntries_.end())
|
if (iter != hashedEntries_.end())
|
||||||
{
|
{
|
||||||
// Delete from patterns first
|
// Delete from patterns first
|
||||||
DLList<entry*>::iterator wcLink = wildCardEntries_.begin();
|
DLList<entry*>::iterator wcLink = patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::iterator reLink = wildCardRegexps_.begin();
|
DLList<autoPtr<regExp> >::iterator reLink = patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in pattern using exact match only
|
// Find in pattern using exact match only
|
||||||
if (findInPatterns(false, Keyword, wcLink, reLink))
|
if (findInPatterns(false, Keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
wildCardEntries_.remove(wcLink);
|
patternEntries_.remove(wcLink);
|
||||||
wildCardRegexps_.remove(reLink);
|
patternRegexps_.remove(reLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDLList<entry>::remove(iter());
|
IDLList<entry>::remove(iter());
|
||||||
@ -689,15 +689,15 @@ bool Foam::dictionary::changeKeyword
|
|||||||
{
|
{
|
||||||
// Delete from patterns first
|
// Delete from patterns first
|
||||||
DLList<entry*>::iterator wcLink =
|
DLList<entry*>::iterator wcLink =
|
||||||
wildCardEntries_.begin();
|
patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::iterator reLink =
|
DLList<autoPtr<regExp> >::iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in patterns using exact match only
|
// Find in patterns using exact match only
|
||||||
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
||||||
{
|
{
|
||||||
wildCardEntries_.remove(wcLink);
|
patternEntries_.remove(wcLink);
|
||||||
wildCardRegexps_.remove(reLink);
|
patternRegexps_.remove(reLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,8 +726,8 @@ bool Foam::dictionary::changeKeyword
|
|||||||
|
|
||||||
if (newKeyword.isPattern())
|
if (newKeyword.isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(iter());
|
patternEntries_.insert(iter());
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(newKeyword))
|
autoPtr<regExp>(new regExp(newKeyword))
|
||||||
);
|
);
|
||||||
@ -793,8 +793,8 @@ void Foam::dictionary::clear()
|
|||||||
{
|
{
|
||||||
IDLList<entry>::clear();
|
IDLList<entry>::clear();
|
||||||
hashedEntries_.clear();
|
hashedEntries_.clear();
|
||||||
wildCardEntries_.clear();
|
patternEntries_.clear();
|
||||||
wildCardRegexps_.clear();
|
patternRegexps_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -93,10 +93,10 @@ class dictionary
|
|||||||
const dictionary& parent_;
|
const dictionary& parent_;
|
||||||
|
|
||||||
//- Entries of matching patterns
|
//- Entries of matching patterns
|
||||||
DLList<entry*> wildCardEntries_;
|
DLList<entry*> patternEntries_;
|
||||||
|
|
||||||
//- Patterns as precompiled regular expressions
|
//- Patterns as precompiled regular expressions
|
||||||
DLList<autoPtr<regExp> > wildCardRegexps_;
|
DLList<autoPtr<regExp> > patternRegexps_;
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -74,20 +74,20 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from the parent dictionary and Istream
|
//- 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
|
//- Construct from the keyword, parent dictionary and a Istream
|
||||||
dictionaryEntry
|
dictionaryEntry
|
||||||
(
|
(
|
||||||
const keyType& keyword,
|
const keyType&,
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
Istream& is
|
Istream&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from the keyword, parent dictionary and a dictionary
|
//- Construct from the keyword, parent dictionary and a dictionary
|
||||||
dictionaryEntry
|
dictionaryEntry
|
||||||
(
|
(
|
||||||
const keyType& keyword,
|
const keyType&,
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
dictionaryEntry
|
dictionaryEntry
|
||||||
(
|
(
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
const dictionaryEntry& dictEnt
|
const dictionaryEntry&
|
||||||
);
|
);
|
||||||
|
|
||||||
autoPtr<entry> clone(const dictionary& parentDict) const
|
autoPtr<entry> clone(const dictionary& parentDict) const
|
||||||
@ -158,10 +158,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined (__GNUC__)
|
|
||||||
template<>
|
template<>
|
||||||
#endif
|
Ostream& operator<<(Ostream&, const InfoProxy<dictionaryEntry>&);
|
||||||
Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryEntry>& ip);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -75,32 +75,32 @@ public:
|
|||||||
void append
|
void append
|
||||||
(
|
(
|
||||||
const token& currToken,
|
const token& currToken,
|
||||||
const dictionary& dict,
|
const dictionary&,
|
||||||
Istream& is
|
Istream&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Append the given tokens starting at the current tokenIndex
|
//- 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 $)
|
//- 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 #)
|
//- Expand the given function (keyword starts with #)
|
||||||
bool expandFunction
|
bool expandFunction
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word&,
|
||||||
const dictionary& dict,
|
const dictionary&,
|
||||||
Istream& is
|
Istream&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read tokens from the given stream
|
//- 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
|
//- 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
|
//- Insert the given tokens at token i
|
||||||
void insert(const tokenList& varTokens, const label i);
|
void insert(const tokenList&, const label i);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -108,13 +108,13 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from keyword and a Istream
|
//- Construct from keyword and a Istream
|
||||||
primitiveEntry(const keyType& keyword, Istream&);
|
primitiveEntry(const keyType&, Istream&);
|
||||||
|
|
||||||
//- Construct from keyword, parent dictionary and a Istream
|
//- Construct from keyword, parent dictionary and Istream
|
||||||
primitiveEntry(const keyType& keyword, const dictionary&, Istream&);
|
primitiveEntry(const keyType&, const dictionary& parentDict, Istream&);
|
||||||
|
|
||||||
//- Construct from keyword and a ITstream
|
//- Construct from keyword and a ITstream
|
||||||
primitiveEntry(const keyType& keyword, const ITstream&);
|
primitiveEntry(const keyType&, const ITstream&);
|
||||||
|
|
||||||
//- Construct from keyword and a token
|
//- Construct from keyword and a token
|
||||||
primitiveEntry(const keyType&, const token&);
|
primitiveEntry(const keyType&, const token&);
|
||||||
@ -182,7 +182,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
Ostream& operator<<(Ostream& os, const InfoProxy<primitiveEntry>& ip);
|
Ostream& operator<<(Ostream&, const InfoProxy<primitiveEntry>&);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -62,7 +62,8 @@ class keyType
|
|||||||
{
|
{
|
||||||
// Private member data
|
// Private member data
|
||||||
|
|
||||||
bool isWildCard_;
|
//- Is the keyType a pattern (regular expression)
|
||||||
|
bool isPattern_;
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -33,21 +33,21 @@ License
|
|||||||
inline Foam::keyType::keyType()
|
inline Foam::keyType::keyType()
|
||||||
:
|
:
|
||||||
word(),
|
word(),
|
||||||
isWildCard_(false)
|
isPattern_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::keyType::keyType(const keyType& s)
|
inline Foam::keyType::keyType(const keyType& s)
|
||||||
:
|
:
|
||||||
word(s, false),
|
word(s, false),
|
||||||
isWildCard_(s.isPattern())
|
isPattern_(s.isPattern())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::keyType::keyType(const word& s)
|
inline Foam::keyType::keyType(const word& s)
|
||||||
:
|
:
|
||||||
word(s, false),
|
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)
|
inline Foam::keyType::keyType(const string& s)
|
||||||
:
|
:
|
||||||
word(s, false),
|
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)
|
inline Foam::keyType::keyType(const char* s)
|
||||||
:
|
:
|
||||||
word(s, false),
|
word(s, false),
|
||||||
isWildCard_(false)
|
isPattern_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ inline Foam::keyType::keyType
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
word(s, false),
|
word(s, false),
|
||||||
isWildCard_(isPattern)
|
isPattern_(isPattern)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ inline bool Foam::keyType::valid(char c)
|
|||||||
|
|
||||||
bool Foam::keyType::isPattern() const
|
bool Foam::keyType::isPattern() const
|
||||||
{
|
{
|
||||||
return isWildCard_;
|
return isPattern_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,14 +99,14 @@ inline void Foam::keyType::operator=(const keyType& s)
|
|||||||
{
|
{
|
||||||
// Bypass checking
|
// Bypass checking
|
||||||
string::operator=(s);
|
string::operator=(s);
|
||||||
isWildCard_ = s.isPattern();
|
isPattern_ = s.isPattern_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::keyType::operator=(const word& s)
|
inline void Foam::keyType::operator=(const word& s)
|
||||||
{
|
{
|
||||||
word::operator=(s);
|
word::operator=(s);
|
||||||
isWildCard_ = false;
|
isPattern_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ inline void Foam::keyType::operator=(const string& s)
|
|||||||
{
|
{
|
||||||
// Bypass checking
|
// Bypass checking
|
||||||
string::operator=(s);
|
string::operator=(s);
|
||||||
isWildCard_ = true;
|
isPattern_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ inline void Foam::keyType::operator=(const char* s)
|
|||||||
{
|
{
|
||||||
// Bypass checking
|
// Bypass checking
|
||||||
string::operator=(s);
|
string::operator=(s);
|
||||||
isWildCard_ = false;
|
isPattern_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user