alternative to assert
[gtkD.git] / src / gobject / ValueArray.d
blobcefc6445177e5297cdace58dc542191081a39a1f
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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
26 * outPack = gobject
27 * outFile = ValueArray
28 * strct = GValueArray
29 * realStrct=
30 * ctorStrct=
31 * clss = ValueArray
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_value_array_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gobject.Value
45 * - gobject.ValueArray
46 * structWrap:
47 * - GValue* -> Value
48 * - GValueArray* -> ValueArray
49 * local aliases:
52 module gobject.ValueArray;
54 private import gobject.gobjecttypes;
56 private import lib.gobject;
58 private import gobject.Value;
59 private import gobject.ValueArray;
61 /**
62 * Description
63 * The prime purpose of a GValueArray is for it to be used as an object property
64 * that holds an array of values. A GValueArray wraps an array of GValue elements
65 * in order for it to be used as a boxed type through G_TYPE_VALUE_ARRAY.
67 public class ValueArray
70 /** the main Gtk struct */
71 protected GValueArray* gValueArray;
74 public GValueArray* getValueArrayStruct()
76 return gValueArray;
80 /** the main Gtk struct as a void* */
81 protected void* getStruct()
83 return cast(void*)gValueArray;
86 /**
87 * Sets our main struct and passes it to the parent class
89 public this (GValueArray* gValueArray)
91 this.gValueArray = gValueArray;
94 /**
98 /**
99 * Return a pointer to the value at index_ containd in value_array.
100 * value_array:
101 * GValueArray to get a value from
102 * index_:
103 * index of the value of interest
104 * Returns:
105 * pointer to a value at index_ in value_array
107 public Value getNth(uint index)
109 // GValue* g_value_array_get_nth (GValueArray *value_array, guint index_);
110 return new Value( g_value_array_get_nth(gValueArray, index) );
114 * Allocate and initialize a new GValueArray, optionally preserve space
115 * for n_prealloced elements. New arrays always contain 0 elements,
116 * regardless of the value of n_prealloced.
117 * n_prealloced:
118 * number of values to preallocate space for
119 * Returns:
120 * a newly allocated GValueArray with 0 values
122 public this (uint nPrealloced)
124 // GValueArray* g_value_array_new (guint n_prealloced);
125 this(cast(GValueArray*)g_value_array_new(nPrealloced) );
129 * Construct an exact copy of a GValueArray by duplicating all its
130 * contents.
131 * value_array:
132 * GValueArray to copy
133 * Returns:
134 * Newly allocated copy of GValueArray
136 public ValueArray copy()
138 // GValueArray* g_value_array_copy (const GValueArray *value_array);
139 return new ValueArray( g_value_array_copy(gValueArray) );
143 * Free a GValueArray including its contents.
144 * value_array:
145 * GValueArray to free
147 public void free()
149 // void g_value_array_free (GValueArray *value_array);
150 g_value_array_free(gValueArray);
154 * Insert a copy of value as last element of value_array.
155 * value_array:
156 * GValueArray to add an element to
157 * value:
158 * GValue to copy into GValueArray
159 * Returns:
160 * the GValueArray passed in as value_array
162 public ValueArray append(Value value)
164 // GValueArray* g_value_array_append (GValueArray *value_array, const GValue *value);
165 return new ValueArray( g_value_array_append(gValueArray, (value is null) ? null : value.getValueStruct()) );
169 * Insert a copy of value as first element of value_array.
170 * value_array:
171 * GValueArray to add an element to
172 * value:
173 * GValue to copy into GValueArray
174 * Returns:
175 * the GValueArray passed in as value_array
177 public ValueArray prepend(Value value)
179 // GValueArray* g_value_array_prepend (GValueArray *value_array, const GValue *value);
180 return new ValueArray( g_value_array_prepend(gValueArray, (value is null) ? null : value.getValueStruct()) );
184 * Insert a copy of value at specified position into value_array.
185 * value_array:
186 * GValueArray to add an element to
187 * index_:
188 * insertion position, must be <= value_array->n_values
189 * value:
190 * GValue to copy into GValueArray
191 * Returns:
192 * the GValueArray passed in as value_array
194 public ValueArray insert(uint index, Value value)
196 // GValueArray* g_value_array_insert (GValueArray *value_array, guint index_, const GValue *value);
197 return new ValueArray( g_value_array_insert(gValueArray, index, (value is null) ? null : value.getValueStruct()) );
201 * Remove the value at position index_ from value_array.
202 * value_array:
203 * GValueArray to remove an element from
204 * index_:
205 * position of value to remove, must be < value_array->n_values
206 * Returns:
207 * the GValueArray passed in as value_array
209 public ValueArray remove(uint index)
211 // GValueArray* g_value_array_remove (GValueArray *value_array, guint index_);
212 return new ValueArray( g_value_array_remove(gValueArray, index) );
216 * Sort value_array using compare_func to compare the elements accoring to
217 * the semantics of GCompareFunc.
218 * The current implementation uses Quick-Sort as sorting algorithm.
219 * value_array:
220 * GValueArray to sort
221 * compare_func:
222 * function to compare elements
223 * Returns:
224 * the GValueArray passed in as value_array
226 public ValueArray sort(GCompareFunc compareFunc)
228 // GValueArray* g_value_array_sort (GValueArray *value_array, GCompareFunc compare_func);
229 return new ValueArray( g_value_array_sort(gValueArray, compareFunc) );
233 * Sort value_array using compare_func to compare the elements accoring
234 * to the semantics of GCompareDataFunc.
235 * The current implementation uses Quick-Sort as sorting algorithm.
236 * value_array:
237 * GValueArray to sort
238 * compare_func:
239 * function to compare elements
240 * user_data:
241 * extra data argument provided for compare_func
242 * Returns:
243 * the GValueArray passed in as value_array
244 * See Also
245 * GValue, GParamSpecValueArray, g_param_spec_value_array()
247 public ValueArray sortWithData(GCompareDataFunc compareFunc, void* userData)
249 // GValueArray* g_value_array_sort_with_data (GValueArray *value_array, GCompareDataFunc compare_func, gpointer user_data);
250 return new ValueArray( g_value_array_sort_with_data(gValueArray, compareFunc, userData) );