A wordRe is a Foam::word, but can contain a regular expression for matching words or strings. More...
Public Types | |
enum | compOption { LITERAL = 0, REGEX = 1, ICASE = 2, NOCASE = 2, DETECT = 4, UNKNOWN = 4, REGEX_ICASE = (REGEX|ICASE), DETECT_ICASE = (DETECT|ICASE) } |
Public Member Functions | |
wordRe () | |
wordRe (const wordRe &str) | |
wordRe (wordRe &&str) | |
wordRe (const word &str) | |
wordRe (word &&str) | |
wordRe (const std::string &str, const compOption opt=compOption::LITERAL) | |
wordRe (const char *str, const compOption opt=compOption::LITERAL) | |
wordRe (const keyType &str) | |
wordRe (Istream &is) | |
bool | isLiteral () const noexcept |
bool | isPattern () const noexcept |
bool | assign (const token &tok) |
bool | compile () |
void | uncompile () |
bool | compile (const compOption opt) |
void | uncompile (bool adjust) |
void | set (const std::string &str, const compOption opt=DETECT) |
void | set (const char *str, const compOption opt=DETECT) |
void | clear () |
void | swap (wordRe &str) |
bool | match (const std::string &text, bool literal=false) const |
bool | operator() (const std::string &text) const |
void | operator= (const wordRe &str) |
void | operator= (const word &str) |
void | operator= (const keyType &str) |
void | operator= (const string &str) |
void | operator= (const std::string &str) |
void | operator= (const char *str) |
void | operator= (wordRe &&str) |
![]() | |
word ()=default | |
word (const word &)=default | |
word (word &&w)=default | |
word (const string &s, bool doStrip=true) | |
word (string &&s, bool doStrip=true) | |
word (const std::string &s, bool doStrip=true) | |
word (std::string &&s, bool doStrip=true) | |
word (const char *s, bool doStrip=true) | |
word (const char *s, size_type len, bool doStrip) | |
word (Istream &is) | |
void | stripInvalid () |
word | lessExt () const |
word | ext () const |
word & | ext (const word &ending) |
word & | operator= (const word &s) |
word & | operator= (word &&s) |
word & | operator= (const string &s) |
word & | operator= (string &&s) |
word & | operator= (const std::string &s) |
word & | operator= (std::string &&s) |
word & | operator= (const char *s) |
template<class PrimitiveType > | |
Foam::word | printf (const char *fmt, const PrimitiveType &val) |
template<class PrimitiveType > | |
Foam::word | printf (const std::string &fmt, const PrimitiveType &val) |
bool | hasExt () const |
bool | hasExt (const char *ending) const |
bool | hasExt (const std::string &ending) const |
bool | hasExt (const wordRe &ending) const |
bool | removeExt () |
![]() | |
string ()=default | |
string (const std::string &str) | |
string (std::string &&str) | |
string (const char *str) | |
string (const char *str, const size_type len) | |
string (const char c) | |
string (const size_type len, const char c) | |
string (Istream &is) | |
bool | match (const std::string &text) const |
string & | replace (const std::string &s1, const std::string &s2, size_type pos=0) |
string & | replaceAll (const std::string &s1, const std::string &s2, size_type pos=0) |
string & | replaceAny (const std::string &s1, const char c2, size_type pos=0) |
string & | expand (const bool allowEmpty=false) |
bool | removeRepeated (const char character) |
bool | removeStart (const std::string &text) |
bool | removeStart (const char c) |
bool | removeEnd (const std::string &text) |
bool | removeEnd (const char c) |
void | swap (std::string &str) |
bool | operator() (const std::string &text) const |
bool | starts_with (const std::string &s) const |
bool | starts_with (const char c) const |
bool | ends_with (const std::string &s) const |
bool | ends_with (const char c) const |
size_type | count (const char c) const |
bool | startsWith (const std::string &s) const |
bool | endsWith (const std::string &s) const |
bool | removeTrailing (const char c) |
Static Public Member Functions | |
static bool | valid (const char c) |
![]() | |
template<class PrimitiveType > | |
static word | printf (const char *fmt, const PrimitiveType &val) |
template<class PrimitiveType > | |
static word | printf (const std::string &fmt, const PrimitiveType &val) |
static bool | valid (char c) |
static word | validate (const std::string &s, const bool prefix=false) |
static word | validate (const char *first, const char *last, const bool prefix=false) |
![]() | |
template<class StringType > | |
static bool | valid (const std::string &str) |
template<class StringType > | |
static bool | stripInvalid (std::string &str) |
template<class StringType > | |
static StringType | validate (const std::string &str) |
Static Public Attributes | |
static const wordRe | null |
![]() | |
static const char *const | typeName = "word" |
static int | debug |
static const word | null |
![]() | |
static const char *const | typeName = "string" |
static int | debug |
static const string | null |
Additional Inherited Members | |
![]() | |
std::string::size_type | find_ext () const |
word | ext () const |
bool | ext (const word &ending) |
bool | hasPath () const |
bool | hasExt () const |
bool | hasExt (const char *ending) const |
bool | hasExt (const std::string &ending) const |
bool | hasExt (const wordRe &ending) const |
bool | removeExt () |
bool | removePath () |
![]() | |
static std::string::size_type | find_ext (const std::string &str) |
template<class PrimitiveType > | |
static std::string::size_type | string_printf (std::string &output, const char *fmt, const PrimitiveType &val) |
template<class PrimitiveType > | |
static std::string::size_type | string_printf (std::string &output, const std::string &fmt, const PrimitiveType &val) |
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
By default the constructors will generally preserve the argument as a string literal and the assignment operators will use the wordRe::DETECT compOption to scan the string for regular expression meta characters and/or invalid word characters and react accordingly.
The exceptions are when constructing/assigning from another Foam::wordRe (preserve the same type) or from a Foam::word (always literal).
enum compOption |
Enumerator | |
---|---|
LITERAL | String literal. |
REGEX | Regular expression. |
ICASE | Ignore case in regular expression. |
NOCASE |
|
DETECT | Detect if the string contains meta-characters. |
UNKNOWN | Unknown content (for return value). |
REGEX_ICASE | Combined REGEX and ICASE. |
DETECT_ICASE | Combined DETECT and ICASE. |
Definition at line 40 of file wordReI.H.
References wordRe::compile(), and wordRe::isPattern().
|
inline |
Definition at line 70 of file wordReI.H.
References wordRe::compile(), and wordRe::LITERAL.
|
inline |
Definition at line 81 of file wordReI.H.
References wordRe::compile(), and wordRe::LITERAL.
Definition at line 34 of file wordRe.C.
References wordRe::compile(), and keyType::isPattern().
|
inlinestatic |
Definition at line 24 of file wordReI.H.
References Foam::constant::universal::c, and word::valid().
|
inlinenoexcept |
Definition at line 94 of file wordReI.H.
Referenced by string::hasExt().
|
inlinenoexcept |
Definition at line 100 of file wordReI.H.
Referenced by fieldSelection::containsPattern(), faBoundaryMesh::indices(), polyBoundaryMesh::indices(), Foam::operator<<(), wordRe::operator=(), triSurfaceLoader::select(), and wordRe::wordRe().
Definition at line 53 of file wordRe.C.
References Foam::FieldOps::assign(), wordRe::DETECT, token::isQuotedString(), token::isWord(), token::stringToken(), and token::wordToken().
Referenced by Foam::operator>>().
|
inline |
Definition at line 137 of file wordReI.H.
Referenced by wordRe::wordRe().
|
inline |
Definition at line 106 of file wordReI.H.
References wordRe::DETECT, wordRe::ICASE, regExpPosix::is_meta(), wordRe::LITERAL, and wordRe::REGEX.
|
inline |
Definition at line 149 of file wordReI.H.
References word::debug.
|
inline |
Definition at line 178 of file wordReI.H.
References Foam::FieldOps::assign().
|
inline |
Definition at line 185 of file wordReI.H.
References Foam::FieldOps::assign().
|
inline |
Definition at line 160 of file wordReI.H.
References clear().
Referenced by zoneToCell::zones(), zoneToPoint::zones(), and zoneToFace::zones().
|
inline |
Definition at line 192 of file wordReI.H.
References string::swap().
Definition at line 167 of file wordReI.H.
Referenced by string::hasExt(), polyBoundaryMesh::indices(), and solverFieldSelection::updateSelection().
|
inline |
Definition at line 206 of file wordReI.H.
References Foam::stringOps::match().
|
inline |
Definition at line 212 of file wordReI.H.
References Foam::FieldOps::assign(), and wordRe::isPattern().
|
inline |
Definition at line 231 of file wordReI.H.
References Foam::FieldOps::assign().
void operator= | ( | const keyType & | str | ) |
Definition at line 76 of file wordRe.C.
References Foam::FieldOps::assign(), and keyType::isPattern().
|
inline |
Definition at line 238 of file wordReI.H.
References Foam::FieldOps::assign(), and wordRe::DETECT.
|
inline |
Definition at line 245 of file wordReI.H.
References Foam::FieldOps::assign(), and wordRe::DETECT.
|
inline |
Definition at line 252 of file wordReI.H.
References Foam::FieldOps::assign(), and wordRe::DETECT.
|
inline |
|
static |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.