/home/greg/src/restcgi-test/src/status_code_e.h

00001 /*
00002 Copyright (c) 2009 zooml.com
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a copy
00005 of this software and associated documentation files (the "Software"), to deal
00006 in the Software without restriction, including without limitation the rights
00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008 copies of the Software, and to permit persons to whom the Software is
00009 furnished to do so, subject to the following conditions:
00010 
00011 The above copyright notice and this permission notice shall be included in
00012 all copies or substantial portions of the Software.
00013 
00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00020 THE SOFTWARE.
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

Generated on Fri May 15 11:27:12 2009 for restcgi by  doxygen 1.4.7