16#include "abg-internal.h"
19ABG_BEGIN_EXPORT_DECLARATIONS
24ABG_END_EXPORT_DECLARATIONS
68 static const std::string specials =
"^.[]$()|*+?{}\\";
69 const std::string& str = esc.ref;
70 for (std::string::const_iterator i = str.begin(); i != str.end(); ++i)
72 if (specials.find(*i) != std::string::npos)
93 std::ostringstream os;
94 std::vector<std::string>::const_iterator i = strs.begin();
95 os <<
"^(" <<
escape(*i++);
96 while (i != strs.end())
114 if (regcomp(r.get(), str.c_str(), REG_EXTENDED))
129 return !regexec(r.get(), str.c_str(), 0, NULL, 0);
Wrappers around regex types and functions.
Utilities to ease the wrapping of C types into std::shared_ptr.
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.
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.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
regex::regex_t_sptr build_sptr< regex_t >()
Specialization of sptr_utils::build_sptr for regex_t.
shared_ptr< T > build_sptr()
This is to be specialized for the diverse C types that needs wrapping in shared_ptr.
Toplevel namespace for libabigail.
A class to hold a reference to a string to regex escape.