00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef restcgi_status_code_e_h
00023 #define restcgi_status_code_e_h
00024 #include "apidefs.h"
00025 #include <string>
00026 #include <iostream>
00027 namespace restcgi {
00035 class RESTCGI_API status_code_e {
00036 public:
00038 enum e {
00039 null,
00040 CONTINUE,
00041 SWITCHING_PROTOCOLS,
00042
00043
00044
00045 OK,
00049 CREATED,
00050 ACCEPTED,
00051 NON_AUTHORITATIVE_INFORMATION,
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 NO_CONTENT,
00072 RESET_CONTENT,
00073 PARTIAL_CONTENT,
00074 MULTIPLE_CHOICES,
00075 MOVED_PERMANENTLY,
00076 FOUND,
00077
00078
00079
00080
00081
00082
00083
00084 SEE_OTHER,
00090 NOT_MODIFIED,
00091 USE_PROXY,
00092 TEMPORARY_REDIRECT,
00093
00094
00095
00096
00097
00098
00099 BAD_REQUEST,
00103 UNAUTHORIZED,
00104 PAYMENT_REQUIRED,
00105 FORBIDDEN,
00106
00107
00108
00109
00110
00111 NOT_FOUND,
00116 METHOD_NOT_ALLOWED,
00117 NOT_ACCEPTABLE,
00118 PROXY_AUTHENTICATION_REQUIRED,
00119 REQUEST_TIME_OUT,
00120
00121
00122
00123
00124
00125
00126
00127 CONFLICT,
00132 GONE,
00133 LENGTH_REQUIRED,
00134
00135
00136
00137 PRECONDITION_FAILED,
00143 REQUEST_ENTITY_TOO_LARGE,
00144 REQUEST_URI_TOO_LARGE,
00145
00146
00147
00148
00149 UNSUPPORTED_MEDIA_TYPE,
00150 REQUESTED_RANGE_NOT_SATISFIABLE,
00151 EXPECTATION_FAILED,
00152
00153
00154
00155 INTERNAL_SERVER_ERROR,
00156 NOT_IMPLEMENTED,
00157 BAD_GATEWAY,
00158 SERVICE_UNAVAILABLE,
00159 GATEWAY_TIME_OUT,
00160 HTTP_VERSION_NOT_SUPPORTED,
00161 };
00162 status_code_e() : e_(null) {}
00163 status_code_e(int code);
00164 status_code_e(e t) : e_(t) {}
00165 e enumeration() const {return e_;}
00166 bool is_null() const {return e_ == null;}
00167
00168 const char* cstring() const {return cstrings_[e_];}
00170 operator int() const {return ints_[e_];}
00171 bool operator ==(const status_code_e& rhs) const {return e_ == rhs.e_;}
00172 bool operator ==(const status_code_e::e& rhs) const {return e_ == rhs;}
00173 bool operator <(const status_code_e& rhs) const {return e_ < rhs.e_;}
00174 bool operator <(const status_code_e::e& rhs) const {return e_ < rhs;}
00175 std::ostream& operator <<(std::ostream& os) const;
00176 static const char EOL_CSTR[3];
00177 private:
00178 e e_;
00179 static const char* cstrings_[];
00180 static const int ints_[];
00181 };
00183 inline std::ostream& operator <<(std::ostream& os, const status_code_e& v) {return v.operator <<(os);}
00184 }
00185 #endif