StreamBase C++ API
10.6.2.5
|
A URI for a StreamBase client connection. More...
#include <StreamBaseURI.hpp>
Public Types | |
typedef std::map< std::string, std::string > | ParamMap |
Public Member Functions | |
StreamBaseURI () | |
Default-constructed object; no operations are allowed. More... | |
StreamBaseURI (const std::string &uri) | |
Parse URI from a string. More... | |
StreamBaseURI (const std::string &host, unsigned int port, const std::string &user="", const std::string &password="") | |
Create explicitly from host/port. More... | |
StreamBaseURI (const std::string &host, const std::string &container, unsigned int port, const std::string &user="", const std::string &password="") | |
Create explicitly from host/port with container. More... | |
StreamBaseURI (const std::string &host, unsigned int port, const ParamMap ¶mMap) | |
Create explicitly from host/port, including a map of parameters. More... | |
StreamBaseURI (const std::string &host, const std::string &container, unsigned int port, const ParamMap ¶mMap) | |
Create explicitly from host/port with container, including a map of parameters. More... | |
std::string | as_string () const |
Return the URI as a string. More... | |
std::string | getHost () const |
Return the host component of the URI. More... | |
std::string | getContainer () const |
Returns the container name component of the URI. More... | |
unsigned int | getPort () const |
Return the port component of the URI. More... | |
std::string | getUser () const |
Return the user name component of the URI. More... | |
std::string | getPassword () const |
Return the password component of the URI. More... | |
std::string | getParameter (const std::string &key) const |
Return a parameter, or empty string if undefined. More... | |
std::string | getParam (const std::string &key) const |
Return a parameter, or empty string if undefined. More... | |
bool | getParameter (const std::string &key, std::string &value) const |
Return a parameter into value (returning true if one was found). More... | |
void | addParameter (const std::string &key, const std::string &value) |
Add a parameter. More... | |
void | removeParameter (std::string key) |
Add a parameter. More... | |
size_t | getNumParameters () |
return the number of parameters More... | |
operator const void * () const | |
Returns true if this object was not default-constructed. More... | |
const StreamBaseURI | getBaseURI () const |
return a StreamBaseURI without Parameters More... | |
Static Public Member Functions | |
static std::vector< StreamBaseURI > | vectorFromString (const std::string &uris) |
Return a StreamBaseURI vector from a string of comma sepearted URIs. More... | |
static std::string | as_string (const std::vector< StreamBaseURI > &uris) |
Return a string representation of a list of uris. More... | |
static StreamBaseURI | fromEnvironment () |
Create from the environment variable. More... | |
static std::vector< StreamBaseURI > | vectorFromEnvironment () |
Create from the environment variable and return a vector of StreamBaseURIs. More... | |
Static Public Attributes | |
static const unsigned int | DEFAULT_PORT = 10000 |
The default StreamBase port (10000). More... | |
static std::string const | DEFAULT_HOST |
The default container name. More... | |
static const char *const | USER_PARAM |
URI parameter used for username. More... | |
static const char *const | USERNAME_PARAM |
URI parameter used for username. More... | |
static const char *const | PASSWORD_PARAM |
URI parameter used for password. More... | |
static std::string const | DEFAULT_CONTAINER |
The default container name. More... | |
static std::string const | SYSTEM_CONTAINER |
The system container name. More... | |
static std::string const | NO_CONTAINER |
No container specification. More... | |
static const StreamBaseURI | DEFAULT |
The default URI (pointing to localhost, port 10000, default container). More... | |
static StreamBaseURI const | DEFAULT_URI |
The default URI. More... | |
A URI for a StreamBase client connection.
These URIs are of the form
/// sb://hostname:port/;param1=val1;param2=val2 ///
e.g.,
/// sb://somehost.mycompany.com:10000/;user=me;password=foobar ///
Parameters are optional. The port number is optional; it defaults to 10000.
|
inline |
Default-constructed object; no operations are allowed.
sb::StreamBaseURI::StreamBaseURI | ( | const std::string & | uri | ) |
Parse URI from a string.
sb::StreamBaseURI::StreamBaseURI | ( | const std::string & | host, |
unsigned int | port, | ||
const std::string & | user = "" , |
||
const std::string & | password = "" |
||
) |
Create explicitly from host/port.
sb::StreamBaseURI::StreamBaseURI | ( | const std::string & | host, |
const std::string & | container, | ||
unsigned int | port, | ||
const std::string & | user = "" , |
||
const std::string & | password = "" |
||
) |
Create explicitly from host/port with container.
|
inline |
Create explicitly from host/port, including a map of parameters.
|
inline |
Create explicitly from host/port with container, including a map of parameters.
|
inline |
Add a parameter.
|
static |
Return a string representation of a list of uris.
std::string sb::StreamBaseURI::as_string | ( | ) | const |
Return the URI as a string.
|
static |
Create from the environment variable.
|
inline |
return a StreamBaseURI without Parameters
|
inline |
Returns the container name component of the URI.
May return an empty string if no container was specified.
|
inline |
Return the host component of the URI.
|
inline |
return the number of parameters
|
inline |
Return a parameter, or empty string if undefined.
|
inline |
Return a parameter, or empty string if undefined.
bool sb::StreamBaseURI::getParameter | ( | const std::string & | key, |
std::string & | value | ||
) | const |
Return a parameter into value (returning true if one was found).
Useful to distinguish an undefined parameter from an empty one.
|
inline |
Return the password component of the URI.
|
inline |
Return the port component of the URI.
|
inline |
Return the user name component of the URI.
|
inline |
Returns true if this object was not default-constructed.
|
inline |
Add a parameter.
|
static |
Create from the environment variable and return a vector of StreamBaseURIs.
|
static |
Return a StreamBaseURI vector from a string of comma sepearted URIs.
The string of URIs supplied must conform to a valid HA URI list, for example they must all reference the same container.
|
static |
The default URI (pointing to localhost, port 10000, default container).
|
static |
The default container name.
|
static |
The default container name.
|
static |
The default StreamBase port (10000).
|
static |
The default URI.
|
static |
No container specification.
|
static |
URI parameter used for password.
|
static |
The system container name.
|
static |
URI parameter used for username.
|
static |
URI parameter used for username.