Blame docs/reference/gobject/html/gobject-Value-arrays.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>Value arrays: GObject Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GObject Reference Manual">
Packit ae235b
<link rel="up" href="rn01.html" title="API Reference">
Packit ae235b
<link rel="prev" href="gobject-Closures.html" title="Closures">
Packit ae235b
<link rel="next" href="GBinding.html" title="GBinding">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Value arrays

Packit ae235b

Value arrays — A container structure to maintain an array of

Packit ae235b
    generic values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValue *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_get_nth ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_new ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_copy ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_free ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_append ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_prepend ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_insert ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_remove ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_sort ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GValueArray *
Packit ae235b
Packit ae235b
Packit ae235b
g_value_array_sort_with_data ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
struct
Packit ae235b
GValueArray
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <glib-object.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

The prime purpose of a GValueArray is for it to be used as an

Packit ae235b
object property that holds an array of values. A GValueArray wraps
Packit ae235b
an array of GValue elements in order for it to be used as a boxed
Packit ae235b
type through G_TYPE_VALUE_ARRAY.

Packit ae235b

GValueArray is deprecated in favour of GArray since GLib 2.32. It

Packit ae235b
is possible to create a GArray that behaves like a GValueArray by
Packit ae235b
using the size of GValue as the element size, and by setting
Packit ae235b
g_value_unset() as the clear function using g_array_set_clear_func(),
Packit ae235b
for instance, the following code:

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
        
GValueArray *array = g_value_array_new (10);
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b

can be replaced by:

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
        
GArray *array = g_array_sized_new (FALSE, TRUE, sizeof (GValue), 10);
Packit ae235b
g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_value_array_get_nth ()

Packit ae235b
GValue *
Packit ae235b
g_value_array_get_nth (GValueArray *value_array,
Packit ae235b
                       guint index_);
Packit ae235b
Packit ae235b

g_value_array_get_nth has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use g_array_index() instead.

Packit ae235b
Packit ae235b

Return a pointer to the value at index_

Packit ae235b
 containd in value_array
Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to get a value from

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

index_

Packit ae235b

index of the value of interest

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

pointer to a value at index_

Packit ae235b
in value_array
Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_new ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_new (guint n_prealloced);
Packit ae235b
Packit ae235b

g_value_array_new has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_sized_new() instead.

Packit ae235b
Packit ae235b

Allocate and initialize a new GValueArray, optionally preserve space

Packit ae235b
for n_prealloced
Packit ae235b
 elements. New arrays always contain 0 elements,
Packit ae235b
regardless of the value of n_prealloced
Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

n_prealloced

Packit ae235b

number of values to preallocate space for

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a newly allocated GValueArray with 0 values

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_copy ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_copy (const GValueArray *value_array);
Packit ae235b
Packit ae235b

g_value_array_copy has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_ref() instead.

Packit ae235b
Packit ae235b

Construct an exact copy of a GValueArray by duplicating all its

Packit ae235b
contents.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to copy

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

Newly allocated copy of GValueArray.

Packit ae235b

[transfer full]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_free ()

Packit ae235b
void
Packit ae235b
g_value_array_free (GValueArray *value_array);
Packit ae235b
Packit ae235b

g_value_array_free has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_unref() instead.

Packit ae235b
Packit ae235b

Free a GValueArray including its contents.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to free

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_append ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_append (GValueArray *value_array,
Packit ae235b
                      const GValue *value);
Packit ae235b
Packit ae235b

g_value_array_append has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_append_val() instead.

Packit ae235b
Packit ae235b

Insert a copy of value

Packit ae235b
 as last element of value_array
Packit ae235b
. If value
Packit ae235b
 is
Packit ae235b
NULL, an uninitialized value is appended.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to add an element to

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

value

Packit ae235b

GValue to copy into GValueArray, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the GValueArray passed in as value_array

Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_prepend ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_prepend (GValueArray *value_array,
Packit ae235b
                       const GValue *value);
Packit ae235b
Packit ae235b

g_value_array_prepend has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_prepend_val() instead.

Packit ae235b
Packit ae235b

Insert a copy of value

Packit ae235b
 as first element of value_array
Packit ae235b
. If value
Packit ae235b
 is
Packit ae235b
NULL, an uninitialized value is prepended.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to add an element to

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

value

Packit ae235b

GValue to copy into GValueArray, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the GValueArray passed in as value_array

Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_insert ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_insert (GValueArray *value_array,
Packit ae235b
                      guint index_,
Packit ae235b
                      const GValue *value);
Packit ae235b
Packit ae235b

g_value_array_insert has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_insert_val() instead.

Packit ae235b
Packit ae235b

Insert a copy of value

Packit ae235b
 at specified position into value_array
Packit ae235b
. If value
Packit ae235b
Packit ae235b
is NULL, an uninitialized value is inserted.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to add an element to

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

index_

Packit ae235b

insertion position, must be <= value_array->;n_values

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

value

Packit ae235b

GValue to copy into GValueArray, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the GValueArray passed in as value_array

Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_remove ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_remove (GValueArray *value_array,
Packit ae235b
                      guint index_);
Packit ae235b
Packit ae235b

g_value_array_remove has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_remove_index() instead.

Packit ae235b
Packit ae235b

Remove the value at position index_

Packit ae235b
 from value_array
Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to remove an element from

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

index_

Packit ae235b

position of value to remove, which must be less than

Packit ae235b
value_array->n_values
Packit ae235b

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the GValueArray passed in as value_array

Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_sort ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_sort (GValueArray *value_array,
Packit ae235b
                    GCompareFunc compare_func);
Packit ae235b
Packit ae235b

g_value_array_sort has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_sort().

Packit ae235b
Packit ae235b

Sort value_array

Packit ae235b
 using compare_func
Packit ae235b
 to compare the elements according to
Packit ae235b
the semantics of GCompareFunc.

Packit ae235b

The current implementation uses the same sorting algorithm as standard

Packit ae235b
C qsort() function.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to sort

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

compare_func

Packit ae235b

function to compare elements.

Packit ae235b
[scope call]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the GValueArray passed in as value_array

Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_value_array_sort_with_data ()

Packit ae235b
GValueArray *
Packit ae235b
g_value_array_sort_with_data (GValueArray *value_array,
Packit ae235b
                              GCompareDataFunc compare_func,
Packit ae235b
                              gpointer user_data);
Packit ae235b
Packit ae235b

g_value_array_sort_with_data has been deprecated since version 2.32 and should not be used in newly-written code.

Packit ae235b

Use GArray and g_array_sort_with_data().

Packit ae235b
Packit ae235b

Sort value_array

Packit ae235b
 using compare_func
Packit ae235b
 to compare the elements according
Packit ae235b
to the semantics of GCompareDataFunc.

Packit ae235b

The current implementation uses the same sorting algorithm as standard

Packit ae235b
C qsort() function.

Packit ae235b

[rename-to g_value_array_sort]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

value_array

Packit ae235b

GValueArray to sort

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

compare_func

Packit ae235b

function to compare elements.

Packit ae235b
[scope call]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

extra data argument provided for compare_func

Packit ae235b
. 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the GValueArray passed in as value_array

Packit ae235b
. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

struct GValueArray

Packit ae235b
struct GValueArray {
Packit ae235b
  guint   n_values;
Packit ae235b
  GValue *values;
Packit ae235b
};
Packit ae235b
Packit ae235b

A GValueArray contains an array of GValue elements.

Packit ae235b
Packit ae235b

Members

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

guint n_values;

Packit ae235b

number of values contained in the array

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

GValue *values;

Packit ae235b

array of values

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

See Also

Packit ae235b

GValue, GParamSpecValueArray, g_param_spec_value_array()

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>