22 #ifndef _IIPRESPONSE_H 23 #define _IIPRESPONSE_H 26 #define VERSION "0.9.9.9" 30 #if defined _MSC_VER && _MSC_VER<1900 31 #define snprintf _snprintf 48 std::string cacheControl;
52 std::string responseBody;
71 void setLastModified(
const std::string& m ) { modified =
"Last-Modified: " + m; };
95 void addResponse( std::string c,
const std::string& a );
110 void setError(
const std::string& code,
const std::string& arg );
117 cors =
"Access-Control-Allow-Origin: " + c + eof +
118 "Access-Control-Allow-Headers: X-Requested-With";
129 void setCacheControl(
const std::string& c ){ cacheControl =
"Cache-Control: " + c; };
142 if( error.length() || responseBody.length() || protocol.length() )
return true;
149 if( error.length() )
return true;
void setCacheControl(const std::string &c)
Set Cache-Control value.
Definition: IIPResponse.h:129
void setProtocol(const std::string &p)
Set the IIP protocol version.
Definition: IIPResponse.h:66
void setCORS(const std::string &c)
Set CORS setting.
Definition: IIPResponse.h:115
bool errorIsSet()
Indicate whether we have an error message.
Definition: IIPResponse.h:148
void setLastModified(const std::string &m)
Set the Last Modified header.
Definition: IIPResponse.h:71
Class to handle non-image IIP responses including errors.
Definition: IIPResponse.h:40
void setImageSent()
Set the sent flag indicating that some sort of response has been sent.
Definition: IIPResponse.h:155
bool isSet()
Indicate whether this object has had any arguments passed to it.
Definition: IIPResponse.h:141
bool imageSent()
Indicate whether a response has been sent.
Definition: IIPResponse.h:159
std::string formatResponse()
Get a formatted string to send back.
std::string getAdvert()
Display our advertising banner ;-)
void addResponse(const std::string &r)
Add a response string.
void setError(const std::string &code, const std::string &arg)
Set an error.
std::string getCORS()
Get CORS setting.
Definition: IIPResponse.h:124
std::string getCacheControl()
Get Cache-Control value.
Definition: IIPResponse.h:133
IIPResponse()
Constructor.