te::common::uri Namespace Reference

Namespaces

 urisyn
 URI syntax declarations.
 

Classes

class  authority
 URI authority component (without userinfo). More...
 
class  domain_name
 Domain name. More...
 
class  fragment
 URI fragment component. More...
 
class  ip_address
 IP address. More...
 
class  ipv6_address
 
class  path
 URI path component. More...
 
class  query
 URI query component. More...
 
class  scheme
 URI scheme component. More...
 
class  uri
 Uniform Resource Identifier (URI) reference. More...
 

Functions

void TECOMMONEXPORT append_hex (char v, std::string &s)
 Convert the char v to hex and add the 2 chars to the end of s. More...
 
std::string TECOMMONEXPORT convert (bool v)
 bool to string, true="1", false="0" More...
 
std::string TECOMMONEXPORT convert (int v)
 int to string More...
 
std::string TECOMMONEXPORT convert (unsigned int v)
 uint to string More...
 
std::string TECOMMONEXPORT convert (long int v)
 long int to string More...
 
std::string TECOMMONEXPORT convert (unsigned long int v)
 unsigned long int to string More...
 
std::string TECOMMONEXPORT convert (long long int v)
 long long int to string More...
 
std::string TECOMMONEXPORT convert (unsigned long long int v)
 unsigned long long int to string More...
 
std::string TECOMMONEXPORT convert (double v)
 double to string More...
 
std::string TECOMMONEXPORT convert (const std::string &v)
 string to trimmed string More...
 
std::string convert (const char *v)
 cstring to string More...
 
bool TECOMMONEXPORT convert (const std::string &s, bool &v)
 String to bool, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, int &v)
 String to int, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, unsigned int &v)
 String to unsigned int, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, unsigned long int &v)
 String to size_t, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, long long int &v)
 String to long long int, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, unsigned long long int &v)
 String to unsigned long long int, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, double &v)
 String to double, returning true if set, which is when the string is not empty or all isspace. More...
 
bool TECOMMONEXPORT convert (const std::string &s, std::string &v)
 String to trimmed string, returning true if set, which is when the string is not empty or all isspace. More...
 
std::string TECOMMONEXPORT convert (const path &v)
 URI path to string. More...
 
bool TECOMMONEXPORT convert (const std::string &s, path &v)
 String to URI path, returning true if set, which is when the string is not empty or all isspace. More...
 
bool decodeAndConcate (std::string::const_iterator &it, std::string &s)
 
bool encodeAndConcate (std::string::const_iterator &it, std::string &s)
 
bool TECOMMONEXPORT isspaces (const char *s)
 Test if string is empty or all isspace. More...
 
std::ostream & operator<< (std::ostream &os, const scheme &v)
 Stream out URI scheme. More...
 
std::ostream & operator<< (std::ostream &os, const ip_address &v)
 Stream out IP address. More...
 
std::ostream & operator<< (std::ostream &os, const domain_name &v)
 Stream out domain name. More...
 
std::ostream & operator<< (std::ostream &os, const fragment &v)
 Stream out fragment encoding. More...
 
std::ostream & operator<< (std::ostream &os, const ipv6_address &v)
 Stream out IP v6 address. More...
 
std::ostream & operator<< (std::ostream &os, const authority &v)
 Stream out URI authority. More...
 
std::ostream & operator<< (std::ostream &os, const query &v)
 Stream out query encoding. More...
 
std::ostream & operator<< (std::ostream &os, const path &v)
 Stream out path encoding. More...
 
std::ostream & operator<< (std::ostream &os, const uri &v)
 Stream out URI encoding. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, scheme &v, char *endc=0)
 Parse URI scheme, returning whether found or not and advancing first and setting scheme and end char if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, fragment &v, std::string *errs=0)
 Parse URI fragment, returning whether found or not and advancing first and setting fragment if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, domain_name &v)
 Parse domain name, returning whether found or not and advancing first and setting name if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, ip_address &v)
 Parse IP address, returning whether found or not and advancing first and setting address if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, ipv6_address &v)
 Parse IP v6 address, returning whether found or not and advancing first and setting address if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, authority &v)
 Parse URI authority, returning whether found or not and advancing first and setting authority if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, query &v, std::string *errs=0)
 Parse URI query, returning whether found or not and advancing first and setting query if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, path &v, std::string *errs=0)
 Parse URI path, returning whether found or not and advancing first and setting path if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, uri &v, std::string *errs=0)
 Parse URI, returning whether found or not and advancing first and setting URI if found. More...
 
bool TECOMMONEXPORT parse_hex (const std::string &s, size_t pos, char &chr)
 Parse hex chars at pos, returning success, and set the char and advance first on success. More...
 
bool parseLoginPassword (std::string::const_iterator &first, std::string::const_iterator last, authority &v)
 

Function Documentation

void TECOMMONEXPORT te::common::uri::append_hex ( char  v,
std::string &  s 
)

Convert the char v to hex and add the 2 chars to the end of s.

std::string TECOMMONEXPORT te::common::uri::convert ( bool  v)

bool to string, true="1", false="0"

std::string TECOMMONEXPORT te::common::uri::convert ( int  v)

int to string

std::string TECOMMONEXPORT te::common::uri::convert ( unsigned int  v)

uint to string

std::string TECOMMONEXPORT te::common::uri::convert ( long int  v)

long int to string

std::string TECOMMONEXPORT te::common::uri::convert ( unsigned long int  v)

unsigned long int to string

std::string TECOMMONEXPORT te::common::uri::convert ( long long int  v)

long long int to string

std::string TECOMMONEXPORT te::common::uri::convert ( unsigned long long int  v)

unsigned long long int to string

std::string TECOMMONEXPORT te::common::uri::convert ( double  v)

double to string

std::string TECOMMONEXPORT te::common::uri::convert ( const std::string &  v)

string to trimmed string

std::string te::common::uri::convert ( const char *  v)
inline

cstring to string

Definition at line 26 of file utils.h.

bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
bool &  v 
)

String to bool, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK. The following, and their uppercase, qualify as true: 1, 't', "true", 'y', "yes", "on". Their complements are considered false, and all else error.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
int &  v 
)

String to int, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
unsigned int &  v 
)

String to unsigned int, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
unsigned long int &  v 
)

String to size_t, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
long long int &  v 
)

String to long long int, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
unsigned long long int &  v 
)

String to unsigned long long int, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
double &  v 
)

String to double, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
std::string &  v 
)

String to trimmed string, returning true if set, which is when the string is not empty or all isspace.

std::string TECOMMONEXPORT te::common::uri::convert ( const path v)

URI path to string.

Referenced by te::common::uri::query::find().

bool TECOMMONEXPORT te::common::uri::convert ( const std::string &  s,
path v 
)

String to URI path, returning true if set, which is when the string is not empty or all isspace.

isspace before and/or after value OK.

Exceptions
std::invalid_argumenton conversion error
bool te::common::uri::decodeAndConcate ( std::string::const_iterator &  it,
std::string &  s 
)
bool te::common::uri::encodeAndConcate ( std::string::const_iterator &  it,
std::string &  s 
)
bool TECOMMONEXPORT te::common::uri::isspaces ( const char *  s)

Test if string is empty or all isspace.

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const scheme v 
)
inline

Stream out URI scheme.

Definition at line 57 of file scheme.h.

References te::common::uri::scheme::string().

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const ip_address v 
)
inline

Stream out IP address.

Definition at line 64 of file ip_address.h.

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const domain_name v 
)
inline

Stream out domain name.

Definition at line 64 of file domain_name.h.

References te::common::uri::domain_name::string().

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const fragment v 
)
inline

Stream out fragment encoding.

Definition at line 69 of file fragment.h.

References te::common::uri::fragment::encoding().

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const ipv6_address v 
)
inline

Stream out IP v6 address.

Definition at line 76 of file ipv6_address.h.

References te::common::uri::ipv6_address::write().

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const authority v 
)
inline

Stream out URI authority.

Definition at line 95 of file authority.h.

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const query v 
)
inline

Stream out query encoding.

Definition at line 110 of file query.h.

References te::common::uri::query::encoding().

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const path v 
)
inline

Stream out path encoding.

Definition at line 138 of file path.h.

References te::common::uri::path::encoding().

std::ostream& te::common::uri::operator<< ( std::ostream &  os,
const uri v 
)
inline

Stream out URI encoding.

Definition at line 153 of file uri.h.

bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
scheme v,
char *  endc = 0 
)

Parse URI scheme, returning whether found or not and advancing first and setting scheme and end char if found.

Does not skip leading space.

bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
fragment v,
std::string *  errs = 0 
)

Parse URI fragment, returning whether found or not and advancing first and setting fragment if found.

Does not skip leading space.

If errs is specified the following take place:

  • Errors in decoding the string do not cause an immediate false return and and error message is reported in the error string errs. The string is used without decoding (i.e. assumes an unencoded '').
bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
domain_name v 
)

Parse domain name, returning whether found or not and advancing first and setting name if found.

Does not skip leading space.

bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
ip_address v 
)

Parse IP address, returning whether found or not and advancing first and setting address if found.

Does not skip leading space.

bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
ipv6_address v 
)

Parse IP v6 address, returning whether found or not and advancing first and setting address if found.

Does not skip leading space.

bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
authority v 
)

Parse URI authority, returning whether found or not and advancing first and setting authority if found.

Does not skip leading space.

bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
query v,
std::string *  errs = 0 
)

Parse URI query, returning whether found or not and advancing first and setting query if found.

Does not skip leading space.

If errs is specified the following take place:

  • Errors in parsing subcomponents, after the first, do not cause an immediate false return and errors messages are reported in the error string errs.
  • Errors are handled as follows:
    • Key-value pairs with an empty key are ignored.
    • Keys with missing '=' are ignored.
    • Errors decoding a key or value result in no decoding at all (i.e. assumes an unencoded '').
bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
path v,
std::string *  errs = 0 
)

Parse URI path, returning whether found or not and advancing first and setting path if found.

Does not skip leading space.

If errs is specified the following take place:

  • Errors in decoding segments do not cause an immediate false return and and error message is reported in the error string errs. The segment is used without decoding (i.e. assumes an unencoded '').
bool TECOMMONEXPORT te::common::uri::parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
uri v,
std::string *  errs = 0 
)

Parse URI, returning whether found or not and advancing first and setting URI if found.

Does not skip leading space.

If errs is specified parsing is more lax allowing decoding and other errors and setting errs with the error messages. See the individual component parse functions for details.

bool TECOMMONEXPORT te::common::uri::parse_hex ( const std::string &  s,
size_t  pos,
char &  chr 
)

Parse hex chars at pos, returning success, and set the char and advance first on success.

bool te::common::uri::parseLoginPassword ( std::string::const_iterator &  first,
std::string::const_iterator  last,
authority v 
)