From d440c3f50a918a932293ad98bcec96eaa4683222 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 4 Dec 2011 01:19:09 -0800 Subject: Reworked some things in the architecture, mainly exceptions and asserts. -) Removed Assert() -) Added AAssert(), IAssert(), RAssert(), TAssert() and Failure() -) Reworked all asserts in the code, and added meaningful messages to them. -) Changed the way the startup code is generated; BALAU_STARTUP is no longer necessary. --- includes/HttpServer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'includes/HttpServer.h') diff --git a/includes/HttpServer.h b/includes/HttpServer.h index 6c97799..9885d50 100644 --- a/includes/HttpServer.h +++ b/includes/HttpServer.h @@ -21,7 +21,7 @@ class HttpServer { class Action { public: Action(const Regex & regex, const Regex & host = Regexes::any) : m_regex(regex), m_host(host), m_refCount(0) { } - ~Action() { Assert(m_refCount == 0); } + ~Action() { AAssert(m_refCount == 0, "Don't delete an Action directl"); } struct ActionMatch { Regex::Captures uri, host; }; @@ -39,8 +39,8 @@ class HttpServer { ~HttpServer() { if (!m_started) stop(); } void start(); void stop(); - void setPort(int port) { Assert(!m_started); m_port = port; } - void setLocal(const char * local) { Assert(!m_started); m_local = local; } + void setPort(int port) { AAssert(!m_started, "You can't set the HTTP port once the server has started"); m_port = port; } + void setLocal(const char * local) { AAssert(!m_started, "You can't set the HTTP IP once the server has started"); m_local = local; } void registerAction(Action * action); void flushAllActions(); struct ActionFound { -- cgit v1.2.3