Scopira 20080306

scopira::tool::url Class Reference

#include <url.h>

List of all members.

Public Member Functions

 url (void)
 url (const std::string &fullurl)
 url (const std::string &hostname, int port)
 url (const std::string &proto, const std::string &hostname, int port, const std::string &filename)
 ~url ()
bool load (scopira::tool::itflow_i &in)
void save (scopira::tool::otflow_i &out) const
void clear_url (void)
bool set_url (const std::string &fullurl)
void set_url (const std::string &hostname, int port)
void set_url (const std::string &proto, const std::string &hostname, int port, const std::string &filename)
const std::string & get_url (void) const
std::string get_proto (void) const
std::string get_hostname (void) const
int get_port (void) const
std::string get_filename (void) const

Protected Attributes

std::string dm_full
 the full url
std::string::size_type dm_proto_begin
 protocol (never empty)
std::string::size_type dm_proto_end
std::string::size_type dm_host_begin
 hostname (may be empty)
std::string::size_type dm_host_end
int dm_port
 port (0 for non explicitly provided)
std::string::size_type dm_file_begin
 filename (after the directory path)
std::string::size_type dm_file_end

Detailed Description

A web-like URL (uniform resource locator) class. This class represents one URL and allows access to its various components.

The components are: protocol://hostname:port/filename port will not include the : (how can it, it's an integer) filename will contain the leading /, however. filename definatly may be empty-string

Author:
Aleksander Demko

Constructor & Destructor Documentation

scopira::tool::url::url ( void  )

Empty url constructor.

Author:
Aleksander Demko
scopira::tool::url::url ( const std::string &  fullurl)

Constructs a url from the given url string. This version is only intended for string literals -- strings where you know the url is of the valid form. If the url may be malformed, use the empty contrustor and use the set_url call.

Author:
Aleksander Demko
scopira::tool::url::url ( const std::string &  hostname,
int  port 
)

Constructs a url for the the host and port. The protocol will be "scopira"

Author:
Aleksander Demko
scopira::tool::url::url ( const std::string &  proto,
const std::string &  hostname,
int  port,
const std::string &  filename 
)

Constructs a url by components.

Author:
Aleksander Demko
scopira::tool::url::~url ( )

Simple Destructor

Author:
Aleksander Demko

Member Function Documentation

void scopira::tool::url::clear_url ( void  )

Clears the url

Author:
Aleksander Demko
std::string scopira::tool::url::get_filename ( void  ) const

Gets the filename segment

Author:
Aleksander Demko
std::string scopira::tool::url::get_hostname ( void  ) const

Gets the hostname segment

Author:
Aleksander Demko
int scopira::tool::url::get_port ( void  ) const [inline]

Gets the port. If the url doesn't have an explicit port specified, then this will be 0.

Author:
Aleksander Demko

References dm_port.

std::string scopira::tool::url::get_proto ( void  ) const

Gets the protocol segment

Author:
Aleksander Demko
const std::string& scopira::tool::url::get_url ( void  ) const [inline]

Gets the full url

Author:
Aleksander Demko

References dm_full.

bool scopira::tool::url::load ( scopira::tool::itflow_i in)

Useful when part of other objects that are serializable.

Author:
Aleksander Demko
void scopira::tool::url::save ( scopira::tool::otflow_i out) const

Useful when part of other objects that are serializable.

Author:
Aleksander Demko
bool scopira::tool::url::set_url ( const std::string &  fullurl)

Sets the url from a full url string. Returns true on successully parse.

Author:
Aleksander Demko
void scopira::tool::url::set_url ( const std::string &  proto,
const std::string &  hostname,
int  port,
const std::string &  filename 
)

Sets the url by components

Author:
Aleksander Demko
void scopira::tool::url::set_url ( const std::string &  hostname,
int  port 
)

Sets the url by host and port. The protocol will be "scopira"

Author:
Aleksander Demko

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