glibmm: Glib::ValueArray Class Reference
A container structure to maintain an array of generic values. More...
#include <glibmm/valuearray.h>
Public Types | |
| typedef sigc::slot< int, const Glib::ValueBase&, const Glib::ValueBase& > | SlotCompare |
| For example, int on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2);. | |
Public Member Functions | |
| ValueArray (GValueArray* gobject, bool make_a_copy=true) | |
| ValueArray (const ValueArray& other) | |
| ValueArray& | operator= (const ValueArray& other) |
| ~ValueArray () | |
| void | swap (ValueArray& other) |
| GValueArray* | gobj () |
| Provides access to the underlying C instance. | |
| const GValueArray* | gobj () const |
| Provides access to the underlying C instance. | |
| GValueArray* | gobj_copy () const |
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. | |
| ValueArray () | |
| Default constructor. | |
| ValueArray (guint n_preallocated) | |
| Constructs a new array with pre-allocation. | |
| bool | get_nth (guint index, Glib::ValueBase&value) |
| Return the value at index contained in the value array. | |
| Glib::ValueArray& | append (const Glib::ValueBase&value) |
| Glib::ValueArray& | prepend (const Glib::ValueBase&value) |
| Glib::ValueArray& | insert (guint index, const Glib::ValueBase&value) |
| Glib::ValueArray& | remove (guint index) |
| Glib::ValueArray& | sort (const SlotCompare& compare_func) |
Protected Attributes | |
| GValueArray* | gobject_ |
Related Functions | |
(Note that these are not member functions.) | |
| void | swap (ValueArray& lhs, ValueArray& rhs) |
| Glib::ValueArray | wrap (GValueArray* object, bool take_copy=false) |
| A Glib::wrap() method for this object. | |
Detailed Description
A container structure to maintain an array of generic values.
The prime purpose of a ValueArray is for it to be used as an object property that holds an array of values. A ValueArray wraps an array of ValueBase elements.
Member Typedef Documentation
| typedef sigc::slot<int, const Glib::ValueBase&, const Glib::ValueBase&> Glib::ValueArray::SlotCompare |
For example, int on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2);.
The compare function should return -1 if v1 < v2, 0 if v1 == v2, and 1 if v1 > v2.
Constructor & Destructor Documentation
| Glib::ValueArray::ValueArray | ( | GValueArray * | gobject, |
| bool | make_a_copy = true |
||
| ) | [explicit] |
| Glib::ValueArray::ValueArray | ( | const ValueArray& | other | ) |
| Glib::ValueArray::~ValueArray | ( | ) |
| Glib::ValueArray::ValueArray | ( | ) |
Default constructor.
Constructs a new array with no pre-allocation.
| Glib::ValueArray::ValueArray | ( | guint | n_preallocated | ) |
Constructs a new array with pre-allocation.
Member Function Documentation
| Glib::ValueArray& Glib::ValueArray::append | ( | const Glib::ValueBase& | value | ) |
| bool Glib::ValueArray::get_nth | ( | guint | index, |
| Glib::ValueBase& | value | ||
| ) |
Return the value at index contained in the value array.
- Parameters:
-
index Index of the value of interest. value An uninitialized ValueBase in which to store the result. If the get is successful, value will be valid, otherwise it will remain uninitialized.
- Returns:
- whether the get was successful or not.
| const GValueArray* Glib::ValueArray::gobj | ( | ) | const [inline] |
Provides access to the underlying C instance.
| GValueArray* Glib::ValueArray::gobj | ( | ) | [inline] |
Provides access to the underlying C instance.
| GValueArray* Glib::ValueArray::gobj_copy | ( | ) | const |
Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| Glib::ValueArray& Glib::ValueArray::insert | ( | guint | index, |
| const Glib::ValueBase& | value | ||
| ) |
| ValueArray& Glib::ValueArray::operator= | ( | const ValueArray& | other | ) |
| Glib::ValueArray& Glib::ValueArray::prepend | ( | const Glib::ValueBase& | value | ) |
| Glib::ValueArray& Glib::ValueArray::remove | ( | guint | index | ) |
| Glib::ValueArray& Glib::ValueArray::sort | ( | const SlotCompare& | compare_func | ) |
| void Glib::ValueArray::swap | ( | ValueArray& | other | ) |
Friends And Related Function Documentation
| void swap | ( | ValueArray& | lhs, |
| ValueArray& | rhs | ||
| ) | [related] |
- Parameters:
-
lhs The left-hand side rhs The right-hand side
| Glib::ValueArray wrap | ( | GValueArray * | object, |
| bool | take_copy = false |
||
| ) | [related] |
A Glib::wrap() method for this object.
- Parameters:
-
object The C instance. take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- Returns:
- A C++ instance that wraps this C instance.
Member Data Documentation
GValueArray* Glib::ValueArray::gobject_ [protected] |
