libabigail
Loading...
Searching...
No Matches
abigail::regex Namespace Reference

Namespace for regex types and functions. More...

Classes

struct  escape
 A class to hold a reference to a string to regex escape. More...
 
struct  regex_t_deleter
 A delete functor for a shared_ptr of regex_t. More...
 

Typedefs

typedef std::shared_ptr< regex_t > regex_t_sptr
 A convenience typedef for a shared pointer of regex_t.
 

Functions

regex_t_sptr compile (const std::string &str)
 Compile a regex from a string.
 
std::string generate_from_strings (const std::vector< std::string > &strs)
 Generate a regex pattern equivalent to testing set membership.
 
bool match (const regex_t_sptr &r, const std::string &str)
 See if a string matches a regex.
 
std::ostream & operator<< (std::ostream &os, const escape &esc)
 Escape regex special charaters in input string.
 

Detailed Description

Namespace for regex types and functions.

Typedef Documentation

◆ regex_t_sptr

typedef std::shared_ptr< regex_t > regex_t_sptr

A convenience typedef for a shared pointer of regex_t.

Definition at line 87 of file abg-fwd.h.

Function Documentation

◆ compile()

regex_t_sptr compile ( const std::string & str)

Compile a regex from a string.

The result is held in a shared pointer. This will be null if regex compilation fails.

Parameters
strthe string representation of the regex.
Returns
shared pointer holder of a compiled regex object.

Definition at line 111 of file abg-regex.cc.

◆ generate_from_strings()

std::string generate_from_strings ( const std::vector< std::string > & strs)

Generate a regex pattern equivalent to testing set membership.

A string will match the resulting pattern regex, if and only if it was present in the vector.

Parameters
strsa vector of strings
Returns
a regex pattern

Definition at line 88 of file abg-regex.cc.

◆ match()

bool match ( const regex_t_sptr & r,
const std::string & str )

See if a string matches a regex.

Parameters
ra shared pointer holder of a compiled regex object.
stra string.
Returns
whether there was a match.

Definition at line 127 of file abg-regex.cc.

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const escape & esc )

Escape regex special charaters in input string.

Parameters
osthe output stream being written to.
escthe regex_escape object holding a reference to the string needing to be escaped.
Returns
the output stream.

Definition at line 64 of file abg-regex.cc.