diff options
-rw-r--r-- | icespider/core/core.cpp | 7 | ||||
-rw-r--r-- | icespider/core/core.h | 18 | ||||
-rw-r--r-- | icespider/core/exceptions.cpp | 10 | ||||
-rw-r--r-- | icespider/core/exceptions.h | 27 | ||||
-rw-r--r-- | icespider/core/ihttpRequest.cpp | 2 | ||||
-rw-r--r-- | icespider/unittests/testApp.cpp | 1 |
6 files changed, 40 insertions, 25 deletions
diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index 096b367..fc50bd1 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -1,16 +1,11 @@ #include "core.h" +#include "exceptions.h" #include <Ice/Initialize.h> #include <boost/filesystem/convenience.hpp> namespace IceSpider { const boost::filesystem::path Core::defaultConfig("config/ice.properties"); - DefineHttpEx(Http400_BadRequest, 400, "Bad Request"); - DefineHttpEx(Http404_NotFound, 404, "Not found"); - DefineHttpEx(Http405_MethodNotAllowed, 405, "Method Not Allowed"); - DefineHttpEx(Http406_NotAcceptable, 406, "Not Acceptable"); - DefineHttpEx(Http415_UnsupportedMediaType, 415, "Unsupported Media Type"); - static bool operator/=(const PathElements & pathparts, const IRouteHandler * r) diff --git a/icespider/core/core.h b/icespider/core/core.h index c7c762f..77d338e 100644 --- a/icespider/core/core.h +++ b/icespider/core/core.h @@ -7,25 +7,7 @@ #include <Ice/Communicator.h> #include <boost/filesystem/path.hpp> -#define DeclareHttpEx(Name) \ - class Name : public ::IceSpider::HttpException { \ - public: \ - Name(); \ - static const int code; \ - static const std::string message; \ - } -#define DefineHttpEx(Name, Code, Message) \ - Name::Name() : ::IceSpider::HttpException(code, message) { } \ - const int Name::code(Code); \ - const std::string Name::message(Message); - namespace IceSpider { - DeclareHttpEx(Http400_BadRequest); - DeclareHttpEx(Http404_NotFound); - DeclareHttpEx(Http405_MethodNotAllowed); - DeclareHttpEx(Http406_NotAcceptable); - DeclareHttpEx(Http415_UnsupportedMediaType); - class DLL_PUBLIC Core { public: typedef std::vector<const IRouteHandler *> LengthRoutes; diff --git a/icespider/core/exceptions.cpp b/icespider/core/exceptions.cpp new file mode 100644 index 0000000..d249fcc --- /dev/null +++ b/icespider/core/exceptions.cpp @@ -0,0 +1,10 @@ +#include "exceptions.h" + +namespace IceSpider { + DefineHttpEx(Http400_BadRequest, 400, "Bad Request"); + DefineHttpEx(Http404_NotFound, 404, "Not found"); + DefineHttpEx(Http405_MethodNotAllowed, 405, "Method Not Allowed"); + DefineHttpEx(Http406_NotAcceptable, 406, "Not Acceptable"); + DefineHttpEx(Http415_UnsupportedMediaType, 415, "Unsupported Media Type"); +} + diff --git a/icespider/core/exceptions.h b/icespider/core/exceptions.h new file mode 100644 index 0000000..71e6e71 --- /dev/null +++ b/icespider/core/exceptions.h @@ -0,0 +1,27 @@ +#ifndef ICESPIDER_EXCEPTIONS_H +#define ICESPIDER_EXCEPTIONS_H + +#include "http.h" + +#define DeclareHttpEx(Name) \ + class Name : public ::IceSpider::HttpException { \ + public: \ + Name(); \ + static const int code; \ + static const std::string message; \ + } +#define DefineHttpEx(Name, Code, Message) \ + Name::Name() : ::IceSpider::HttpException(code, message) { } \ + const int Name::code(Code); \ + const std::string Name::message(Message); + +namespace IceSpider { + DeclareHttpEx(Http400_BadRequest); + DeclareHttpEx(Http404_NotFound); + DeclareHttpEx(Http405_MethodNotAllowed); + DeclareHttpEx(Http406_NotAcceptable); + DeclareHttpEx(Http415_UnsupportedMediaType); +} + +#endif + diff --git a/icespider/core/ihttpRequest.cpp b/icespider/core/ihttpRequest.cpp index a49df42..d9abecd 100644 --- a/icespider/core/ihttpRequest.cpp +++ b/icespider/core/ihttpRequest.cpp @@ -1,7 +1,7 @@ #include "ihttpRequest.h" #include "irouteHandler.h" #include "util.h" -#include "core.h" +#include "exceptions.h" #include <boost/lexical_cast.hpp> namespace IceSpider { diff --git a/icespider/unittests/testApp.cpp b/icespider/unittests/testApp.cpp index 087d95d..80cecda 100644 --- a/icespider/unittests/testApp.cpp +++ b/icespider/unittests/testApp.cpp @@ -4,6 +4,7 @@ #include <safeMapFind.h> #include <irouteHandler.h> #include <core.h> +#include <exceptions.h> #include <test-api.h> #include <Ice/ObjectAdapter.h> #include <boost/algorithm/string/split.hpp> |