Reference Manual

Inti Logo
Main Page | Namespace List | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Inti::GConf::Value Class Reference

A GConfValue C++ wrapper class. More...

#include <inti/gconf/value.h>

List of all members.

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A GConfValue C++ wrapper class.

Value stores one of the value types GConf understands; GConf uses GConf::Value to pass values around because it doesn't know the type of its values at compile time. A Value should always be initialized before use. That is, you should not use a Value unless you have called one of the "setter" functions.


Constructor & Destructor Documentation

Inti::GConf::Value::Value ValueType  type  ) 
 

Constructs a new Value with the specified type.

Parameters:
type The type of the new Value.

The type is immutable after construction; values have a fixed type. You must initialize the Value after creation; that is, you must set its value with one of the "setter" functions.

Inti::GConf::Value::Value ValueType  type,
const String &  value_str,
G::Error *  error = 0
 

Constructs a new Value with the specified type and value.

Parameters:
type The type of the new Value.
value_str A string that specifies the value; must be an int, bool, double or string.
error A G::Error object, or null to ignore errors.

This constructor is for convenience. It only works on simple types (int, bool, float and String). The value passed as a string is converted into a value of the specified type. The bool value can be true/false, 1/0, or yes/no and is not case sensitive.


Member Function Documentation

Value Inti::GConf::Value::get_car  )  const
 

Get the first member (car) of a Value with type GCONF_VALUE_PAIR.

Returns:
A Value object.

The car is another Value, with a primitive type (bool, int, float, String, Schema).

Value Inti::GConf::Value::get_cdr  )  const
 

Get the second member (cdr) of a Value with type GCONF_VALUE_PAIR.

Returns:
A Value object.

The cdr is another Value, with a primitive type (bool, int, float, String, Schema).

bool Inti::GConf::Value::get_list std::vector< Schema > &  list  )  const
 

Requests the list (VALUE_SCHEMA) stored in the Value.

Parameters:
list A reference to a vector of Schema, to hold the list elements.
Returns:
true on success, false if an error occurs.

bool Inti::GConf::Value::get_list std::vector< String > &  list  )  const
 

Requests the list (VALUE_STRING) stored in the Value.

Parameters:
list A reference to a vector of String, to hold the list elements.
Returns:
true on success, false if an error occurs.

bool Inti::GConf::Value::get_list std::vector< double > &  list  )  const
 

Requests the list (VALUE_FLOAT) stored in the Value.

Parameters:
list A reference to a vector of double, to hold the list elements.
Returns:
true on success, false if an error occurs.

bool Inti::GConf::Value::get_list std::vector< bool > &  list  )  const
 

Requests the list (VALUE_BOOL) stored in the Value.

Parameters:
list A reference to a vector of bool, to hold the list elements.
Returns:
true on success, false if an error occurs.

bool Inti::GConf::Value::get_list std::vector< int > &  list  )  const
 

Requests the list (VALUE_INT) stored in the Value.

Parameters:
list A reference to a vector of int, to hold the list elements.
Returns:
true on success, false if an error occurs.

Schema Inti::GConf::Value::get_schema  )  const
 

Get a Schema for a Value with type VALUE_SCHEMA.

If the Value is uninitialized, it may return null; but of course you should have initialized the Value. The GConf library will not return values with a null schema.

String Inti::GConf::Value::get_string  )  const
 

Get a String for a Value with type VALUE_STRING.

If the Value is not initialized (i.e. no one has called set_string()) then the string may be null, but of course you should not try to use an uninitialized Value.

void Inti::GConf::Value::set_bool bool  value  ) 
 

Sets the bool value of a Value with type VALUE_BOOL.

Parameters:
value The new boolean value.

void Inti::GConf::Value::set_car const Value car  ) 
 

Sets the value of the first field (car) of a Value with type VALUE_PAIR.

Parameters:
car A reference to a Value object.

void Inti::GConf::Value::set_cdr const Value cdr  ) 
 

Sets the value of the second field (cdr) of a Value with type VALUE_PAIR.

Parameters:
cdr A reference to a Value object.

void Inti::GConf::Value::set_float double  value  ) 
 

Sets the double value of a Value with type VALUE_FLOAT.

Parameters:
value The new float value.

void Inti::GConf::Value::set_int int  value  ) 
 

Sets the integer value of a Value with type VALUE_INT.

Parameters:
value The new integer value.

void Inti::GConf::Value::set_list std::vector< Schema > &  list  ) 
 

Sets the list (VALUE_SCHEMA) for the value.

Parameters:
list A reference to a vector of Schema that contains the list elements.

void Inti::GConf::Value::set_list std::vector< String > &  list  ) 
 

Sets the list (VALUE_STRING) for the value.

Parameters:
list A reference to a vector of String that contains the list elements.

void Inti::GConf::Value::set_list std::vector< double > &  list  ) 
 

Sets the list (VALUE_FLOAT) for the value.

Parameters:
list A reference to a vector of float that contains the list elements.

void Inti::GConf::Value::set_list std::vector< bool > &  list  ) 
 

Sets the list (VALUE_BOOL) for the value.

Parameters:
list A reference to a vector of bool that contains the list elements.

void Inti::GConf::Value::set_list std::vector< int > &  list  ) 
 

Sets the list (VALUE_INT) for the value.

Parameters:
list A reference to a vector of int that contains the list elements.

void Inti::GConf::Value::set_schema const Schema sc  ) 
 

Sets the Schema value of a Value with type VALUE_SCHEMA.

Parameters:
sc The new Schema value.

void Inti::GConf::Value::set_string const String &  str  ) 
 

Sets the String value of a Value with type VALUE_STRING.

Parameters:
str The new String value.

String Inti::GConf::Value::to_string  ) 
 

Creates a human-readable string representation of a Value.

Returns:
A String representing the value.

This is intended for debugging and the like; the string representation is not suitable for reliable machine parsing (that is, you shouldn't use this function to save a value to a file or anything like that). The exact nature of the string representation may change in future versions.


The documentation for this class was generated from the following file: Main Page - Footer


Generated on Sun Sep 14 23:52:41 2003 for Inti-GConf by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002