1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 #ifndef _GLIBMM_VALUEARRAY_H
3 #define _GLIBMM_VALUEARRAY_H
4 
5 #include <glibmmconfig.h>
6 
7 #ifndef GLIBMM_DISABLE_DEPRECATED
8 
9 
10 /* Copyright (C) 2002-2009 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 
27 #include <glib-object.h>
28 #include <glibmm/value.h>
29 #include <sigc++/functors/slot.h>
30 
31 
32  // This whole file is deprecated.
33 
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 extern "C" { typedef struct _GValueArray GValueArray; }
36 #endif
37 
38 namespace Glib
39 {
40 
41 /** A container structure to maintain an array of generic values.
42  * The prime purpose of a ValueArray is for it to be used as an object property
43  * that holds an array of values. A ValueArray wraps an array of ValueBase
44  * elements.
45  *
46  * @newin{2,22}
47  *
48  * @deprecated Use std::vector<Glib::ValueBase*> or std::vector< Glib::Value<> >
49  *             instead of Glib::ValueArray.
50  */
51 class GLIBMM_API ValueArray
52 {
53   public:
54 #ifndef DOXYGEN_SHOULD_SKIP_THIS
55   using CppObjectType = ValueArray;
56   using BaseObjectType = GValueArray;
57 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
58 
59   /** Get the GType for this class, for use with the underlying GObject type system.
60    */
61   static GType get_type() G_GNUC_CONST;
62 
63 
64   explicit ValueArray(GValueArray* gobject, bool make_a_copy = true);
65 
66   ValueArray(const ValueArray& other);
67   ValueArray& operator=(const ValueArray& other);
68 
69   ValueArray(ValueArray&& other) noexcept;
70   ValueArray& operator=(ValueArray&& other) noexcept;
71 
72   ~ValueArray() noexcept;
73 
74   void swap(ValueArray& other) noexcept;
75 
76   ///Provides access to the underlying C instance.
gobj()77   GValueArray*       gobj()       { return gobject_; }
78 
79   ///Provides access to the underlying C instance.
gobj()80   const GValueArray* gobj() const { return gobject_; }
81 
82   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
83   GValueArray* gobj_copy() const;
84 
85 protected:
86   GValueArray* gobject_;
87 
88 private:
89 
90 
91 public:
92   /** For example,
93    *  int on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2);.
94    *  The compare function should return -1 if v1 < v2, 0 if v1 == v2, and 1 if
95    *  v1 > v2.
96    */
97   using SlotCompare = sigc::slot<int, const Glib::ValueBase&, const Glib::ValueBase&>;
98 
99   /** Default constructor.  Constructs a new array with no pre-allocation.
100    */
101   ValueArray();
102 
103   /** Constructs a new array with pre-allocation.
104    */
105   ValueArray(guint n_preallocated);
106 
107   /** Return the value at @a index contained in the value array.
108    * @param index Index of the value of interest.
109    * @param value An uninitialized ValueBase in which to store the result.  If
110    * the get is successful, @a value will be valid, otherwise it will remain
111    * uninitialized.
112    * @return whether the get was successful or not.
113    */
114   bool get_nth(guint index, Glib::ValueBase& value);
115 
116 
117   /** Insert a copy of @a value as last element of @a value_array. If @a value is
118    * <tt>nullptr</tt>, an uninitialized value is appended.
119    *
120    * Deprecated: 2.32: Use Array and Glib::array_append_val() instead.
121    *
122    * @param value Value to copy into ValueArray, or <tt>nullptr</tt>.
123    * @return The ValueArray passed in as @a value_array.
124    */
125 
126   Glib::ValueArray& append(const Glib::ValueBase& value);
127 
128 
129   /** Insert a copy of @a value as first element of @a value_array. If @a value is
130    * <tt>nullptr</tt>, an uninitialized value is prepended.
131    *
132    *
133    * Deprecated: 2.32: Use Array and Glib::array_prepend_val() instead.
134    *
135    * @param value Value to copy into ValueArray, or <tt>nullptr</tt>.
136    * @return The ValueArray passed in as @a value_array.
137    */
138 
139   Glib::ValueArray& prepend(const Glib::ValueBase& value);
140 
141 
142   /** Insert a copy of @a value at specified position into @a value_array. If @a value
143    * is <tt>nullptr</tt>, an uninitialized value is inserted.
144    *
145    * Deprecated: 2.32: Use Array and Glib::array_insert_val() instead.
146    *
147    * @param index Insertion position, must be <= value_array->;n_values.
148    * @param value Value to copy into ValueArray, or <tt>nullptr</tt>.
149    * @return The ValueArray passed in as @a value_array.
150    */
151 
152   Glib::ValueArray& insert(guint index, const Glib::ValueBase& value);
153 
154 
155   /** Remove the value at position @a index from @a value_array.
156    *
157    * Deprecated: 2.32: Use Array and g_array_remove_index() instead.
158    *
159    * @param index Position of value to remove, which must be less than
160    *  @a value_array->n_values.
161    * @return The ValueArray passed in as @a value_array.
162    */
163 
164   Glib::ValueArray& remove(guint index);
165 
166 
167   /** Sort @a value_array using @a compare_func to compare the elements according to
168    * the semantics of CompareFunc.
169    *
170    * The current implementation uses the same sorting algorithm as standard
171    * C qsort() function.
172    *
173    * Deprecated: 2.32: Use Array and g_array_sort().
174    *
175    * @param compare_func Function to compare elements.
176    * @return The ValueArray passed in as @a value_array.
177    */
178 
179   Glib::ValueArray& sort(const SlotCompare& compare_func);
180 
181 
182 };
183 
184 } //namespace Glib
185 
186 
187 namespace Glib
188 {
189 
190 /** @relates Glib::ValueArray
191  * @param lhs The left-hand side
192  * @param rhs The right-hand side
193  */
swap(ValueArray & lhs,ValueArray & rhs)194 inline void swap(ValueArray& lhs, ValueArray& rhs) noexcept
195   { lhs.swap(rhs); }
196 
197 } // namespace Glib
198 
199 namespace Glib
200 {
201 
202 /** A Glib::wrap() method for this object.
203  *
204  * @param object The C instance.
205  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
206  * @result A C++ instance that wraps this C instance.
207  *
208  * @relates Glib::ValueArray
209  */
210 GLIBMM_API
211 Glib::ValueArray wrap(GValueArray* object, bool take_copy = false);
212 
213 #ifndef DOXYGEN_SHOULD_SKIP_THIS
214 template <>
215 class GLIBMM_API Value<Glib::ValueArray> : public Glib::Value_Boxed<Glib::ValueArray>
216 {};
217 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
218 
219 } // namespace Glib
220 
221 
222 #endif // GLIBMM_DISABLE_DEPRECATED
223 
224 
225 #endif /* _GLIBMM_VALUEARRAY_H */
226 
227