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

Wrapper class for regex(3). Supports copy & assignment and is compatible with STL containers. More...

#include <utility.h>

Collaboration diagram for regular_expression:
Collaboration graph
[legend]

List of all members.

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.
const char * get_pattern () const
const char * get_errmsg () const
 Get error message from last compile().
bool empty () const
bool match (const char *str, int flags=0) const
 Return true if substring matches pattern.
bool full_match (const char *str, int flags=0) const
 Return true if full string matches pattern.
bool execute (const char *str, unsigned nmatch, regmatch_t *pmatch, int flags=0) const
 Return true if substring matches pattern, fill regmatch_t array.

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 275 of file utility.h.


Constructor & Destructor Documentation

regular_expression::regular_expression ( )

Definition at line 424 of file utility.cpp.

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

Definition at line 430 of file utility.cpp.

regular_expression::~regular_expression ( )

Definition at line 440 of file utility.cpp.

regular_expression::regular_expression ( const regular_expression x)

Definition at line 445 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 481 of file utility.cpp.

bool regular_expression::compile ( ) [private]

Definition at line 489 of file utility.cpp.

void regular_expression::copy ( const regular_expression x) [private]

Definition at line 466 of file utility.cpp.

bool regular_expression::empty ( ) const [inline]

Definition at line 302 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 318 of file utility.h.

void regular_expression::free_buf ( ) [private]

Definition at line 458 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 310 of file utility.h.

const char* regular_expression::get_errmsg ( ) const [inline]

Get error message from last compile().

Definition at line 298 of file utility.h.

const char* regular_expression::get_pattern ( ) const [inline]

Definition at line 294 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 306 of file utility.h.

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

Definition at line 451 of file utility.cpp.


Member Data Documentation

std::string regular_expression::m_errmsg [private]

Definition at line 325 of file utility.h.

Definition at line 323 of file utility.h.

std::string regular_expression::m_pattern [private]

Definition at line 322 of file utility.h.

Definition at line 324 of file utility.h.


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