mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: minor code formatting
This commit is contained in:
@ -62,6 +62,7 @@ class regExp
|
|||||||
//- Precompiled regular expression
|
//- Precompiled regular expression
|
||||||
mutable regex_t* preg_;
|
mutable regex_t* preg_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -72,6 +73,8 @@ class regExp
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Static Member Functions
|
||||||
|
|
||||||
//- Is character a regular expression meta-character?
|
//- Is character a regular expression meta-character?
|
||||||
// any character: '.' \n
|
// any character: '.' \n
|
||||||
// quantifiers: '*', '+', '?' \n
|
// quantifiers: '*', '+', '?' \n
|
||||||
@ -102,66 +105,69 @@ public:
|
|||||||
//- Construct from std::string (or string), optionally ignoring case
|
//- Construct from std::string (or string), optionally ignoring case
|
||||||
regExp(const std::string&, const bool ignoreCase=false);
|
regExp(const std::string&, const bool ignoreCase=false);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~regExp();
|
~regExp();
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Access
|
// Access
|
||||||
|
|
||||||
//- Return true if a precompiled expression does not exist
|
//- Return true if a precompiled expression does not exist
|
||||||
inline bool empty() const
|
inline bool empty() const
|
||||||
{
|
{
|
||||||
return !preg_;
|
return !preg_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Does a precompiled expression exist?
|
//- Does a precompiled expression exist?
|
||||||
inline bool exists() const
|
inline bool exists() const
|
||||||
{
|
{
|
||||||
return preg_ ? true : false;
|
return preg_ ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the number of (groups)
|
//- Return the number of (groups)
|
||||||
inline int ngroups() const
|
inline int ngroups() const
|
||||||
{
|
{
|
||||||
return preg_ ? preg_->re_nsub : 0;
|
return preg_ ? preg_->re_nsub : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Editing
|
// Editing
|
||||||
|
|
||||||
//- Compile pattern into a regular expression, optionally ignoring case
|
//- Compile pattern into a regular expression, optionally ignoring
|
||||||
void set(const char*, const bool ignoreCase=false) const;
|
// case
|
||||||
|
void set(const char*, const bool ignoreCase=false) const;
|
||||||
|
|
||||||
//- Compile pattern into a regular expression, optionally ignoring case
|
//- Compile pattern into a regular expression, optionally ignoring
|
||||||
void set(const std::string&, const bool ignoreCase=false) const;
|
// case
|
||||||
|
void set(const std::string&, const bool ignoreCase=false) const;
|
||||||
|
|
||||||
|
|
||||||
//- Release precompiled expression.
|
//- Release precompiled expression.
|
||||||
// Returns true if precompiled expression existed before clear
|
// Returns true if precompiled expression existed before clear
|
||||||
bool clear() const;
|
bool clear() const;
|
||||||
|
|
||||||
|
|
||||||
//- Searching
|
// Searching
|
||||||
|
|
||||||
//- Find position within string.
|
//- Find position within string.
|
||||||
// Returns the index where it begins or string::npos if not found
|
// Returns the index where it begins or string::npos if not found
|
||||||
std::string::size_type find(const std::string& str) const;
|
std::string::size_type find(const std::string& str) const;
|
||||||
|
|
||||||
//- Return true if it matches the entire string
|
//- Return true if it matches the entire string
|
||||||
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||||
bool match(const std::string&) const;
|
bool match(const std::string&) const;
|
||||||
|
|
||||||
//- Return true if it matches and sets the sub-groups matched
|
//- Return true if it matches and sets the sub-groups matched
|
||||||
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||||
bool match(const string&, List<string>& groups) const;
|
bool match(const string&, List<string>& groups) const;
|
||||||
|
|
||||||
//- Return true if the regex was found within string
|
//- Return true if the regex was found within string
|
||||||
bool search(const std::string& str) const
|
bool search(const std::string& str) const
|
||||||
{
|
{
|
||||||
return std::string::npos != find(str);
|
return std::string::npos != find(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -173,7 +179,6 @@ public:
|
|||||||
//- Assign and compile pattern from string
|
//- Assign and compile pattern from string
|
||||||
// Always case sensitive
|
// Always case sensitive
|
||||||
void operator=(const std::string&);
|
void operator=(const std::string&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -110,6 +110,7 @@ public:
|
|||||||
//- Test string for regular expression meta characters
|
//- Test string for regular expression meta characters
|
||||||
static inline bool isPattern(const string&);
|
static inline bool isPattern(const string&);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
@ -123,66 +124,75 @@ public:
|
|||||||
|
|
||||||
//- Construct as copy of character array
|
//- Construct as copy of character array
|
||||||
// Optionally specify how it should be treated.
|
// Optionally specify how it should be treated.
|
||||||
inline wordRe(const char*, const compOption=LITERAL);
|
inline wordRe(const char*, const compOption = LITERAL);
|
||||||
|
|
||||||
//- Construct as copy of string.
|
//- Construct as copy of string.
|
||||||
// Optionally specify how it should be treated.
|
// Optionally specify how it should be treated.
|
||||||
inline wordRe(const string&, const compOption=LITERAL);
|
inline wordRe(const string&, const compOption = LITERAL);
|
||||||
|
|
||||||
//- Construct as copy of std::string
|
//- Construct as copy of std::string
|
||||||
// Optionally specify how it should be treated.
|
// Optionally specify how it should be treated.
|
||||||
inline wordRe(const std::string&, const compOption=LITERAL);
|
inline wordRe(const std::string&, const compOption = LITERAL);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
// Words are treated as literals, strings with an auto-test
|
// Words are treated as literals, strings with an auto-test
|
||||||
wordRe(Istream&);
|
wordRe(Istream&);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Access
|
// Access
|
||||||
|
|
||||||
//- Should be treated as a match rather than a literal string?
|
//- Should be treated as a match rather than a literal string?
|
||||||
inline bool isPattern() const;
|
inline bool isPattern() const;
|
||||||
|
|
||||||
//- Infrastructure
|
|
||||||
|
|
||||||
//- Compile the regular expression
|
// Infrastructure
|
||||||
inline bool compile() const;
|
|
||||||
|
|
||||||
//- Possibly compile the regular expression, with greater control
|
//- Compile the regular expression
|
||||||
inline bool compile(const compOption) const;
|
inline bool compile() const;
|
||||||
|
|
||||||
//- Recompile an existing regular expression
|
//- Possibly compile the regular expression, with greater control
|
||||||
inline bool recompile() const;
|
inline bool compile(const compOption) const;
|
||||||
|
|
||||||
//- Frees precompiled regular expression, making wordRe a literal.
|
//- Recompile an existing regular expression
|
||||||
// Optionally strips invalid word characters
|
inline bool recompile() const;
|
||||||
inline void uncompile(const bool doStripInvalid=false) const;
|
|
||||||
|
|
||||||
//- Editing
|
//- Frees precompiled regular expression, making wordRe a literal.
|
||||||
|
// Optionally strips invalid word characters
|
||||||
|
inline void uncompile(const bool doStripInvalid = false) const;
|
||||||
|
|
||||||
//- Copy string, auto-test for regular expression or other options
|
|
||||||
inline void set(const std::string&, const compOption=DETECT);
|
|
||||||
|
|
||||||
//- Copy string, auto-test for regular expression or other options
|
// Editing
|
||||||
inline void set(const char*, const compOption=DETECT);
|
|
||||||
|
|
||||||
//- Clear string and precompiled regular expression
|
//- Copy string, auto-test for regular expression or other options
|
||||||
inline void clear();
|
inline void set(const std::string&, const compOption = DETECT);
|
||||||
|
|
||||||
//- Searching
|
//- Copy string, auto-test for regular expression or other options
|
||||||
|
inline void set(const char*, const compOption = DETECT);
|
||||||
|
|
||||||
//- Smart match as regular expression or as a string
|
//- Clear string and precompiled regular expression
|
||||||
// Optionally force a literal match only
|
inline void clear();
|
||||||
inline bool match(const std::string&, bool literalMatch=false) const;
|
|
||||||
|
|
||||||
//- Miscellaneous
|
|
||||||
|
|
||||||
//- Return a string with quoted meta-characters
|
// Searching
|
||||||
inline string quotemeta() const;
|
|
||||||
|
|
||||||
//- Output some basic info
|
//- Smart match as regular expression or as a string
|
||||||
Ostream& info(Ostream&) const;
|
// Optionally force a literal match only
|
||||||
|
inline bool match
|
||||||
|
(
|
||||||
|
const std::string&,
|
||||||
|
bool literalMatch = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Miscellaneous
|
||||||
|
|
||||||
|
//- Return a string with quoted meta-characters
|
||||||
|
inline string quotemeta() const;
|
||||||
|
|
||||||
|
//- Output some basic info
|
||||||
|
Ostream& info(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|||||||
Reference in New Issue
Block a user