-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.cpp
More file actions
22 lines (18 loc) · 818 Bytes
/
Copy pathcode.cpp
File metadata and controls
22 lines (18 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "code.h"
#include <boost/format.hpp>
#include <boost/assign.hpp>
namespace {
std::string message(Code code, const std::string& text) {
static const boost::format frmt("%1% %2%");
return (boost::format(frmt) % code % text).str();
}
}
std::map<Codes::Code, std::string> Codes::strings_ = boost::assign::map_list_of
(Codes::OK, message(Codes::OK, "OK"))
(Codes::BAD_REQUEST, message(Codes::BAD_REQUEST, "Bad request"))
(Codes::NOT_FOUND, message(Codes::NOT_FOUND, "Not Found"))
(Codes::OVERLOADED, message(Codes::OVERLOADED, "Overloaded"))
(Codes::NOT_ACCEPTABLE, message(Codes::NOT_ACCEPTABLE, "Not Acceptable"))
(Codes::CONFLICT, message(Codes::CONFLICT, "Conflict"))
(Codes::UNAVAILABLE, message(Codes::UNAVAILABLE, "Service unavailable"))
.to_container(strings_);