osgEarth 2.1.1
|
Public Types | |
typedef std::map< std::string, std::string > | Parameters |
Public Member Functions | |
HTTPRequest (const std::string &url) | |
HTTPRequest (const HTTPRequest &rhs) | |
void | addParameter (const std::string &name, const std::string &value) |
void | addParameter (const std::string &name, int value) |
void | addParameter (const std::string &name, double value) |
const Parameters & | getParameters () const |
std::string | getURL () const |
Private Attributes | |
Parameters | _parameters |
std::string | _url |
An HTTP request for use with the HTTPClient class.
Definition at line 73 of file HTTPClient.
typedef std::map<std::string,std::string> osgEarth::HTTPRequest::Parameters |
Definition at line 87 of file HTTPClient.
HTTPRequest::HTTPRequest | ( | const std::string & | url | ) |
Constructs a new HTTP request that will acces the specified base URL.
Definition at line 117 of file HTTPClient.cpp.
: _url( url ) { //NOP }
HTTPRequest::HTTPRequest | ( | const HTTPRequest & | rhs | ) |
copy constructor.
Definition at line 123 of file HTTPClient.cpp.
: _parameters( rhs._parameters ), _url( rhs._url ) { //nop }
void HTTPRequest::addParameter | ( | const std::string & | name, |
const std::string & | value | ||
) |
Adds an HTTP parameter to the request query string.
Definition at line 131 of file HTTPClient.cpp.
{ _parameters[name] = value; }
void HTTPRequest::addParameter | ( | const std::string & | name, |
int | value | ||
) |
Definition at line 137 of file HTTPClient.cpp.
{ std::stringstream buf; buf << value; std::string bufStr; bufStr = buf.str(); _parameters[name] = bufStr; }
void HTTPRequest::addParameter | ( | const std::string & | name, |
double | value | ||
) |
Definition at line 147 of file HTTPClient.cpp.
{ std::stringstream buf; buf << value; std::string bufStr; bufStr = buf.str(); _parameters[name] = bufStr; }
const HTTPRequest::Parameters & HTTPRequest::getParameters | ( | ) | const |
Ready-only access to the parameter list (as built with addParameter)
Definition at line 157 of file HTTPClient.cpp.
{ return _parameters; }
std::string HTTPRequest::getURL | ( | ) | const |
Gets a copy of the complete URL (base URL + query string) for this request
Definition at line 163 of file HTTPClient.cpp.
{ if ( _parameters.size() == 0 ) { return _url; } else { std::stringstream buf; buf << _url; for( Parameters::const_iterator i = _parameters.begin(); i != _parameters.end(); i++ ) { buf << ( i == _parameters.begin() && _url.find( "?" ) == std::string::npos? "?" : "&" ); buf << i->first << "=" << i->second; } std::string bufStr; bufStr = buf.str(); return bufStr; } }
Parameters osgEarth::HTTPRequest::_parameters [private] |
Definition at line 96 of file HTTPClient.
std::string osgEarth::HTTPRequest::_url [private] |
Definition at line 97 of file HTTPClient.