osgEarth 2.1.1
|
Classes | |
struct | Part |
Public Types | |
enum | Code { NONE = 0, OK = 200, NOT_FOUND = 404, SERVER_ERROR = 500 } |
Public Member Functions | |
HTTPResponse (long code=0L) | |
HTTPResponse (const HTTPResponse &rhs) | |
long | getCode () const |
bool | isOK () const |
bool | isCancelled () const |
unsigned int | getNumParts () const |
std::istream & | getPartStream (unsigned int n) const |
std::string | getPartAsString (unsigned int n) const |
unsigned int | getPartSize (unsigned int n) const |
const std::string & | getPartHeader (unsigned int n, const std::string &name) const |
const std::string & | getMimeType () const |
Private Types | |
typedef std::vector < osg::ref_ptr< Part > > | Parts |
Private Attributes | |
Parts | _parts |
long | _response_code |
std::string | _mimeType |
bool | _cancelled |
Friends | |
class | HTTPClient |
An HTTP response object for use with the HTTPClient class - supports multi-part mime responses.
Definition at line 104 of file HTTPClient.
typedef std::vector< osg::ref_ptr<Part> > osgEarth::HTTPResponse::Parts [private] |
Definition at line 157 of file HTTPClient.
Definition at line 107 of file HTTPClient.
{ NONE = 0, OK = 200, NOT_FOUND = 404, SERVER_ERROR = 500 };
HTTPResponse::HTTPResponse | ( | long | code = 0L | ) |
Constructs a response with the specified HTTP response code
Definition at line 186 of file HTTPClient.cpp.
: _response_code( _code ), _cancelled(false) { _parts.reserve(1); }
HTTPResponse::HTTPResponse | ( | const HTTPResponse & | rhs | ) |
Copy constructor
Definition at line 193 of file HTTPClient.cpp.
: _response_code( rhs._response_code ), _parts( rhs._parts ), _mimeType( rhs._mimeType ), _cancelled( rhs._cancelled ) { //nop }
long HTTPResponse::getCode | ( | ) | const |
Gets the HTTP response code (Code) in this response
Definition at line 203 of file HTTPClient.cpp.
{ return _response_code; }
const std::string & HTTPResponse::getMimeType | ( | ) | const |
Gets the master mime-type returned by the request
Definition at line 245 of file HTTPClient.cpp.
{ return _mimeType; }
unsigned int HTTPResponse::getNumParts | ( | ) | const |
Gets the number of parts in a (possibly multipart mime) response
Definition at line 218 of file HTTPClient.cpp.
{ return _parts.size(); }
std::string HTTPResponse::getPartAsString | ( | unsigned int | n | ) | const |
Gets the nth response part as a string
Definition at line 238 of file HTTPClient.cpp.
{ std::string streamStr; streamStr = _parts[n]->_stream.str(); return streamStr; }
const std::string & HTTPResponse::getPartHeader | ( | unsigned int | n, |
const std::string & | name | ||
) | const |
Gets the HTTP header associated with the nth multipart/mime response part
Definition at line 228 of file HTTPClient.cpp.
{ return _parts[n]->_headers[name]; }
unsigned int HTTPResponse::getPartSize | ( | unsigned int | n | ) | const |
Gets the length of the nth response part
Definition at line 223 of file HTTPClient.cpp.
{ return _parts[n]->_size; }
std::istream & HTTPResponse::getPartStream | ( | unsigned int | n | ) | const |
Gets the input stream for the nth part in the response
Definition at line 233 of file HTTPClient.cpp.
{ return _parts[n]->_stream; }
bool HTTPResponse::isCancelled | ( | ) | const |
True if the request associated with this response was cancelled before it completed
Definition at line 213 of file HTTPClient.cpp.
{ return _cancelled; }
bool HTTPResponse::isOK | ( | ) | const |
True is the HTTP response code is OK (200)
Definition at line 208 of file HTTPClient.cpp.
{ return _response_code == 200L && !isCancelled(); }
friend class HTTPClient [friend] |
Definition at line 163 of file HTTPClient.
bool osgEarth::HTTPResponse::_cancelled [private] |
Definition at line 161 of file HTTPClient.
std::string osgEarth::HTTPResponse::_mimeType [private] |
Definition at line 160 of file HTTPClient.
Parts osgEarth::HTTPResponse::_parts [private] |
Definition at line 158 of file HTTPClient.
long osgEarth::HTTPResponse::_response_code [private] |
Definition at line 159 of file HTTPClient.