libzypp  17.25.1
zypp::str::regex Class Reference

Regular expression. More...

#include <Regex.h>

Public Types

enum  RegFlags { icase = REG_ICASE, nosubs = REG_NOSUB, match_extended = REG_EXTENDED, newline = REG_NEWLINE }
 
enum  MatchFlags { none = 0, not_bol = REG_NOTBOL }
 

Public Member Functions

 regex ()
 
 regex (const std::string &s, int flags=match_extended)
 
 ~regex () throw ()
 
 regex (const regex &rhs)
 
regexoperator= (const regex &rhs)
 
std::string asString () const
 string representation of the regular expression More...
 
bool matches (const char *s, str::smatch &matches, int flags=none) const
 
bool matches (const char *s) const
 
regex_t * get ()
 Expert backdoor. More...
 

Private Member Functions

void assign (const std::string &s, int flags=match_extended)
 

Private Attributes

std::string m_str
 
int m_flags
 
regex_t m_preg
 
bool m_valid
 

Friends

class smatch
 

Related Functions

(Note that these are not member functions.)

bool regex_match (const char *s, smatch &matches, const regex &regex)
 Regular expression matching. More...
 
std::ostream & operator<< (std::ostream &str, const regex &obj)
 

Detailed Description

Regular expression.

Definition at line 94 of file Regex.h.

Member Enumeration Documentation

◆ RegFlags

Enumerator
icase 

Do not differentiate case.

nosubs 

Support for substring addressing of matches is not required.

match_extended 

Use POSIX Extended Regular Expression syntax when interpreting regex.

newline 

Match newline.

Definition at line 98 of file Regex.h.

◆ MatchFlags

Enumerator
none 
not_bol 

Do not match begin of line.

Definition at line 105 of file Regex.h.

Constructor & Destructor Documentation

◆ regex() [1/3]

regex::regex ( )

Definition at line 22 of file Regex.cc.

◆ regex() [2/3]

regex::regex ( const std::string &  s,
int  flags = match_extended 
)

Definition at line 49 of file Regex.cc.

◆ ~regex()

regex::~regex ( )
throw (
)

Definition at line 54 of file Regex.cc.

◆ regex() [3/3]

zypp::str::regex::regex ( const regex rhs)
inline

Definition at line 114 of file Regex.h.

Member Function Documentation

◆ operator=()

regex& zypp::str::regex::operator= ( const regex rhs)
inline

Definition at line 117 of file Regex.h.

◆ asString()

std::string zypp::str::regex::asString ( ) const
inline

string representation of the regular expression

Definition at line 123 of file Regex.h.

◆ matches() [1/2]

bool regex::matches ( const char *  s,
str::smatch matches,
int  flags = none 
) const

Definition at line 60 of file Regex.cc.

◆ matches() [2/2]

bool regex::matches ( const char *  s) const

Definition at line 72 of file Regex.cc.

◆ get()

regex_t* zypp::str::regex::get ( )
inline

Expert backdoor.

Returns pointer to the compiled regex for direct use in regexec()

Definition at line 131 of file Regex.h.

◆ assign()

void regex::assign ( const std::string &  s,
int  flags = match_extended 
)
private

Definition at line 29 of file Regex.cc.

Friends And Related Function Documentation

◆ smatch

friend class smatch
friend

Definition at line 138 of file Regex.h.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  str,
const regex obj 
)
related

Stream output

Definition at line 146 of file Regex.h.

Member Data Documentation

◆ m_str

std::string zypp::str::regex::m_str
private

Definition at line 139 of file Regex.h.

◆ m_flags

int zypp::str::regex::m_flags
private

Definition at line 140 of file Regex.h.

◆ m_preg

regex_t zypp::str::regex::m_preg
private

Definition at line 141 of file Regex.h.

◆ m_valid

bool zypp::str::regex::m_valid
private

Definition at line 142 of file Regex.h.


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