11const int WvRegex::default_cflags = WvRegex::EXTENDED;
12const int WvRegex::default_eflags = 0;
14void WvRegex::seterr(
int errcode)
16 int error_desc_len = ::regerror(errcode, &preg, NULL, 0);
17 if (error_desc_len > 0)
20 error_desc.setsize(error_desc_len);
21 ::regerror(errcode, &preg, error_desc.
edit(), error_desc_len);
22 WvErrorBase::seterr_both(errcode, error_desc);
29 if (have_preg) ::regfree(&preg);
31 int errcode = ::regcomp(&preg, regex, cflags);
37 else have_preg =
true;
44 if (have_preg) ::regfree(&preg);
48 size_t nmatch, regmatch_t pmatch[])
const
50 if (!have_preg)
return false;
52 return ::regexec(&preg,
string, nmatch, pmatch, eflags) == 0;
virtual void seterr(int _errnum)
Set the errnum variable – we have an error.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
static WvString __wvre_null_reg
Internal use only.
bool set(WvStringParm regex, int cflags=default_cflags)
Replace the current regex to match with a new one.
WvString is an implementation of a simple and efficient printable-string class.
char * edit()
make the string editable, and return a non-const (char*)