Unity Scopes API
QVariantBuilder.h
1 /*
2  * Copyright (C) 2015 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <QtCore/QPair>
22 #include <QtCore/QString>
23 #include <QtCore/QVariant>
24 #include <QtCore/QVector>
25 
26 #include <memory>
27 
28 namespace unity
29 {
30 
31 namespace scopes
32 {
33 
34 namespace qt
35 {
36 
37 namespace internal
38 {
39 class QVariantBuilderImpl;
40 }
41 
64 class QVariantBuilder final
65 {
66 public:
68  virtual ~QVariantBuilder();
69 
73  //{@
74  QVariantBuilder(QVariantBuilder const& other);
76 
77  QVariantBuilder& operator=(QVariantBuilder const& other);
78  QVariantBuilder& operator=(QVariantBuilder&& other);
80 
95  // void add_tuple(std::initializer_list<QPair<QString, QVariant>> const& tuple);
96 
103  void add_tuple(QVector<QPair<QString, QVariant>> const& tuple);
104 
112  QVariant end();
113 
114 private:
116  QVariantBuilder(internal::QVariantBuilderImpl* impl);
117  std::unique_ptr<internal::QVariantBuilderImpl> p;
118  friend class internal::QVariantBuilderImpl;
120 };
121 } // namespace qt
122 
123 } // namespace scopes
124 
125 } // namespace unity
Definition: HttpAsyncReader.h:45
QVariant end()
Retrieves a completed variant.
Definition: QVariantBuilder.cpp:58
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Definition: ActionMetadata.h:31
Helper class for creating and populating QVariant containers.
Definition: QVariantBuilder.h:64
void add_tuple(QVector< QPair< QString, QVariant >> const &tuple)
Adds a tuple of key-value pairs to an array.
Definition: QVariantBuilder.cpp:53