smartmontools  SVN Rev 4115
Utility to control and monitor storage systems with "S.M.A.R.T."
Public Member Functions | Private Member Functions | Private Attributes | List of all members
regular_expression Class Reference

Wrapper class for regex(3). More...

#include <utility.h>

Collaboration diagram for regular_expression:
Collaboration graph
[legend]

Public Member Functions

 regular_expression ()
 
 regular_expression (const char *pattern, int flags, bool throw_on_error=true)
 
 ~regular_expression ()
 
 regular_expression (const regular_expression &x)
 
regular_expressionoperator= (const regular_expression &x)
 
bool compile (const char *pattern, int flags)
 Set and compile new pattern, return false on error. More...
 
const char * get_pattern () const
 
const char * get_errmsg () const
 Get error message from last compile(). More...
 
bool empty () const
 
bool match (const char *str, int flags=0) const
 Return true if substring matches pattern. More...
 
bool full_match (const char *str, int flags=0) const
 Return true if full string matches pattern. More...
 
bool execute (const char *str, unsigned nmatch, regmatch_t *pmatch, int flags=0) const
 Return true if substring matches pattern, fill regmatch_t array. More...
 

Private Member Functions

void free_buf ()
 
void copy (const regular_expression &x)
 
bool compile ()
 

Private Attributes

std::string m_pattern
 
int m_flags
 
regex_t m_regex_buf
 
std::string m_errmsg
 

Detailed Description

Wrapper class for regex(3).

Supports copy & assignment and is compatible with STL containers.

Definition at line 235 of file utility.h.

Constructor & Destructor Documentation

regular_expression::regular_expression ( )

Definition at line 427 of file utility.cpp.

regular_expression::regular_expression ( const char *  pattern,
int  flags,
bool  throw_on_error = true 
)

Definition at line 433 of file utility.cpp.

regular_expression::~regular_expression ( )

Definition at line 443 of file utility.cpp.

regular_expression::regular_expression ( const regular_expression x)

Definition at line 448 of file utility.cpp.

Member Function Documentation

bool regular_expression::compile ( const char *  pattern,
int  flags 
)

Set and compile new pattern, return false on error.

Definition at line 484 of file utility.cpp.

bool regular_expression::compile ( )
private

Definition at line 492 of file utility.cpp.

void regular_expression::copy ( const regular_expression x)
private

Definition at line 469 of file utility.cpp.

bool regular_expression::empty ( ) const
inline

Definition at line 262 of file utility.h.

bool regular_expression::execute ( const char *  str,
unsigned  nmatch,
regmatch_t *  pmatch,
int  flags = 0 
) const
inline

Return true if substring matches pattern, fill regmatch_t array.

Definition at line 278 of file utility.h.

void regular_expression::free_buf ( )
private

Definition at line 461 of file utility.cpp.

bool regular_expression::full_match ( const char *  str,
int  flags = 0 
) const
inline

Return true if full string matches pattern.

Definition at line 270 of file utility.h.

const char* regular_expression::get_errmsg ( ) const
inline

Get error message from last compile().

Definition at line 258 of file utility.h.

const char* regular_expression::get_pattern ( ) const
inline

Definition at line 254 of file utility.h.

bool regular_expression::match ( const char *  str,
int  flags = 0 
) const
inline

Return true if substring matches pattern.

Definition at line 266 of file utility.h.

regular_expression & regular_expression::operator= ( const regular_expression x)

Definition at line 454 of file utility.cpp.

Member Data Documentation

std::string regular_expression::m_errmsg
private

Definition at line 285 of file utility.h.

int regular_expression::m_flags
private

Definition at line 283 of file utility.h.

std::string regular_expression::m_pattern
private

Definition at line 282 of file utility.h.

regex_t regular_expression::m_regex_buf
private

Definition at line 284 of file utility.h.


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