1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 #ifndef _GLIBMM_VARIANTITER_H
3 #define _GLIBMM_VARIANTITER_H
4 
5 
6 /* Copyright(C) 2010 The glibmm Development Team
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include <glibmmconfig.h>
23 #include <glib.h>
24 
25 
26 namespace Glib
27 {
28 
29 class GLIBMM_API VariantBase;
30 class GLIBMM_API VariantContainerBase;
31 
32 //This can't be like a real iterator (like Gtk::TextIter),
33 //because g_iter_value_get_next_value() both gets a value and changes the iterator.
34 //GtkTextIter allows us to go forward and then separately get the current value.
35 /** VariantIter - An opaque data structure used to iterate through
36  * VariantBase containers such as arrays.
37  * @newin{2,28}
38  */
39 class GLIBMM_API VariantIter
40 {
41   public:
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43   using CppObjectType = VariantIter;
44   using BaseObjectType = GVariantIter;
45 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
46 
47   /** Constructs an invalid object.
48    * E.g. for output arguments to methods. There is not much you can do with
49    * the object before it has been assigned a valid value.
50    */
51   VariantIter();
52 
53   // Use make_a_copy=true when getting it directly from a struct.
54   explicit VariantIter(GVariantIter* castitem, bool make_a_copy = false);
55 
56   VariantIter(const VariantIter& src);
57   VariantIter& operator=(const VariantIter& src);
58 
59   VariantIter(VariantIter&& other) noexcept;
60   VariantIter& operator=(VariantIter&& other) noexcept;
61 
62   ~VariantIter() noexcept;
63 
64   void swap(VariantIter& other) noexcept;
65 
gobj()66   GVariantIter*       gobj()       { return gobject_; }
gobj()67   const GVariantIter* gobj() const { return gobject_; }
68 
69   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
70   GVariantIter* gobj_copy() const;
71 
72 protected:
73   GVariantIter* gobject_;
74 
75 private:
76 
77 
78 public:
79   //TODO: The variant parameter should be a VariantContainerBase.
80   explicit VariantIter(const VariantBase& variant);
81 
82 
83   /** Initialises (without allocating) a VariantIter.  @a iter may be
84    * completely uninitialised prior to this call; its old value is
85    * ignored.
86    *
87    * The iterator remains valid for as long as @a value exists, and need not
88    * be freed in any way.
89    *
90    * @newin{2,24}
91    *
92    * @param value A container Variant.
93    * @return The number of items in @a value.
94    */
95   gsize init(const VariantContainerBase& value);
96 
97 
98   /** Queries the number of child items in the container that we are
99    * iterating over.  This is the total number of items -- not the number
100    * of items remaining.
101    *
102    * This function might be useful for preallocation of arrays.
103    *
104    * @newin{2,24}
105    *
106    * @return The number of children in the container.
107    */
108   gsize get_n_children() const;
109 
110   bool next_value(VariantBase& value);
111 
112 
113   // Ignore varargs functions
114 
115 
116 };
117 
118 } // namespace Glib
119 
120 
121 namespace Glib
122 {
123 
124 /** @relates Glib::VariantIter
125  * @param lhs The left-hand side
126  * @param rhs The right-hand side
127  */
swap(VariantIter & lhs,VariantIter & rhs)128 inline void swap(VariantIter& lhs, VariantIter& rhs) noexcept
129   { lhs.swap(rhs); }
130 
131 } // namespace Glib
132 
133 namespace Glib
134 {
135 
136   /** A Glib::wrap() method for this object.
137    *
138    * @param object The C instance.
139    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
140    * @result A C++ instance that wraps this C instance.
141    *
142    * @relates Glib::VariantIter
143    */
144   GLIBMM_API
145   Glib::VariantIter wrap(GVariantIter* object, bool take_copy = false);
146 
147 } // namespace Glib
148 
149 
150 #endif /* _GLIBMM_VARIANTITER_H */
151 
152