summaryrefslogtreecommitdiff
path: root/includes/BRegex.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2013-01-22 00:32:13 -0800
committerPixel <pixel@nobis-crew.org>2013-01-22 00:32:13 -0800
commit107d87dc983f34e4ff23a4db188baa650ac51f98 (patch)
tree9721dc97d9c2777ab35c3d22909a8fc8e5df92eb /includes/BRegex.h
parent6f280f3680e9fad24e00dd63a55577c5409945b3 (diff)
Cleaning up some cruft.
Diffstat (limited to 'includes/BRegex.h')
-rw-r--r--includes/BRegex.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/includes/BRegex.h b/includes/BRegex.h
index 4a2f207..9b030bc 100644
--- a/includes/BRegex.h
+++ b/includes/BRegex.h
@@ -11,12 +11,18 @@ namespace Balau {
class Regex {
public:
typedef std::vector<String> Captures;
+ Regex(const String & regex, bool icase = false) : Regex(regex.to_charp(), icase) { }
+ Regex(const Regex & regex) : Regex(regex.m_regexStr, regex.m_icase) { }
+ Regex(Regex && regex) { regex.m_moved = true; m_regex = regex.m_regex; }
Regex(const char * regex, bool icase = false) throw (GeneralException);
- ~Regex();
+ ~Regex() { if (!m_moved) regfree(&m_regex); }
Captures match(const char * str) const throw (GeneralException);
private:
+ Regex & operator=(const Regex &) = delete;
String getError(int err) const;
+ String m_regexStr;
regex_t m_regex;
+ bool m_icase, m_moved = false;
};
class Regexes {