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 convertPlus2Space (std::string &s)
 
bool decode (std::string &s)
 Decode the pct-encoded (hex) sequences, if any, return success. More...
 
std::string encode (const traits &ts, const std::string &comp)
 Encode the URI (sub) component. More...
 
bool 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 AUTHORITY_TRAITS
 authority traits More...
 
const char ENCODE_BEGIN_CHAR = '%'
 encode begin char ('%') More...
 
const traits FRAGMENT_TRAITS
 fragment traits More...
 
const traits PATH_TRAITS
 path traits More...
 
const traits QUERY_TRAITS
 query traits More...
 
const traits 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)

Definition at line 196 of file urisyn.cpp.

Referenced by decode().

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

Definition at line 157 of file urisyn.cpp.

References te::common::uri::append_hex(), te::common::uri::urisyn::traits::char_class, CVAL, and ENCODE_BEGIN_CHAR.

Referenced by te::common::uri::fragment::encoding(), te::common::uri::query::encoding(), te::common::uri::path::encoding(), te::qt::af::XMLFormatter::format(), te::qt::af::XMLFormatter::formatDataSourceInfos(), and te::common::URL::setFragmentString().

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.

Definition at line 136 of file urisyn.cpp.

References CEND, te::common::uri::urisyn::traits::char_class, CVA2, and CVAL.

Referenced by te::common::uri::parse().

Variable Documentation

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

authority traits

Definition at line 52 of file urisyn.cpp.

Referenced by te::common::uri::uri::operator<<(), and te::common::uri::parse().

const char TECOMMONEXPORT te::common::uri::urisyn::ENCODE_BEGIN_CHAR = '%'

encode begin char ('%')

Definition at line 30 of file urisyn.cpp.

Referenced by encode().

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

fragment traits

Definition at line 115 of file urisyn.cpp.

Referenced by te::common::uri::fragment::encoding(), te::common::uri::uri::operator<<(), te::common::uri::parse(), and te::common::URL::setFragmentString().

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

path traits

Definition at line 73 of file urisyn.cpp.

Referenced by te::common::uri::path::encoding(), and te::common::uri::parse().

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

query traits

Definition at line 94 of file urisyn.cpp.

Referenced by te::common::uri::query::encoding(), te::common::uri::uri::operator<<(), and te::common::uri::parse().

const traits TECOMMONEXPORT te::common::uri::urisyn::SCHEME_TRAITS
Initial value:
= {
0, 0, ':',
{
}
}
valid any position
Definition: urisyn.h:39
valid anywhere but 1st position
Definition: urisyn.h:40

scheme traits

Definition at line 31 of file urisyn.cpp.

Referenced by te::common::uri::uri::operator<<(), and te::common::uri::parse().