supply a default constructor

This commit is contained in:
Glenn Maynard
2003-03-27 20:16:17 +00:00
parent 4c599babac
commit 2303e8cd3e
2 changed files with 11 additions and 4 deletions
+9 -3
View File
@@ -667,17 +667,23 @@ void Regex::Compile()
ASSERT(backrefs+1 < 128); ASSERT(backrefs+1 < 128);
} }
void Regex::Set(const CString &str)
{
Release();
pattern=str;
Compile();
}
void Regex::Release() void Regex::Release()
{ {
delete (regex_t *)reg; delete (regex_t *)reg;
reg = NULL; reg = NULL;
} }
Regex::Regex(const CString &pattern_) Regex::Regex(const CString &str)
{ {
reg = NULL; reg = NULL;
pattern=pattern_; Set(str);
Compile();
} }
Regex::Regex(const Regex &rhs) Regex::Regex(const Regex &rhs)
+2 -1
View File
@@ -207,9 +207,10 @@ class Regex {
void Compile(); void Compile();
void Release(); void Release();
public: public:
Regex(const CString &pat); Regex(const CString &pat = "");
Regex(const Regex &rhs); Regex(const Regex &rhs);
~Regex(); ~Regex();
void Set(const CString &str);
bool Compare(const CString &str); bool Compare(const CString &str);
bool Compare(const CString &str, vector<CString> &matches); bool Compare(const CString &str, vector<CString> &matches);
}; };