22 #ifndef _IIPRESPONSE_H
23 #define _IIPRESPONSE_H
26 #define VERSION "0.9.9.9"
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 );
115 void setCORS(
const std::string& c ){
if(!c.empty()) cors =
"Access-Control-Allow-Origin: " + c; };
124 void setCacheControl(
const std::string& c ){ cacheControl =
"Cache-Control: " + c; };
137 if( error.length() || responseBody.length() || protocol.length() )
return true;
144 if( error.length() )
return true;
159 std::string
getAdvert(
const std::string& version );
void setCacheControl(const std::string &c)
Set Cache-Control value.
Definition: IIPResponse.h:124
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:143
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:150
bool isSet()
Indicate whether this object has had any arguments passed to it.
Definition: IIPResponse.h:136
bool imageSent()
Indicate whether a response has been sent.
Definition: IIPResponse.h:154
std::string formatResponse()
Get a formatted string to send back.
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 getAdvert(const std::string &version)
Display our advertising banner ;-)
std::string getCORS()
Get CORS setting.
Definition: IIPResponse.h:119
std::string getCacheControl()
Get Cache-Control value.
Definition: IIPResponse.h:128
IIPResponse()
Constructor.