Sirikata
Classes | Public Member Functions | Private Member Functions | Private Attributes
Sirikata::Transfer::URL Class Reference

URL stores both a url string as well as a Fingerprint to verify it. More...

#include <URL.hpp>

Collaboration diagram for Sirikata::Transfer::URL:

List of all members.

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 URLContextcontext () const
 Gets the corresponding context, from which you can construct another relative URL.
URLContextgetContext ()
 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

Detailed Description

URL stores both a url string as well as a Fingerprint to verify it.


Constructor & Destructor Documentation

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.

Parameters:
parentContextA URLContext to base relative paths from-- this may be the default constructor.
urlA 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.

Parameters:
urlAn 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.

Parameters:
urlAn 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().


Member Function Documentation

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]
bool Sirikata::Transfer::URL::empty ( ) const [inline]
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]

Compare the URL.

References mContext, and mPath.

bool Sirikata::Transfer::URL::operator== ( const URL other) const [inline]

Check the URL for equality.

References mContext, and mPath.

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().


Member Data Documentation

std::string Sirikata::Transfer::URL::mPath [private]

The documentation for this class was generated from the following file: