| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | <!-- ##### SECTION Title ##### --> | 
					
						
							|  |  |  | Value arrays | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### SECTION Short_Description ##### --> | 
					
						
							| 
									
										
										
										
											2002-11-28 00:15:45 +00:00
										 |  |  | A container structure to maintain an array of generic values | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### SECTION Long_Description ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | The prime purpose of a #GValueArray is for it to be used as an object property | 
					
						
							|  |  |  | that holds an array of values. A #GValueArray wraps an array of #GValue elements | 
					
						
							|  |  |  | in order for it to be used as a boxed type through %G_TYPE_VALUE_ARRAY. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### SECTION See_Also ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-09-10 18:03:31 +00:00
										 |  |  | #GValue, #GParamSpecValueArray, g_param_spec_value_array() | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### STRUCT GValueArray ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | </para> | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @n_values:     number of values contained in the array | 
					
						
							|  |  |  | @values:       array of values | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_get_nth ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2002-11-08 18:47:56 +00:00
										 |  |  | Return a pointer to the value at @index_ containd in @value_array. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array: #GValueArray to get a value from | 
					
						
							| 
									
										
										
										
											2002-11-08 18:47:56 +00:00
										 |  |  | @index_:      index of the value of interest | 
					
						
							|  |  |  | @Returns:     pointer to a value at @index_ in @value_array | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_new ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Allocate and initialize a new #GValueArray, optionally preserve space | 
					
						
							|  |  |  | for @n_prealloced elements. New arrays always contain 0 elements, | 
					
						
							|  |  |  | regardless of the value of @n_prealloced. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @n_prealloced: number of values to preallocate space for | 
					
						
							|  |  |  | @Returns:      a newly allocated #GValueArray with 0 values | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_copy ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Construct an exact copy of a #GValueArray by duplicating all its | 
					
						
							|  |  |  | contents. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array: #GValueArray to copy | 
					
						
							|  |  |  | @Returns:     Newly allocated copy of #GValueArray | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_free ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Free a #GValueArray including its contents. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @value_array:  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_append ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Insert a copy of @value as last element of @value_array. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array: #GValueArray to add an element to | 
					
						
							|  |  |  | @value:       #GValue to copy into #GValueArray | 
					
						
							|  |  |  | @Returns:     the #GValueArray passed in as @value_array | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_prepend ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Insert a copy of @value as first element of @value_array. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array: #GValueArray to add an element to | 
					
						
							|  |  |  | @value:       #GValue to copy into #GValueArray | 
					
						
							|  |  |  | @Returns:     the #GValueArray passed in as @value_array | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_insert ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Insert a copy of @value at specified position into @value_array. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array: #GValueArray to add an element to | 
					
						
							| 
									
										
										
										
											2002-11-08 18:47:56 +00:00
										 |  |  | @index_:      insertion position, must be <= value_array->n_values | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value:       #GValue to copy into #GValueArray | 
					
						
							|  |  |  | @Returns:     the #GValueArray passed in as @value_array | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_remove ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2002-11-08 18:47:56 +00:00
										 |  |  | Remove the value at position @index_ from @value_array. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array: #GValueArray to remove an element from | 
					
						
							| 
									
										
										
										
											2002-11-08 18:47:56 +00:00
										 |  |  | @index_:      position of value to remove, must be < value_array->n_values | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @Returns:     the #GValueArray passed in as @value_array | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_sort ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Sort @value_array using @compare_func to compare the elements accoring to | 
					
						
							|  |  |  | the semantics of #GCompareFunc. | 
					
						
							|  |  |  | </para> | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | <para> | 
					
						
							|  |  |  | The current implementation uses Quick-Sort as sorting algorithm. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array:  #GValueArray to sort | 
					
						
							|  |  |  | @compare_func: function to compare elements | 
					
						
							|  |  |  | @Returns:      the #GValueArray passed in as @value_array | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- ##### FUNCTION g_value_array_sort_with_data ##### --> | 
					
						
							|  |  |  | <para> | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | Sort @value_array using @compare_func to compare the elements accoring | 
					
						
							|  |  |  | to the semantics of #GCompareDataFunc. | 
					
						
							|  |  |  | </para> | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | <para> | 
					
						
							|  |  |  | The current implementation uses Quick-Sort as sorting algorithm. | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | </para> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-12 00:56:22 +00:00
										 |  |  | @value_array:   #GValueArray to sort | 
					
						
							|  |  |  | @compare_func:  function to compare elements | 
					
						
							|  |  |  | @user_data:     extra data argument provided for @compare_func | 
					
						
							|  |  |  | @Returns:       the #GValueArray passed in as @value_array | 
					
						
							| 
									
										
										
										
											2001-03-07 20:11:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 |