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

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

#include <utility.h>

Collaboration diagram for regular_expression:
Collaboration graph
[legend]

Public Types

typedef regmatch_t match_range
 

Public Member Functions

 regular_expression ()
 
 ~regular_expression ()
 
 regular_expression (const regular_expression &x)
 
regular_expressionoperator= (const regular_expression &x)
 
 regular_expression (const char *pattern)
 Construct with pattern, throw on error.
 
bool compile (const char *pattern)
 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 full_match (const char *str) const
 Return true if full string matches pattern.
 
bool execute (const char *str, unsigned nmatch, match_range *pmatch) const
 Return true if substring matches pattern, fill match_range array.
 

Private Member Functions

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

Private Attributes

std::string m_pattern
 
std::string m_errmsg
 
regex_t m_regex_buf
 

Detailed Description

Wrapper class for POSIX regex(3) or std::regex Supports copy & assignment and is compatible with STL containers.

Definition at line 221 of file utility.h.

Member Typedef Documentation

◆ match_range

typedef regmatch_t regular_expression::match_range

Definition at line 262 of file utility.h.

Constructor & Destructor Documentation

◆ regular_expression() [1/3]

regular_expression::regular_expression ( )

Definition at line 490 of file utility.cpp.

◆ ~regular_expression()

regular_expression::~regular_expression ( )

Definition at line 495 of file utility.cpp.

◆ regular_expression() [2/3]

regular_expression::regular_expression ( const regular_expression x)

Definition at line 500 of file utility.cpp.

◆ regular_expression() [3/3]

regular_expression::regular_expression ( const char *  pattern)
explicit

Construct with pattern, throw on error.

Definition at line 538 of file utility.cpp.

Member Function Documentation

◆ compile() [1/2]

bool regular_expression::compile ( )
private

Definition at line 556 of file utility.cpp.

◆ compile() [2/2]

bool regular_expression::compile ( const char *  pattern)

Set and compile new pattern, return false on error.

Definition at line 547 of file utility.cpp.

◆ copy_buf()

void regular_expression::copy_buf ( const regular_expression x)
private

Definition at line 525 of file utility.cpp.

◆ empty()

bool regular_expression::empty ( ) const
inline

Definition at line 253 of file utility.h.

◆ execute()

bool regular_expression::execute ( const char *  str,
unsigned  nmatch,
match_range pmatch 
) const

Return true if substring matches pattern, fill match_range array.

Definition at line 604 of file utility.cpp.

◆ free_buf()

void regular_expression::free_buf ( )
private

Definition at line 517 of file utility.cpp.

◆ full_match()

bool regular_expression::full_match ( const char *  str) const

Return true if full string matches pattern.

Definition at line 593 of file utility.cpp.

◆ get_errmsg()

const char * regular_expression::get_errmsg ( ) const
inline

Get error message from last compile().

Definition at line 249 of file utility.h.

◆ get_pattern()

const char * regular_expression::get_pattern ( ) const
inline

Definition at line 245 of file utility.h.

◆ operator=()

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

Definition at line 508 of file utility.cpp.

Member Data Documentation

◆ m_errmsg

std::string regular_expression::m_errmsg
private

Definition at line 270 of file utility.h.

◆ m_pattern

std::string regular_expression::m_pattern
private

Definition at line 269 of file utility.h.

◆ m_regex_buf

regex_t regular_expression::m_regex_buf
private

Definition at line 275 of file utility.h.


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