LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
urloperator.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #include "urloperator.h"
10 
11 namespace LC
12 {
13 namespace Util
14 {
16  : Url_ (url)
17  , Query_ (url)
18  {
19  }
20 
22  {
23  Flush ();
24  }
25 
27  {
28  Url_.setQuery (Query_);
29  }
30 
31  UrlOperator& UrlOperator::operator() (const QString& key, const QString& value)
32  {
33  Query_.addQueryItem (key, value);
34  return *this;
35  }
36 
37  UrlOperator& UrlOperator::operator() (const QString& key, const QByteArray& value)
38  {
39  return (*this) (key, QString::fromUtf8 (value));
40  }
41 
42  UrlOperator& UrlOperator::operator() (const QString& key, const char *value)
43  {
44  return (*this) (key, QString::fromLatin1 (value));
45  }
46 
47  UrlOperator& UrlOperator::operator() (const QString& key, int value)
48  {
49  return (*this) (key, QString::number (value));
50  }
51 
53  {
54  Query_.removeQueryItem (key);
55  return *this;
56  }
57 
59  {
60  Flush ();
61  return Url_;
62  }
63 }
64 }
void Flush()
Flushes any pending changes to the QUrl query.
Definition: urloperator.cpp:26
QUrl operator()()
Flushes any pending changes to the QUrl query.
Definition: urloperator.cpp:58
UrlOperator & operator-=(const QString &key)
Returns the first query parameter under the key.
Definition: urloperator.cpp:52
Manipulates query part of an QUrl object.
Definition: urloperator.h:48
~UrlOperator()
Flushes any pending changes to the QUrl query and destroys the UrlOperator.
Definition: urloperator.cpp:21
UrlOperator(QUrl &url)
Constructs the object modifying the query of url.
Definition: urloperator.cpp:15