2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gobject-Value-arrays.html
27 * outFile = ValueArray
45 * - gobject.ValueArray
48 * - GValueArray* -> ValueArray
53 module gobject
.ValueArray
;
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gtkc
.gobjecttypes
;
65 private import gtkc
.gobject
;
68 private import gobject
.Value
;
69 private import gobject
.ValueArray
;
76 * The prime purpose of a GValueArray is for it to be used as an object property
77 * that holds an array of values. A GValueArray wraps an array of GValue elements
78 * in order for it to be used as a boxed type through G_TYPE_VALUE_ARRAY.
80 public class ValueArray
83 /** the main Gtk struct */
84 protected GValueArray
* gValueArray
;
87 public GValueArray
* getValueArrayStruct()
93 /** the main Gtk struct as a void* */
94 protected void* getStruct()
96 return cast(void*)gValueArray
;
100 * Sets our main struct and passes it to the parent class
102 public this (GValueArray
* gValueArray
)
106 if ( gValueArray
is null )
111 Stdout("struct gValueArray is null on constructor").newline
;
115 printf("struct gValueArray is null on constructor");
122 assert(gValueArray
!is null, "struct gValueArray is null on constructor");
124 this.gValueArray
= gValueArray
;
132 * Return a pointer to the value at index_ containd in value_array.
134 * GValueArray to get a value from
136 * index of the value of interest
138 * pointer to a value at index_ in value_array
140 public Value
getNth(uint index
)
142 // GValue* g_value_array_get_nth (GValueArray *value_array, guint index_);
143 return new Value( g_value_array_get_nth(gValueArray
, index
) );
147 * Allocate and initialize a new GValueArray, optionally preserve space
148 * for n_prealloced elements. New arrays always contain 0 elements,
149 * regardless of the value of n_prealloced.
151 * number of values to preallocate space for
153 * a newly allocated GValueArray with 0 values
155 public this (uint nPrealloced
)
157 // GValueArray* g_value_array_new (guint n_prealloced);
158 this(cast(GValueArray
*)g_value_array_new(nPrealloced
) );
162 * Construct an exact copy of a GValueArray by duplicating all its
165 * GValueArray to copy
167 * Newly allocated copy of GValueArray
169 public ValueArray
copy()
171 // GValueArray* g_value_array_copy (const GValueArray *value_array);
172 return new ValueArray( g_value_array_copy(gValueArray
) );
176 * Free a GValueArray including its contents.
178 * GValueArray to free
182 // void g_value_array_free (GValueArray *value_array);
183 g_value_array_free(gValueArray
);
187 * Insert a copy of value as last element of value_array.
189 * GValueArray to add an element to
191 * GValue to copy into GValueArray
193 * the GValueArray passed in as value_array
195 public ValueArray
append(Value value
)
197 // GValueArray* g_value_array_append (GValueArray *value_array, const GValue *value);
198 return new ValueArray( g_value_array_append(gValueArray
, (value
is null) ?
null : value
.getValueStruct()) );
202 * Insert a copy of value as first element of value_array.
204 * GValueArray to add an element to
206 * GValue to copy into GValueArray
208 * the GValueArray passed in as value_array
210 public ValueArray
prepend(Value value
)
212 // GValueArray* g_value_array_prepend (GValueArray *value_array, const GValue *value);
213 return new ValueArray( g_value_array_prepend(gValueArray
, (value
is null) ?
null : value
.getValueStruct()) );
217 * Insert a copy of value at specified position into value_array.
219 * GValueArray to add an element to
221 * insertion position, must be <= value_array->n_values
223 * GValue to copy into GValueArray
225 * the GValueArray passed in as value_array
227 public ValueArray
insert(uint index
, Value value
)
229 // GValueArray* g_value_array_insert (GValueArray *value_array, guint index_, const GValue *value);
230 return new ValueArray( g_value_array_insert(gValueArray
, index
, (value
is null) ?
null : value
.getValueStruct()) );
234 * Remove the value at position index_ from value_array.
236 * GValueArray to remove an element from
238 * position of value to remove, must be < value_array->n_values
240 * the GValueArray passed in as value_array
242 public ValueArray
remove(uint index
)
244 // GValueArray* g_value_array_remove (GValueArray *value_array, guint index_);
245 return new ValueArray( g_value_array_remove(gValueArray
, index
) );
249 * Sort value_array using compare_func to compare the elements accoring to
250 * the semantics of GCompareFunc.
251 * The current implementation uses Quick-Sort as sorting algorithm.
253 * GValueArray to sort
255 * function to compare elements
257 * the GValueArray passed in as value_array
259 public ValueArray
sort(GCompareFunc compareFunc
)
261 // GValueArray* g_value_array_sort (GValueArray *value_array, GCompareFunc compare_func);
262 return new ValueArray( g_value_array_sort(gValueArray
, compareFunc
) );
266 * Sort value_array using compare_func to compare the elements accoring
267 * to the semantics of GCompareDataFunc.
268 * The current implementation uses Quick-Sort as sorting algorithm.
270 * GValueArray to sort
272 * function to compare elements
274 * extra data argument provided for compare_func
276 * the GValueArray passed in as value_array
278 * GValue, GParamSpecValueArray, g_param_spec_value_array()
280 public ValueArray
sortWithData(GCompareDataFunc compareFunc
, void* userData
)
282 // GValueArray* g_value_array_sort_with_data (GValueArray *value_array, GCompareDataFunc compare_func, gpointer user_data);
283 return new ValueArray( g_value_array_sort_with_data(gValueArray
, compareFunc
, userData
) );