summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/BRegex.h8
-rw-r--r--includes/HttpServer.h4
-rw-r--r--src/BRegex.cc8
3 files changed, 10 insertions, 10 deletions
diff --git a/includes/BRegex.h b/includes/BRegex.h
index d7957bd..4a2f207 100644
--- a/includes/BRegex.h
+++ b/includes/BRegex.h
@@ -13,16 +13,16 @@ class Regex {
typedef std::vector<String> Captures;
Regex(const char * regex, bool icase = false) throw (GeneralException);
~Regex();
- Captures match(const char * str) throw (GeneralException);
+ Captures match(const char * str) const throw (GeneralException);
private:
- String getError(int err);
+ String getError(int err) const;
regex_t m_regex;
};
class Regexes {
public:
- static Regex any;
- static Regex empty;
+ static const Regex any;
+ static const Regex empty;
};
};
diff --git a/includes/HttpServer.h b/includes/HttpServer.h
index 51c119c..227faa4 100644
--- a/includes/HttpServer.h
+++ b/includes/HttpServer.h
@@ -20,7 +20,7 @@ class HttpServer {
class Action {
public:
- Action(Regex & regex, Regex & host = Regexes::any) : m_regex(regex), m_host(host), m_refCount(0) { }
+ Action(const Regex & regex, const Regex & host = Regexes::any) : m_regex(regex), m_host(host), m_refCount(0) { }
~Action() { Assert(m_refCount == 0); }
typedef std::pair<Regex::Captures, Regex::Captures> ActionMatch;
ActionMatch matches(const char * uri, const char * host);
@@ -29,7 +29,7 @@ class HttpServer {
void registerMe(HttpServer * server) { server->registerAction(this); }
virtual bool Do(HttpServer * server, Http::Request & req, ActionMatch & match, IO<Handle> out) throw (GeneralException) = 0;
private:
- Regex m_regex, m_host;
+ const Regex m_regex, m_host;
volatile int m_refCount;
};
diff --git a/src/BRegex.cc b/src/BRegex.cc
index d3a36f7..c235de6 100644
--- a/src/BRegex.cc
+++ b/src/BRegex.cc
@@ -6,7 +6,7 @@ Balau::Regex::Regex(const char * regex, bool icase) throw (GeneralException) {
throw GeneralException(getError(r));
}
-Balau::Regex::Captures Balau::Regex::match(const char * str) throw (GeneralException) {
+Balau::Regex::Captures Balau::Regex::match(const char * str) const throw (GeneralException) {
Captures ret;
regmatch_t * matches = (regmatch_t *) alloca((m_regex.re_nsub + 1) * sizeof(regmatch_t));
@@ -34,7 +34,7 @@ Balau::Regex::~Regex() {
regfree(&m_regex);
}
-Balau::String Balau::Regex::getError(int err) {
+Balau::String Balau::Regex::getError(int err) const {
size_t s;
char * t;
@@ -47,5 +47,5 @@ Balau::String Balau::Regex::getError(int err) {
return r;
}
-Balau::Regex Balau::Regexes::any(".*");
-Balau::Regex Balau::Regexes::empty("^$");
+Balau::Regex const Balau::Regexes::any(".*");
+Balau::Regex const Balau::Regexes::empty("^$");