gconfmm 2.28.3

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | Related Functions
Gnome::Conf::Value Class Reference

Wrapper for primitive types. More...

Collaboration diagram for Gnome::Conf::Value:
[legend]

List of all members.

## Public Member Functions
| Value (GConfValue* castitem, bool make_a_copy=false)
| Value (const Value& src)
Value& | operator= (const Value& src)
| ~Value ()
GConfValue* | gobj ()
const GConfValue* | gobj () const
GConfValue* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| Value (ValueType type=VALUE_INVALID)
| Create a Value.
void | set (gint val)
| Set the integer value of a Value whose type is VALUE_INT.
void | set (gdouble val)
| Set the float value of a Value whose type is VALUE_FLOAT.
void | set (bool val)
| Set the boolean value of a Value whose type is VALUE_BOOL.
void | set (const Schema& sc)
| Set the Schema of a Value whose type is VALUE_SCHEMA.
void | set_car (const Value& car)
| Set the car (in a pair, the first element) of a Value whose type is VALUE_PAIR.
void | set_cdr (const Value& cdr)
| Set the cdr (in a pair, the second element) of a Value whose type is VALUE_PAIR.
void | set (const Glib::ustring& val)
| Set the string of a Value whose type is VALUE_STRING.
void | set_list_type (ValueType type)
| Sets the type of the elements of a Value with type VALUE_LIST.
void | set_int_list (const SListHandle_ValueInt& list)
| Sets the Value to contain a list of integers.
void | set_bool_list (const SListHandle_ValueBool& list)
| Sets the Value to contain a list of bools.
void | set_float_list (const SListHandle_ValueFloat& list)
| Sets the Value to contain a list of doubles.
void | set_string_list (const SListHandle_ValueString& list)
| Sets the Value to contain a list of strings.
void | set_schema_list (const SListHandle_ValueSchema& list)
| Sets the Value to contain a list of Schema.
ValueType | get_type () const
| Get the type of the Value.
ValueType | get_list_type () const
| Get the type of the list elements of the Value.
int | get_int () const
| Get the integer that the Value contains.
bool | get_bool () const
| Get the boolean that the Value contains.
double | get_float () const
| Get the double that the Value contains.
Glib::ustring | get_string () const
| Get the string that the Value contains.
Schema | get_schema () const
| Get a copy of the Schema of the value.
Value | get_car () const
| Get a copy of the car of a VALUE_PAIR Value.
Value | get_cdr () const
| Get a copy of the cdr of a VALUE_PAIR Value.
SListHandle_ValueFloat | get_float_list () const
| Gets a list of doubles from the Value.
SListHandle_ValueInt | get_int_list () const
| Retrieves the list of integers from the Value.
SListHandle_ValueBool | get_bool_list () const
| Retrieves the list of booleans from the Value.
SListHandle_ValueString | get_string_list () const
| Retrieves the list of strings from the Value.
SListHandle_ValueSchema | get_schema_list () const
| Retrieves the list of Schemas from the Value.
Glib::ustring | to_string () const
| Convert the Value to a string.
## Protected Attributes
GConfValue* | gobject_
## Related Functions
(Note that these are not member functions.)
Gnome::Conf::Value | wrap (GConfValue* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Wrapper for primitive types.

This class wraps the primitive types that are passed to and from instances of Gnome::Conf::Client. It has an associated `ValueType`, which is specified at creation time, but can be changed with assignment. If the type is `VALUE_INVALID` then the effect of the set and get methods is undefined. Using a default-constructed Value without using any of the set methods produces undefined behaviour.

Compound Values of type VALUE_PAIR and VALUE_LIST can only have elements whose types are neither VALUE_PAIR or VALUE_LIST - they can only have primitive types.

The Value class has copy-by-value semantics - all arguments to the set methods are copied.

Note that while the type is named VALUE_FLOAT, the accessors for floating-point values use `double`, not `float`, to preserve accuracy.

## Constructor & Destructor Documentation

Gnome::Conf::Value::Value | ( | GConfValue * | castitem,
|  | bool | make_a_copy = `false`
| ) |  | `[explicit]`

Gnome::Conf::Value::Value | ( | const Value& | src | ) |

Gnome::Conf::Value::~Value | ( |  | ) |

Gnome::Conf::Value::Value | ( | ValueType | type = `VALUE_INVALID` | ) |

Create a Value.

You should call a set() method before using the Value.

Parameters:

  type,: | The type of the produced value.

## Member Function Documentation

bool Gnome::Conf::Value::get_bool | ( |  | ) | const

Get the boolean that the Value contains.

SListHandle_ValueBool Gnome::Conf::Value::get_bool_list | ( |  | ) | const

Retrieves the list of booleans from the Value.

See also:
  get_float_list

Value Gnome::Conf::Value::get_car | ( |  | ) | const

Get a copy of the car of a VALUE_PAIR Value.

Value Gnome::Conf::Value::get_cdr | ( |  | ) | const

Get a copy of the cdr of a VALUE_PAIR Value.

double Gnome::Conf::Value::get_float | ( |  | ) | const

Get the double that the Value contains.

SListHandle_ValueFloat Gnome::Conf::Value::get_float_list | ( |  | ) | const

Gets a list of doubles from the Value.

Typical usage is

     std::vector<double> foo = value.get_float_list();

.

Returns:
  : an STL-compatible container with doubles as its value type. Assign to an std::vector, list or deque for proper use.

int Gnome::Conf::Value::get_int | ( |  | ) | const

Get the integer that the Value contains.

SListHandle_ValueInt Gnome::Conf::Value::get_int_list | ( |  | ) | const

Retrieves the list of integers from the Value.

See also:
  get_float_list

ValueType Gnome::Conf::Value::get_list_type | ( |  | ) | const

Get the type of the list elements of the Value.

Do not call this method on non-list Values.

Returns:
  the type of the list elements.

Schema Gnome::Conf::Value::get_schema | ( |  | ) | const

Get a copy of the Schema of the value.

SListHandle_ValueSchema Gnome::Conf::Value::get_schema_list | ( |  | ) | const

Retrieves the list of Schemas from the Value.

get_float_list

Glib::ustring Gnome::Conf::Value::get_string | ( |  | ) | const

Get the string that the Value contains.

SListHandle_ValueString Gnome::Conf::Value::get_string_list | ( |  | ) | const

Retrieves the list of strings from the Value.

See also:
  get_float_list

ValueType Gnome::Conf::Value::get_type | ( |  | ) | const

Get the type of the Value.

Returns:
  the type of the Value

GConfValue* Gnome::Conf::Value::gobj | ( |  | ) | `[inline]`

const GConfValue* Gnome::Conf::Value::gobj | ( |  | ) | const`[inline]`

GConfValue* Gnome::Conf::Value::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

Value& Gnome::Conf::Value::operator= | ( | const Value& | src | ) |

void Gnome::Conf::Value::set | ( | gint | val | ) |

Set the integer value of a Value whose type is VALUE_INT.

void Gnome::Conf::Value::set | ( | gdouble | val | ) |

Set the float value of a Value whose type is VALUE_FLOAT.

Parameters:

  val,: | the `double` this Value will be se to.

void Gnome::Conf::Value::set | ( | bool | val | ) |

Set the boolean value of a Value whose type is VALUE_BOOL.

void Gnome::Conf::Value::set | ( | const Schema& | sc | ) |

Set the Schema of a Value whose type is VALUE_SCHEMA.

void Gnome::Conf::Value::set | ( | const Glib::ustring & | val | ) |

Set the string of a Value whose type is VALUE_STRING.

void Gnome::Conf::Value::set_bool_list | ( | const SListHandle_ValueBool & | list | ) |

Sets the Value to contain a list of bools.

See also:
  set_int_list

void Gnome::Conf::Value::set_car | ( | const Value& | car | ) |

Set the car (in a pair, the first element) of a Value whose type is VALUE_PAIR.

void Gnome::Conf::Value::set_cdr | ( | const Value& | cdr | ) |

Set the cdr (in a pair, the second element) of a Value whose type is VALUE_PAIR.

void Gnome::Conf::Value::set_float_list | ( | const SListHandle_ValueFloat & | list | ) |

Sets the Value to contain a list of doubles.

See also:
  set_int_list

void Gnome::Conf::Value::set_int_list | ( | const SListHandle_ValueInt & | list | ) |

Sets the Value to contain a list of integers.

set_list_type(VALUE_INT) must have been called prior this call.

Parameters:

  list,: | an STL-compatible container whose value_type is `int`

void Gnome::Conf::Value::set_list_type | ( | ValueType | type | ) |

Sets the type of the elements of a Value with type VALUE_LIST.

void Gnome::Conf::Value::set_schema_list | ( | const SListHandle_ValueSchema & | list | ) |

Sets the Value to contain a list of Schema.

See also:
  set_int_list

void Gnome::Conf::Value::set_string_list | ( | const SListHandle_ValueString & | list | ) |

Sets the Value to contain a list of strings.

See also:
  set_int_list

Glib::ustring Gnome::Conf::Value::to_string | ( |  | ) | const

Convert the Value to a string.

The string is not machine-parseable. Do not depend on the format of the string.

## Friends And Related Function Documentation

Gnome::Conf::Value wrap | ( | GConfValue * | 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

GConfValue* Gnome::Conf::Value::gobject_`[protected]`

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

- gconfmm/value.h