te::common::uri::urisyn Namespace Reference

URI syntax declarations. More...

Classes

struct  traits
 Traits used for parsing and encoding components. More...
 

Enumerations

enum  char_class_e { CINV = -2, CEND = -1, CVAL = 0, CVA2 = 1 }
 Char class. More...
 

Functions

void TECOMMONEXPORT convertPlus2Space (std::string &s)
 
bool TECOMMONEXPORT decode (std::string &s)
 Decode the pct-encoded (hex) sequences, if any, return success. More...
 
std::string TECOMMONEXPORT encode (const traits &ts, const std::string &comp)
 Encode the URI (sub) component. More...
 
bool TECOMMONEXPORT parse (const traits &ts, std::string::const_iterator &first, std::string::const_iterator last, std::string &comp, char *endc=0)
 Parse the URI componet, returning whether successful and setting the string and end char and advancing if so. More...
 

Variables

const traits TECOMMONEXPORT AUTHORITY_TRAITS
 authority traits More...
 
const char TECOMMONEXPORT ENCODE_BEGIN_CHAR
 encode begin char ('%') More...
 
const traits TECOMMONEXPORT FRAGMENT_TRAITS
 fragment traits More...
 
const traits TECOMMONEXPORT PATH_TRAITS
 path traits More...
 
const traits TECOMMONEXPORT QUERY_TRAITS
 query traits More...
 
const traits TECOMMONEXPORT SCHEME_TRAITS
 scheme traits More...
 

Detailed Description

URI syntax declarations.

Enumeration Type Documentation

Char class.

Enumerator
CINV 

invalid

CEND 

end delimitor

CVAL 

valid any position

CVA2 

valid anywhere but 1st position

Definition at line 36 of file urisyn.h.

Function Documentation

void TECOMMONEXPORT te::common::uri::urisyn::convertPlus2Space ( std::string &  s)
bool TECOMMONEXPORT te::common::uri::urisyn::decode ( std::string &  s)

Decode the pct-encoded (hex) sequences, if any, return success.

Does not change string on error.

See also
http://tools.ietf.org/html/rfc3986#section-2.1
encode
std::string TECOMMONEXPORT te::common::uri::urisyn::encode ( const traits ts,
const std::string &  comp 
)

Encode the URI (sub) component.

Note that this should be used on the subcomponents before appending to subdelimiter chars, if any.

From the RFC: URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component. If a reserved character is found in a URI component and no delimiting role is known for that character, then it must be interpreted as representing the data octet corresponding to that character's encoding in US-ASCII.

See also
http://tools.ietf.org/html/rfc3986
decode
bool TECOMMONEXPORT te::common::uri::urisyn::parse ( const traits ts,
std::string::const_iterator &  first,
std::string::const_iterator  last,
std::string &  comp,
char *  endc = 0 
)

Parse the URI componet, returning whether successful and setting the string and end char and advancing if so.

This looks for end chars either returning the string up to, but not including, the end char or returning the string up to the first character that is not valid for the component. The arg first is advanced after the end char if there is one. The arg endc is set to either 0 if no end char found or to the end char. If the first char is an end char then true is returned and the string will be empty. Leading white space is not skipped.

The component is not decoded and should not be decoded until after futher parsing with the component's subdelimiters, if any.

Variable Documentation

const traits TECOMMONEXPORT te::common::uri::urisyn::AUTHORITY_TRAITS

authority traits

const char TECOMMONEXPORT te::common::uri::urisyn::ENCODE_BEGIN_CHAR

encode begin char ('%')

const traits TECOMMONEXPORT te::common::uri::urisyn::FRAGMENT_TRAITS

fragment traits

const traits TECOMMONEXPORT te::common::uri::urisyn::PATH_TRAITS

path traits

const traits TECOMMONEXPORT te::common::uri::urisyn::QUERY_TRAITS

query traits

const traits TECOMMONEXPORT te::common::uri::urisyn::SCHEME_TRAITS

scheme traits