-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.h
33 lines (25 loc) · 888 Bytes
/
request.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef SSERVER_REQUEST_H_INCLUDED
#define SSERVER_REQUEST_H_INCLUDED
#include <boost/function.hpp>
#include <string>
#include <map>
#include <set>
bool validate_username(const std::string& username);
bool validate_email(const std::string& email);
class Request {
typedef std::map<std::string, std::string> Query;
typedef std::map<std::string, std::set<Query::mapped_type> > Methods;
typedef std::map<std::string, boost::function<bool (const Query::mapped_type&)> > Validate;
public:
explicit Request(const std::string& data);
const std::string& method() const { return method_; }
const Query::mapped_type& query(const Query::key_type& name) const {
return query_.at(name);
}
private:
std::string method_;
Query query_;
static const Methods methods_;
static const Validate validate_;
};
#endif // SSERVER_REQUEST_H_INCLUDED