Lunchbox
1.9.1
|
The URI class parses the given uri string according to the regex given in RFC3986. More...
#include <uri.h>
Public Types | |
typedef boost::unordered_map < std::string, std::string > | KVMap |
typedef KVMap::const_iterator | ConstKVIter |
Public Member Functions | |
LUNCHBOX_API | URI (const std::string &uri) |
LUNCHBOX_API | URI (const URI &from) |
Copy-construct an URI. More... | |
LUNCHBOX_API URI & | operator= (const URI &rhs) |
Assign the data from another URI. More... | |
Getters for the uri data @version 1.9.2 | |
LUNCHBOX_API const std::string & | getScheme () const |
LUNCHBOX_API const std::string & | getUserinfo () const |
LUNCHBOX_API uint16_t | getPort () const |
LUNCHBOX_API const std::string & | getHost () const |
LUNCHBOX_API const std::string & | getPath () const |
LUNCHBOX_API const std::string & | getQuery () const |
LUNCHBOX_API const std::string & | getFragment () const |
Getters to query key-value data @version 1.9.2 | |
LUNCHBOX_API ConstKVIter | queryBegin () const |
LUNCHBOX_API ConstKVIter | queryEnd () const |
LUNCHBOX_API ConstKVIter | findQuery (const std::string &key) const |
The URI class parses the given uri string according to the regex given in RFC3986.
* http://bob@www.example.com:8080/path/?key=value,foo=bar#fragment * ^ ^ ^ ^ ^ ^ ^ ^ * a b c d e f g h * * URI part Range String * scheme [a, b) "http" * userinfo [c, d) bob * host [d, e) "www.example.com" * port (e, f) 8080 * path [f, g) "/path/" * query (g, h) "key=value" * fragment (h,-) "fragment" *
Queries are parsed into key-value pairs and can be accessed using findQuery(), queryBegin() and queryEnd().
Example:
LUNCHBOX_API lunchbox::URI::URI | ( | const std::string & | uri | ) |
uri | URI string to parse. |
std::exception | for incomplete URIs, and boost::bad_lexical_cast if the port is not a number. |
LUNCHBOX_API ConstKVIter lunchbox::URI::findQuery | ( | const std::string & | key | ) | const |
Assign the data from another URI.
LUNCHBOX_API ConstKVIter lunchbox::URI::queryBegin | ( | ) | const |
LUNCHBOX_API ConstKVIter lunchbox::URI::queryEnd | ( | ) | const |