IIPResponse.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _IIPRESPONSE_H
00023 #define _IIPRESPONSE_H
00024
00025 #ifndef VERSION
00026 #define VERSION "0.9.9.9"
00027 #endif
00028
00029
00030 #include <string>
00031
00032
00034
00035 class IIPResponse{
00036
00037
00038 private:
00039
00040 std::string server;
00041 std::string modified;
00042 std::string cache;
00043 std::string mimeType;
00044 std::string eof;
00045 std::string protocol;
00046 std::string responseBody;
00047 std::string error;
00048 bool sent;
00049
00050
00051 public:
00052
00054 IIPResponse();
00055
00056
00058
00059 void setProtocol( const std::string& p ) { protocol = p; };
00060
00061
00063
00064 void setLastModified( const std::string& m ) { modified = "Last-Modified: " + m; };
00065
00066
00068
00069 void addResponse( const std::string& r );
00070
00071
00073
00074 void addResponse( const char* c );
00075
00076
00078
00081 void addResponse( const char* c, int a );
00082
00083
00085
00088 void addResponse( std::string c, const char* a );
00089
00090
00092
00096 void addResponse( const char* c, int a, int b );
00097
00098
00100
00103 void setError( const std::string& code, const std::string& arg );
00104
00105
00107 std::string formatResponse();
00108
00109
00111 bool isSet(){
00112 if( error.length() || responseBody.length() || protocol.length() ) return true;
00113 else return false;
00114 }
00115
00116
00118 bool errorIsSet(){
00119 if( error.length() ) return true;
00120 else return false;
00121 }
00122
00123
00125 void setImageSent() { sent = true; };
00126
00127
00129 bool imageSent() { return sent; };
00130
00131
00133
00134 std::string getAdvert( const std::string& version );
00135
00136
00137 };
00138
00139
00140 #endif