![]() |
LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
|
Manipulates query part of an QUrl object. More...
#include "urloperator.h"
Public Member Functions | |
UrlOperator (QUrl &url) | |
Constructs the object modifying the query of url. | |
~UrlOperator () | |
Flushes any pending changes to the QUrl query and destroys the UrlOperator. | |
void | Flush () |
Flushes any pending changes to the QUrl query. | |
UrlOperator & | operator() (const QString &key, const QString &value) |
Adds a new key = value parameters pair. | |
UrlOperator & | operator() (const QString &key, const QByteArray &value) |
Adds a new key = value parameters pair. | |
UrlOperator & | operator() (const QString &key, const char *value) |
Adds a new key = value parameters pair. | |
UrlOperator & | operator() (const QString &key, int value) |
Adds a new key = value parameters pair. | |
template<typename Key, typename Value> | |
UrlOperator & | operator() (bool condition, Key &&key, Value &&value) |
UrlOperator & | operator-= (const QString &key) |
Returns the first query parameter under the key. | |
QUrl | operator() () |
Flushes any pending changes to the QUrl query. | |
Manipulates query part of an QUrl object.
This class is used as follows:
Intended usage:
Here, an unnamed UrlOperator object is created that is valid only inside the corresponding expression, thus the changes to someUrl
are visible immediately after executing that line.
Definition at line 44 of file urloperator.h.
LC::Util::UrlOperator::UrlOperator | ( | QUrl & | url | ) |
Constructs the object modifying the query of url.
[in] | url | The URL to modify. |
Definition at line 15 of file urloperator.cpp.
Referenced by operator()(), operator()(), operator()(), operator()(), operator()(), and operator-=().
LC::Util::UrlOperator::~UrlOperator | ( | ) |
Flushes any pending changes to the QUrl query and destroys the UrlOperator.
Definition at line 21 of file urloperator.cpp.
References Flush().
void LC::Util::UrlOperator::Flush | ( | ) |
Flushes any pending changes to the QUrl query.
Definition at line 26 of file urloperator.cpp.
Referenced by ~UrlOperator(), and operator()().
QUrl LC::Util::UrlOperator::operator() | ( | ) |
Flushes any pending changes to the QUrl query.
Definition at line 58 of file urloperator.cpp.
References Flush().
|
inline |
Definition at line 126 of file urloperator.h.
References UrlOperator().
UrlOperator & LC::Util::UrlOperator::operator() | ( | const QString & | key, |
const char * | value ) |
Adds a new key = value parameters pair.
If the URL already contains this key, a new value is added in addition to the already existing one.
The value is considered to be a Latin1-string.
This overload is provided for convenience and efficiency.
[in] | key | The query parameter key. |
[in] | value | The query parameter value (a Latin1-string). |
Definition at line 42 of file urloperator.cpp.
References UrlOperator().
UrlOperator & LC::Util::UrlOperator::operator() | ( | const QString & | key, |
const QByteArray & | value ) |
Adds a new key = value parameters pair.
If the URL already contains this key, a new value is added in addition to the already existing one.
This overload is provided for convenience and efficiency.
[in] | key | The query parameter key. |
[in] | value | The query parameter value. |
Definition at line 37 of file urloperator.cpp.
References UrlOperator().
UrlOperator & LC::Util::UrlOperator::operator() | ( | const QString & | key, |
const QString & | value ) |
Adds a new key = value parameters pair.
If the URL already contains this key, a new value is added in addition to the already existing one.
The key/value pair is encoded before it is added to the query. The key and value are also encoded into UTF-8. Both key and value are URL-encoded as well. So, this function is analogous in effect to standard relevant Qt APIs.
[in] | key | The query parameter key. |
[in] | value | The query parameter value. |
Definition at line 31 of file urloperator.cpp.
References UrlOperator().
UrlOperator & LC::Util::UrlOperator::operator() | ( | const QString & | key, |
int | value ) |
Adds a new key = value parameters pair.
If the URL already contains this key, a new value is added in addition to the already existing one.
This overload is provided for convenience and efficiency.
[in] | key | The query parameter key. |
[in] | value | The query parameter value. |
Definition at line 47 of file urloperator.cpp.
References UrlOperator().
UrlOperator & LC::Util::UrlOperator::operator-= | ( | const QString & | key | ) |
Returns the first query parameter under the key.
If no such parameters exist, this function does nothing.
[in] | key | The query parameter key. |
Definition at line 52 of file urloperator.cpp.
References UrlOperator().