Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::G::Value Class Reference

A GValue wrapper class. More...

`#include <xfc/glib/value.hh>`

Inheritance diagram for Xfc::G::Value:

List of all members.

## Public Member Functions

Constructors

- Value ()
    Construct an uninitialized Value that can be passed to a constructor or method.
- Value (GType type)
    Construct a Value to hold a value of type.
- Value (GParamSpec *pspec)
    Construct a Value from the value type of a GParamSpec structure.
- Value (GValue *value)
    Construct a temporary Value to hold an existing GValue.
- Value (GValue *value, bool copy)
    Construct a Value to hold an existing GValue.
- Value (const Value &src)
    Copy constructor.
- ~Value ()
    Destructor.
- Value & operator= (const Value &src)
    Assignment operator.

Accessors

- GValue * g_value () const
    Get a pointer to the GValue structure.
- operator GValue * () const
    Conversion operator; get a pointer to the GValue structure.
- bool is_valid () const
    Returns true if the Value holds a valid initialized GValue.
- GType type () const
    Get the type identifier of the value the Value holds.
- String type_name () const
    Returns the type name of the value.
- bool holds (GType type) const
    Returns true if the Value holds a value of type.
- bool equal (const Value &other) const
    Returns true if the Value and other hold the same value.
- bool operator== (const Value &other) const
    Returns true if the Value and other hold the same value.
- bool operator!= (const Value &other) const
    Returns true if the Value and other do not hold the same value.
- void get (bool &value) const
    Get a boolean value.
- void get (gchar &value) const
    Get a char value.
- void get (guchar &value) const
    Get an unsigned char value.
- void get (gint &value) const
    Get an integer value.
- void get (guint &value) const
    Get an unsigned integer value.
- void get (gint64 &value) const
    Get a 64-bit integer value.
- void get (guint64 &value) const
    Get an unsigned 64-bit integer value.
- void get (gfloat &value) const
    Get a float value.
- void get (gdouble &value) const
    Get an double value.
- bool get (gpointer &value, bool wrap=false) const
    Get a pointer value.
- bool get (String &value) const
    Get a String value.
- bool get (Boxed *&value) const
    Get a Boxed value.
- bool get (G::Object *&value) const
    Get an Object value.
- template<typename ObjectType> bool get (Pointer< ObjectType > &value) const
    Get a G::Boxed or G::Object smart pointer value.

Methods

- void set (bool value)
    Set a boolean value.
- void set (gchar value)
    Set a char value.
- void set (guchar value)
    Set an unsigned char value.
- void set (gint value)
    Set an integer value.
- void set (guint value)
    Set an unsigned integer value.
- void set (gint64 value)
    Set a 64-bit integer value.
- void set (guint64 value)
    Set an unsigned 64-bit integer value.
- void set (gfloat value)
    Set a float value.
- void set (gdouble value)
    Set a double value.
- void set (const gpointer value, bool wrapped=false)
    Set a pointer value.
- void set (const String &value)
    Set a String value.
- void set (const Boxed *value)
    Set a boxed value.
- void set (const G::Object *value)
    Set an object value.
- template<typename ObjectType> void set (const Pointer< ObjectType > &value)
    Set a G::Boxed or G::Object smart pointer value.

## Detailed Description

A GValue wrapper class.

Value wraps the GValue structure which is basically a variable container that consists of a type identifier and a specific value of that type. The type identifier within a GValue structure determines the type of the associated value.

Values are used throughout the XFC API to set and get property values. You don't have to initialize a Value before using it. The constructor initializes the Value for you. Normally you would create a Value on the stack and pass a pointer or reference to it, to a constructor or method as required.

## Constructor & Destructor Documentation

Xfc::G::Value::Value | ( | GType | type | ) | `[explicit]`

Construct a Value to hold a value of type.

Parameters:

  | type | The type identifier of the value.

Xfc::G::Value::Value | ( | GValue * | value | ) | `[explicit]`

Construct a temporary Value to hold an existing GValue.

Parameters:

  | value | An existing GValue structure.

Value does not take over ownership of the GValue, no copy is made and the GValue is not freed.

Xfc::G::Value::Value | ( | GValue * | value,
|  | bool | copy
| ) |

Construct a Value to hold an existing GValue.

Parameters:

  | value | An existing GValue structure.
  | copy | Set true if the Value should make a copy of value and use that, set false if it should take over ownership of the value.

Value either makes a copy of the GValue or takes over its ownership. When the Value is destroyed the GValue freed.

## Member Function Documentation

template<typename ObjectType>
bool Xfc::G::Value::get | ( | Pointer< ObjectType > & | value | ) | const`[inline]`

Get a G::Boxed or G::Object smart pointer value.

Parameters:

  | value | A reference to the location that will hold the smart pointer value.

Returns:
  false if a null pointer is returned.

bool Xfc::G::Value::get | ( | G::Object *& | value | ) | const

Get an Object value.

Parameters:

  | value | A reference to the location that will hold the G::Object value.

Returns:
  false if a null pointer is returned.

bool Xfc::G::Value::get | ( | Boxed *& | value | ) | const

Get a Boxed value.

Parameters:

  | value | A reference to the location that will hold the G::Boxed value.

Returns:
  false if a null pointer is returned.

You will need to call unref() on the boxed object when finished.

bool Xfc::G::Value::get | ( | String & | value | ) | const

Get a String value.

Parameters:

  | value | A reference to the location that will hold the String value.

Returns:
  false if a null String is returned.

bool Xfc::G::Value::get | ( | gpointer & | value,
|  | bool | wrap = `false`
| ) | const

Get a pointer value.

Parameters:

  | value | A reference to the location that will hold the pointer value.
  | wrap | Set true if the pointer is a G::Boxed or G::Object type and should be wrapped.

Returns:
  false if a null pointer is returned.

This method gets values of type G_TYPE_BOXED, G_TYPE_OBJECT and G_TYPE_POINTER.

void Xfc::G::Value::get | ( | gdouble & | value | ) | const

Get an double value.

Parameters:

  | value | A reference to the location that will hold the double value.

void Xfc::G::Value::get | ( | gfloat & | value | ) | const

Get a float value.

Parameters:

  | value | A reference to the location that will hold the float value.

void Xfc::G::Value::get | ( | guint64 & | value | ) | const

Get an unsigned 64-bit integer value.

Parameters:

  | value | A reference to the location that will hold the unsigned 64-bit integer value.

void Xfc::G::Value::get | ( | gint64 & | value | ) | const

Get a 64-bit integer value.

Parameters:

  | value | A reference to the location that will hold the 64-bit integer value.

void Xfc::G::Value::get | ( | guint & | value | ) | const

Get an unsigned integer value.

Parameters:

  | value | A reference to the location that will hold the unsigned integer value.

This method gets values of type G_TYPE_UINT or G_TYPE_FLAGS.

void Xfc::G::Value::get | ( | gint & | value | ) | const

Get an integer value.

Parameters:

  | value | A reference to the location that will hold the integer value.

This method gets values of type G_TYPE_INT and G_TYPE_ENUM.

void Xfc::G::Value::get | ( | guchar & | value | ) | const

Get an unsigned char value.

Parameters:

  | value | A reference to the location that will hold the unsigned char value.

void Xfc::G::Value::get | ( | gchar & | value | ) | const

Get a char value.

Parameters:

  | value | A reference to the location that will hold the char value.

void Xfc::G::Value::get | ( | bool & | value | ) | const

Get a boolean value.

Parameters:

  | value | A reference to the location that will hold the boolean value.

template<typename ObjectType>
void Xfc::G::Value::set | ( | const Pointer< ObjectType > & | value | ) | `[inline]`

Set a G::Boxed or G::Object smart pointer value.

Parameters:

  | value | The smart pointer value to set.

void Xfc::G::Value::set | ( | const G::Object * | value | ) |

Set an object value.

Parameters:

  | value | The G::Object value to set.

void Xfc::G::Value::set | ( | const Boxed * | value | ) |

Set a boxed value.

Parameters:

  | value | The G::Boxed value to set.

void Xfc::G::Value::set | ( | const String & | value | ) |

Set a String value.

Parameters:

  | value | The String value to set.

void Xfc::G::Value::set | ( | const gpointer | value,
|  | bool | wrapped = `false`
| ) |

Set a pointer value.

Parameters:

  | value | The pointer value to set.
  | wrapped | Set true if the pointer is a G::Boxed or G::Object type.

This method sets values of type G_TYPE_BOXED, G_TYPE_OBJECT and G_TYPE_POINTER.

void Xfc::G::Value::set | ( | gdouble | value | ) |

Set a double value.

Parameters:

  | value | The double value to set.

void Xfc::G::Value::set | ( | gfloat | value | ) |

Set a float value.

Parameters:

  | value | The float value to set.

void Xfc::G::Value::set | ( | guint64 | value | ) |

Set an unsigned 64-bit integer value.

Parameters:

  | value | The unsigned 64-bit integer value to set.

void Xfc::G::Value::set | ( | gint64 | value | ) |

Set a 64-bit integer value.

Parameters:

  | value | The 64-bit integer value to set.

void Xfc::G::Value::set | ( | guint | value | ) |

Set an unsigned integer value.

Parameters:

  | value | The unsigned integer value to set.

This method sets values of type G_TYPE_UINT and G_TYPE_FLAGS.

void Xfc::G::Value::set | ( | gint | value | ) |

Set an integer value.

Parameters:

  | value | The integer value to set.

This method sets values of type G_TYPE_INT and G_TYPE_ENUM.

void Xfc::G::Value::set | ( | guchar | value | ) |

Set an unsigned char value.

Parameters:

  | value | The unsigned char value to set.

void Xfc::G::Value::set | ( | gchar | value | ) |

Set a char value.

Parameters:

  | value | The char value to set.

void Xfc::G::Value::set | ( | bool | value | ) |

Set a boolean value.

Parameters:

  | value | The boolean value to set.

The documentation for this class was generated from the following file:

- libXFCcore/xfc/glib/value.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3