osgEarth 2.1.1
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | Friends

osgEarth::HTTPResponse Class Reference

List of all members.

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

Detailed Description

An HTTP response object for use with the HTTPClient class - supports multi-part mime responses.

Definition at line 104 of file HTTPClient.


Member Typedef Documentation

typedef std::vector< osg::ref_ptr<Part> > osgEarth::HTTPResponse::Parts [private]

Definition at line 157 of file HTTPClient.


Member Enumeration Documentation

Enumerator:
NONE 
OK 
NOT_FOUND 
SERVER_ERROR 

Definition at line 107 of file HTTPClient.

                  {
            NONE         = 0,
            OK           = 200,
            NOT_FOUND    = 404,
            SERVER_ERROR = 500
        };

Constructor & Destructor Documentation

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
}

Member Function Documentation

long HTTPResponse::getCode ( ) const

Gets the HTTP response code (Code) in this response

Definition at line 203 of file HTTPClient.cpp.

                            {
    return _response_code;
}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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();
}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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];
}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class HTTPClient [friend]

Definition at line 163 of file HTTPClient.


Member Data Documentation

Definition at line 161 of file HTTPClient.

std::string osgEarth::HTTPResponse::_mimeType [private]

Definition at line 160 of file HTTPClient.

Definition at line 158 of file HTTPClient.

Definition at line 159 of file HTTPClient.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines