Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
regExpCxx Class Reference

Wrapper around C++11 regular expressions with some additional prefix-handling. The prefix-handling is loosely oriented on PCRE regular expressions and provides a simple means of tuning the expressions. More...

Classes

struct  meta
 

Public Types

typedef std::smatch results_type
 

Public Member Functions

 regExpCxx ()
 
 regExpCxx (const regExpCxx &rgx)
 
 regExpCxx (regExpCxx &&rgx) noexcept
 
 regExpCxx (const char *pattern, const bool ignoreCase=false)
 
 regExpCxx (const std::string &pattern, const bool ignoreCase=false)
 
 ~regExpCxx ()=default
 
bool empty () const noexcept
 
bool exists () const noexcept
 
bool negated () const noexcept
 
bool negate (bool on) noexcept
 
unsigned ngroups () const
 
bool nocase () const
 
bool clear ()
 
void swap (regExpCxx &rgx)
 
bool set (const char *pattern, bool ignoreCase=false)
 
bool set (const std::string &pattern, bool ignoreCase=false)
 
std::string::size_type find (const std::string &text) const
 
bool match (const std::string &text) const
 
bool match (const std::string &text, results_type &matches) const
 
bool search (const std::string &text) const
 
bool operator() (const std::string &text) const
 
void operator= (const regExpCxx &rgx)
 
void operator= (regExpCxx &&rgx)
 
void operator= (const char *pattern)
 
void operator= (const std::string &pattern)
 

Static Public Member Functions

static bool is_meta (const char c) noexcept
 
static bool is_meta (const std::string &str, const char quote='\\')
 

Static Public Attributes

static int grammar
 

Detailed Description

Wrapper around C++11 regular expressions with some additional prefix-handling. The prefix-handling is loosely oriented on PCRE regular expressions and provides a simple means of tuning the expressions.

The prefixes are detected as (?...) at the beginning of the regular expression. Any unknown/unsupported prefixes are silently ignored.

Note
Uses either POSIX extended regular expressions or modified ECMAScript regular expression grammar

Since ECMAScript grammar may not work correctly on all installations, the current default is to use extended regular expressions.

The C++11 regular expressions may be broken on some compilers. For example, gcc 4.8 is known to fail. For these systems the POSIX implementation or alternative must be used.

Warning
This class should not be used directly. Use the Foam::regExp typedef instead.
Source files

Definition at line 78 of file regExpCxx.H.

Member Typedef Documentation

◆ results_type

typedef std::smatch results_type

Definition at line 110 of file regExpCxx.H.

Constructor & Destructor Documentation

◆ regExpCxx() [1/5]

regExpCxx ( )
inline

Definition at line 75 of file regExpCxxI.H.

◆ regExpCxx() [2/5]

regExpCxx ( const regExpCxx rgx)
inline

Definition at line 82 of file regExpCxxI.H.

◆ regExpCxx() [3/5]

regExpCxx ( regExpCxx &&  rgx)
inlinenoexcept

Definition at line 89 of file regExpCxxI.H.

◆ regExpCxx() [4/5]

regExpCxx ( const char *  pattern,
const bool  ignoreCase = false 
)
inlineexplicit

Definition at line 99 of file regExpCxxI.H.

References Foam::BitOps::set().

Here is the call graph for this function:

◆ regExpCxx() [5/5]

regExpCxx ( const std::string &  pattern,
const bool  ignoreCase = false 
)
inlineexplicit

Definition at line 112 of file regExpCxxI.H.

References Foam::BitOps::set().

Here is the call graph for this function:

◆ ~regExpCxx()

~regExpCxx ( )
default

Member Function Documentation

◆ is_meta() [1/2]

bool is_meta ( const char  c)
inlinestaticnoexcept

Definition at line 35 of file regExpCxxI.H.

References Foam::constant::universal::c.

Referenced by regExpPosix::is_meta(), and regExpCxx::meta::operator()().

Here is the caller graph for this function:

◆ is_meta() [2/2]

bool is_meta ( const std::string &  str,
const char  quote = '\\' 
)
inlinestatic

Definition at line 48 of file regExpCxxI.H.

References Foam::constant::universal::c.

◆ empty()

bool empty ( ) const
inlinenoexcept

Definition at line 126 of file regExpCxxI.H.

◆ exists()

bool exists ( ) const
inlinenoexcept

Definition at line 132 of file regExpCxxI.H.

◆ negated()

bool negated ( ) const
inlinenoexcept

Definition at line 138 of file regExpCxxI.H.

◆ negate()

bool negate ( bool  on)
inlinenoexcept

Definition at line 144 of file regExpCxxI.H.

◆ ngroups()

unsigned ngroups ( ) const
inline

Definition at line 164 of file regExpCxxI.H.

◆ nocase()

bool nocase ( ) const
inline

Definition at line 171 of file regExpCxxI.H.

◆ clear()

bool clear ( )
inline

Definition at line 177 of file regExpCxxI.H.

◆ swap()

void swap ( regExpCxx rgx)
inline

Definition at line 191 of file regExpCxxI.H.

◆ set() [1/2]

bool set ( const char *  pattern,
bool  ignoreCase = false 
)
inline

Definition at line 202 of file regExpCxxI.H.

◆ set() [2/2]

bool set ( const std::string &  pattern,
bool  ignoreCase = false 
)
inline

Definition at line 214 of file regExpCxxI.H.

◆ find()

std::string::size_type find ( const std::string &  text) const
inline

Definition at line 226 of file regExpCxxI.H.

◆ match() [1/2]

bool match ( const std::string &  text) const
inline

Definition at line 282 of file regExpCxxI.H.

◆ match() [2/2]

bool match ( const std::string &  text,
results_type matches 
) const
inline

Definition at line 297 of file regExpCxxI.H.

References Foam::stringOps::match().

Here is the call graph for this function:

◆ search()

bool search ( const std::string &  text) const
inline

Definition at line 268 of file regExpCxxI.H.

◆ operator()()

bool operator() ( const std::string &  text) const
inline

Definition at line 315 of file regExpCxxI.H.

References Foam::stringOps::match().

Here is the call graph for this function:

◆ operator=() [1/4]

void operator= ( const regExpCxx rgx)
inline

Definition at line 321 of file regExpCxxI.H.

◆ operator=() [2/4]

void operator= ( regExpCxx &&  rgx)
inline

Definition at line 332 of file regExpCxxI.H.

References clear().

Here is the call graph for this function:

◆ operator=() [3/4]

void operator= ( const char *  pattern)
inline

Definition at line 343 of file regExpCxxI.H.

References Foam::BitOps::set().

Here is the call graph for this function:

◆ operator=() [4/4]

void operator= ( const std::string &  pattern)
inline

Definition at line 349 of file regExpCxxI.H.

References Foam::BitOps::set().

Here is the call graph for this function:

Member Data Documentation

◆ grammar

int grammar
static

Definition at line 116 of file regExpCxx.H.


The documentation for this class was generated from the following files: