00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef restcgi_method_e_h
00023 #define restcgi_method_e_h
00024 #include "apidefs.h"
00025 #include <string>
00026 namespace restcgi {
00031 class RESTCGI_API method_e {
00032 public:
00034 enum e {
00035 null,
00036 GET = 1 << 0,
00037 PUT = 1 << 1,
00038 POST = 1 << 2,
00039 DEL = 1 << 3,
00040 OPTIONS = 1 << 4,
00041 HEAD = 1 << 5,
00042 all = (GET | PUT | POST | DEL | OPTIONS | HEAD),
00043 };
00044 method_e() : e_(null) {}
00045 method_e(const e& t) : e_(t) {}
00046 method_e(const std::string& t);
00047 e enumeration() const {return e_;}
00048 bool is_null() const {return e_ == null;}
00049 bool operator ==(const method_e& rhs) const {return e_ == rhs.e_;}
00050 bool operator !=(const method_e& rhs) const {return e_ != rhs.e_;}
00051 bool operator <(const method_e& rhs) const {return (int)e_ < (int)rhs.e_;}
00052 const char* cstring() const;
00053 static std::string mask_to_string(int mask);
00054 private:
00055 e e_;
00056 static const char* names_[];
00057 };
00058 }
00059 #endif