tufao  0.8.1
An asynchronous web framework for C++ built on top of Qt
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Tufao::QueryString Namespace Reference

This namespace provides utilities for dealing with query strings. More...

Functions

TUFAO_EXPORT QByteArray stringify (const QMap< QByteArray, QByteArray > &map, char sep= '&', char eq= '=', bool percentEncoding=true, char percent= '%')
 Serialize an object to a query string. More...
 
TUFAO_EXPORT QMap< QByteArray,
QByteArray > 
parse (const QByteArray &string, char sep= '&', char eq= '=', bool percentEncoding=true, char percent= '%')
 Deserialize a query string to an object. More...
 

Detailed Description

This namespace provides utilities for dealing with query strings.

Function Documentation

TUFAO_EXPORT QMap<QByteArray, QByteArray> Tufao::QueryString::parse ( const QByteArray &  string,
char  sep = '&',
char  eq = '=',
bool  percentEncoding = true,
char  percent = '%' 
)

Deserialize a query string to an object.

If you enable percentEncoding, then the implementation will follow the application/x-www-form-urlencoded spec.

Parameters
stringThe string to parse.
sepThe separator character.
eqThe assignment character.
percentEncodingtrue if the function should escape the characters. You should set it to false if you know there is no percent encoding applied and need some performance improvement.
percentIt allows you to replace the percent sign character for another.
Returns
The deserialized object.
TUFAO_EXPORT QByteArray Tufao::QueryString::stringify ( const QMap< QByteArray, QByteArray > &  map,
char  sep = '&',
char  eq = '=',
bool  percentEncoding = true,
char  percent = '%' 
)

Serialize an object to a query string.

If you enable percentEncoding, then the implementation will follow the application/x-www-form-urlencoded spec.

Parameters
mapThe object to be serialized.
sepThe separator character.
eqThe assignment character.
percentEncodingtrue if the function should escape the characters. You should set it to false if you know there is no percent encoding applied and need some performance improvement.
percentIt allows you to replace the percent sign character for another.
Returns
The serialized string.