Sirikata
|
URL stores both a url string as well as a Fingerprint to verify it. More...
#include <URL.hpp>
Classes | |
struct | Hasher |
Public Member Functions | |
URL () | |
Default constructor--calls default constructor for URLContext as well. | |
URL (const URLContext &parentContext, const std::string &url) | |
Constructs a new URL based on an old context. | |
URL (const char *url) | |
Constructs an absolute URL. | |
URL (const std::string &url) | |
Constructs an absolute URL. | |
URL (const URI &uri) | |
Constructs an absolute URL from a URI. | |
const URLContext & | context () const |
Gets the corresponding context, from which you can construct another relative URL. | |
URLContext & | getContext () |
Gives a writable reference to a URLContext. | |
const std::string & | proto () const |
Returns the protocol used (== context().proto()) | |
const std::string & | host () const |
Returns the hostname (or empty if there is none, same as context) | |
const std::string | hostname () const |
Returns the hostname (or empty if there is none, same as context) | |
const std::string & | username () const |
Returns the username (or empty if there is none, same as context) | |
const std::string & | basepath () const |
Returns the path without slashes on either end. | |
const std::string & | filename () const |
Returns just the filename withot slashes. | |
void | setFilename (const std::string &file) |
std::string | fullpath () const |
Returns an absolute path that represents this file, including a slash at the beginning, and will include a slash at the end only if filename() returns the empty string. | |
std::string | toString () const |
const accessor for the full string URL Note that URLContext::toString does include the ending slash. | |
bool | operator< (const URL &other) const |
Compare the URL. | |
bool | operator== (const URL &other) const |
Check the URL for equality. | |
bool | operator!= (const URL &other) const |
bool | empty () const |
operator bool () const | |
Private Member Functions | |
void | findSlash (const std::string &url) |
Private Attributes | |
URLContext | mContext |
std::string | mPath |
URL stores both a url string as well as a Fingerprint to verify it.
Sirikata::Transfer::URL::URL | ( | ) | [inline, explicit] |
Default constructor--calls default constructor for URLContext as well.
Sirikata::Transfer::URL::URL | ( | const URLContext & | parentContext, |
const std::string & | url | ||
) | [inline] |
Constructs a new URL based on an old context.
parentContext | A URLContext to base relative paths from-- this may be the default constructor. |
url | A relative or absolute URL. |
References findSlash().
Sirikata::Transfer::URL::URL | ( | const char * | url | ) | [inline, explicit] |
Constructs an absolute URL.
To be used when the securlty implications of relative URLs are not clear.
url | An absolute URL. |
References findSlash().
Sirikata::Transfer::URL::URL | ( | const std::string & | url | ) | [inline, explicit] |
Constructs an absolute URL.
To be used when the securlty implications of relative URLs are not clear.
url | An absolute URL. |
References findSlash().
Sirikata::Transfer::URL::URL | ( | const URI & | uri | ) | [inline, explicit] |
Constructs an absolute URL from a URI.
References findSlash(), and Sirikata::Transfer::URI::toString().
const std::string& Sirikata::Transfer::URL::basepath | ( | ) | const [inline] |
Returns the path without slashes on either end.
References Sirikata::Transfer::URLContext::basepath(), and mContext.
const URLContext& Sirikata::Transfer::URL::context | ( | ) | const [inline] |
Gets the corresponding context, from which you can construct another relative URL.
References mContext.
Referenced by Sirikata::Transfer::MeerkatChunkHandler::cache_check_callback(), Sirikata::AggregateManager::generateAggregateMeshAsync(), Sirikata::AssetDownloadTask::getURL(), Sirikata::Graphics::ManualMaterialLoader::loadResource(), and Sirikata::Graphics::ogreMaterialName().
bool Sirikata::Transfer::URL::empty | ( | ) | const [inline] |
References Sirikata::Transfer::URLContext::empty(), mContext, and mPath.
Referenced by Sirikata::Transfer::MeerkatChunkHandler::cache_check_callback(), Sirikata::AggregateManager::generateAggregateMeshAsync(), Sirikata::AssetDownloadTask::getURL(), Sirikata::Graphics::ManualMaterialLoader::loadResource(), Sirikata::Graphics::ogreMaterialName(), operator bool(), and Sirikata::AggregateManager::uploadAggregateMesh().
const std::string& Sirikata::Transfer::URL::filename | ( | ) | const [inline] |
Returns just the filename withot slashes.
References mPath.
void Sirikata::Transfer::URL::findSlash | ( | const std::string & | url | ) | [inline, private] |
References mContext, mPath, Sirikata::Transfer::URLContext::parse(), and url.
Referenced by URL().
std::string Sirikata::Transfer::URL::fullpath | ( | ) | const [inline] |
Returns an absolute path that represents this file, including a slash at the beginning, and will include a slash at the end only if filename() returns the empty string.
References Sirikata::Transfer::URLContext::basepath(), mContext, and mPath.
Referenced by Sirikata::Transfer::HttpManager::handle_read(), Sirikata::AggregateManager::handleUploadFinished(), and Sirikata::AggregateManager::uploadAggregateMesh().
URLContext& Sirikata::Transfer::URL::getContext | ( | ) | [inline] |
Gives a writable reference to a URLContext.
References mContext.
const std::string& Sirikata::Transfer::URL::host | ( | ) | const [inline] |
Returns the hostname (or empty if there is none, same as context)
References Sirikata::Transfer::URLContext::host(), and mContext.
Referenced by Sirikata::Transfer::MeerkatChunkHandler::cache_check_callback().
const std::string Sirikata::Transfer::URL::hostname | ( | ) | const [inline] |
Returns the hostname (or empty if there is none, same as context)
References Sirikata::Transfer::URLContext::hostname(), and mContext.
Sirikata::Transfer::URL::operator bool | ( | ) | const [inline] |
References empty().
bool Sirikata::Transfer::URL::operator!= | ( | const URL & | other | ) | const [inline] |
bool Sirikata::Transfer::URL::operator< | ( | const URL & | other | ) | const [inline] |
bool Sirikata::Transfer::URL::operator== | ( | const URL & | other | ) | const [inline] |
const std::string& Sirikata::Transfer::URL::proto | ( | ) | const [inline] |
Returns the protocol used (== context().proto())
References mContext, and Sirikata::Transfer::URLContext::proto().
void Sirikata::Transfer::URL::setFilename | ( | const std::string & | file | ) | [inline] |
References mPath.
std::string Sirikata::Transfer::URL::toString | ( | ) | const [inline] |
const accessor for the full string URL Note that URLContext::toString does include the ending slash.
References mContext, mPath, and Sirikata::Transfer::URLContext::toString().
Referenced by Sirikata::Transfer::operator<<().
const std::string& Sirikata::Transfer::URL::username | ( | ) | const [inline] |
Returns the username (or empty if there is none, same as context)
References mContext, and Sirikata::Transfer::URLContext::username().
URLContext Sirikata::Transfer::URL::mContext [private] |
Referenced by basepath(), context(), empty(), findSlash(), fullpath(), getContext(), host(), hostname(), operator<(), operator==(), proto(), toString(), and username().
std::string Sirikata::Transfer::URL::mPath [private] |
Referenced by empty(), filename(), findSlash(), fullpath(), Sirikata::Transfer::URL::Hasher::operator()(), operator<(), operator==(), setFilename(), and toString().