libgdamm: Gnome::Gda::Holder Class Reference

libgdamm 4.99.5

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

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

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Gnome::Gda::Holder Class Reference
Data Handlers

Container for a single Gda::Value. More...

Inheritance diagram for Gnome::Gda::Holder:
[legend]
Collaboration diagram for Gnome::Gda::Holder:
[legend]

List of all members.

## Public Member Functions
virtual | ~Holder ()
GdaHolder* | gobj ()
| Provides access to the underlying C GObject.
const GdaHolder* | gobj () const
| Provides access to the underlying C GObject.
GdaHolder* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Holder > | copy () const
| Copy constructor.
GType | get_g_type () const
| Get holder's type.
Glib::ustring | get_id () const
| Get the ID of holder.
Value | get_value () const
| Get the value held into the holder.
Glib::ustring | get_value_str (const Glib::RefPtr< DataHandler >& dh) const
| Same functionality as get_value() except that it returns the value as a string (the conversion is done using dh if not `0`, or the default data handler otherwise).
bool | set_value_as_value (const Value&value)
| Sets the value within the holder.
template<class ValueType >
bool | set_value (const ValueType&value)
bool | set_value_str (const Glib::RefPtr< DataHandler >& dh, const Glib::ustring&value)
| Same functionality as set_value() except that it uses a string representation of the value to set, which will be converted into a GValue first (using default data handler if dh is `0`).
bool | take_value (const Value&value)
| Sets the value within the holder.
Value | take_static_value (const Value&value, bool& value_changed)
| Sets the const value within the holder.
void | set_attribute (const Glib::ustring& attribute, const Value&value)
Value | get_attribute (const Glib::ustring& attribute) const
| Get the value associated to a named attribute.
Value | get_default_value () const
| Get the default value held into the holder.
void | set_default_value (const Value&value)
| Sets the default value within the holder.
bool | set_value_to_default ()
| Set holder's value to its default value.
bool | value_is_default () const
| Tells if holder's current value is the default one.
void | force_invalid ()
| Forces a holder to be invalid; to set it valid again, a new value must be assigned to it using set_value() or take_value().
bool | is_valid () const
| Get the validity of holder (that is, of the value held by holder)
void | set_not_null (bool not_null=true)
| Sets if the holder can have a `0` value.
bool | get_not_null () const
| Get wether the holder can be `0` or not.
Glib::RefPtr< DataModel > | get_source_model (int& col)
| If set_source_model() has been used to provide a hint that holder's value should be among the values contained in a column of a data model, then this method returns which data model, and if col is not `0`, then it is set to the restricting column as well.
Glib::RefPtr< const DataModel > | get_source_model (int& col) const
| If set_source_model() has been used to provide a hint that holder's value should be among the values contained in a column of a data model, then this method returns which data model, and if col is not `0`, then it is set to the restricting column as well.
bool | set_source_model (const Glib::RefPtr< DataModel >& model, int col)
| Sets an hint that holder's values should be restricted among the values contained in the col column of the model data model.
void | set_bind (const Glib::RefPtr< Holder >& bind_to)
| Sets holder to change when bind_to changes (and does not make bind_to change when holder changes).
Glib::RefPtr< Holder > | get_bind ()
| Get the holder which makes holder change its value when the holder's value is changed.
Glib::RefPtr< const Holder > | get_bind () const
| Get the holder which makes holder change its value when the holder's value is changed.
Glib::PropertyProxy < Glib::ustring > | property_description ()
| Holder's description.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_description () const
| Holder's description.
Glib::PropertyProxy < Glib::RefPtr< Holder > > | property_full_bind ()
| Make value holder follow other GdaHolder's changes and the other way around.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< Holder > > | property_full_bind () const
| Make value holder follow other GdaHolder's changes and the other way around.
Glib::PropertyProxy< gulong > | property_g_type ()
| Holder's GType.
Glib::PropertyProxy_ReadOnly < gulong > | property_g_type () const
| Holder's GType.
Glib::PropertyProxy < Glib::ustring > | property_id ()
| Holder's ID.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_id () const
| Holder's ID.
Glib::PropertyProxy < Glib::ustring > | property_name ()
| Holder's name.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_name () const
| Holder's name.
Glib::PropertyProxy< bool > | property_not_null ()
| Can the value holder be NULL?.
Glib::PropertyProxy_ReadOnly < bool > | property_not_null () const
| Can the value holder be NULL?.
Glib::PropertyProxy < Glib::RefPtr< Holder > > | property_simple_bind ()
| Make value holder follow other GdaHolder's changes.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< Holder > > | property_simple_bind () const
| Make value holder follow other GdaHolder's changes.
Glib::PropertyProxy< int > | property_source_column ()
| Column number to use in coordination with the source-model property.
Glib::PropertyProxy_ReadOnly< int > | property_source_column () const
| Column number to use in coordination with the source-model property.
Glib::PropertyProxy < Glib::RefPtr< DataModel > > | property_source_model ()
| Data model among which the holder's value should be.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< DataModel > > | property_source_model () const
| Data model among which the holder's value should be.
Glib::SignalProxy0< void > | signal_changed ()
Glib::SignalProxy0< void > | signal_source_changed ()
Glib::SignalProxy1 < Glib::Error, const Value& > | signal_validate_change ()
Glib::SignalProxy2< void, const Glib::ustring &, const Value& > | signal_attribute_changed ()
## Static Public Member Functions
static Glib::RefPtr< Holder > | create (GType g_type, const Glib::ustring& id)
## Protected Member Functions
| Holder (GType g_type, const Glib::ustring& id)
virtual void | on_changed ()
virtual void | on_source_changed ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gnome::Gda::Holder > | wrap (GdaHolder* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Container for a single Gda::Value.

The GdaHolder is a container for a single Gda::Value value. It also specifies various attributes of the contained value (default value, ...)

## Constructor & Destructor Documentation

virtual Gnome::Gda::Holder::~Holder | ( |  | ) | `[virtual]`

Gnome::Gda::Holder::Holder | ( | GType | g_type,
|  | const Glib::ustring & | id
| ) |  | `[protected]`

## Member Function Documentation

Glib::RefPtr<Holder> Gnome::Gda::Holder::copy | ( |  | ) | const

Copy constructor.

Note:
  if orig is set with a static value (see take_static_value()) its copy will have a fresh new allocated GValue, so that user should free it when done.

Returns:
  A new Gda::Holder object.

static Glib::RefPtr<Holder> Gnome::Gda::Holder::create | ( | GType | g_type,
|  | const Glib::ustring & | id
| ) |  | `[static]`

void Gnome::Gda::Holder::force_invalid | ( |  | ) |

Forces a holder to be invalid; to set it valid again, a new value must be assigned to it using set_value() or take_value().

holder's value is set to `0`.

Value Gnome::Gda::Holder::get_attribute | ( | const Glib::ustring & | attribute | ) | const

Get the value associated to a named attribute.

Attributes can have any name, but Libgda proposes some default names, see this section.

Parameters:

  attribute | Attribute name as a string.

Returns:
  A read-only Value, or `0` if not attribute named attribute has been set for holder.

Glib::RefPtr<Holder> Gnome::Gda::Holder::get_bind | ( |  | ) |

Get the holder which makes holder change its value when the holder's value is changed.

Returns:
  The Gda::Holder or `0`.

Glib::RefPtr<const Holder> Gnome::Gda::Holder::get_bind | ( |  | ) | const

Get the holder which makes holder change its value when the holder's value is changed.

Returns:
  The Gda::Holder or `0`.

Value Gnome::Gda::Holder::get_default_value | ( |  | ) | const

Get the default value held into the holder.

WARNING: the default value does not need to be of the same type as the one required by holder.

Returns:
  The default value.

GType Gnome::Gda::Holder::get_g_type | ( |  | ) | const

Get holder's type.

Returns:
  The data type.

Glib::ustring Gnome::Gda::Holder::get_id | ( |  | ) | const

Get the ID of holder.

The ID can be set using holder's "id" property

Returns:
  The ID (don't modify the string).

bool Gnome::Gda::Holder::get_not_null | ( |  | ) | const

Get wether the holder can be `0` or not.

Returns:
  `true` if the holder cannot be `0`.

Glib::RefPtr<DataModel> Gnome::Gda::Holder::get_source_model | ( | int & | col | ) |

If set_source_model() has been used to provide a hint that holder's value should be among the values contained in a column of a data model, then this method returns which data model, and if col is not `0`, then it is set to the restricting column as well.

Otherwise, this method returns `0`, and if col is not `0`, then it is set to 0.

Parameters:

  col | A place to store the column in the model sourcing the holder, or `0`.

Returns:
  A pointer to a Gda::DataModel, or `0`.

Glib::RefPtr<const DataModel> Gnome::Gda::Holder::get_source_model | ( | int & | col | ) | const

If set_source_model() has been used to provide a hint that holder's value should be among the values contained in a column of a data model, then this method returns which data model, and if col is not `0`, then it is set to the restricting column as well.

Otherwise, this method returns `0`, and if col is not `0`, then it is set to 0.

Parameters:

  col | A place to store the column in the model sourcing the holder, or `0`.

Returns:
  A pointer to a Gda::DataModel, or `0`.

Value Gnome::Gda::Holder::get_value | ( |  | ) | const

Get the value held into the holder.

If holder is set to use its default value and that default value is not of the same type as holder, then `0` is returned.

If holder is set to `0`, then the returned value is a Gda::TYPE_<tt>0 GValue.

Returns:
  The value, or `0`.

Glib::ustring Gnome::Gda::Holder::get_value_str | ( | const Glib::RefPtr< DataHandler >& | dh | ) | const

Same functionality as get_value() except that it returns the value as a string (the conversion is done using dh if not `0`, or the default data handler otherwise).

Parameters:

  dh | A Gda::DataHandler to use, or `0`.

Returns:
  The value, or `0`.

const GdaHolder* Gnome::Gda::Holder::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaHolder* Gnome::Gda::Holder::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaHolder* Gnome::Gda::Holder::gobj_copy | ( |  | ) |

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

bool Gnome::Gda::Holder::is_valid | ( |  | ) | const

Get the validity of holder (that is, of the value held by holder)

Returns:
  `true` if holder's value can safely be used.

virtual void Gnome::Gda::Holder::on_changed | ( |  | ) | `[protected, virtual]`

virtual void Gnome::Gda::Holder::on_source_changed | ( |  | ) | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gnome::Gda::Holder::property_description | ( |  | ) | const

Holder's description.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gnome::Gda::Holder::property_description | ( |  | ) |

Holder's description.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<Holder> > Gnome::Gda::Holder::property_full_bind | ( |  | ) |

Make value holder follow other GdaHolder's changes and the other way around.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Holder> > Gnome::Gda::Holder::property_full_bind | ( |  | ) | const

Make value holder follow other GdaHolder's changes and the other way around.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<gulong> Gnome::Gda::Holder::property_g_type | ( |  | ) |

Holder's GType.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<gulong> Gnome::Gda::Holder::property_g_type | ( |  | ) | const

Holder's GType.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gnome::Gda::Holder::property_id | ( |  | ) |

Holder's ID.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gnome::Gda::Holder::property_id | ( |  | ) | const

Holder's ID.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gnome::Gda::Holder::property_name | ( |  | ) | const

Holder's name.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gnome::Gda::Holder::property_name | ( |  | ) |

Holder's name.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gnome::Gda::Holder::property_not_null | ( |  | ) |

Can the value holder be NULL?.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gnome::Gda::Holder::property_not_null | ( |  | ) | const

Can the value holder be NULL?.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<Holder> > Gnome::Gda::Holder::property_simple_bind | ( |  | ) |

Make value holder follow other GdaHolder's changes.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Holder> > Gnome::Gda::Holder::property_simple_bind | ( |  | ) | const

Make value holder follow other GdaHolder's changes.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gnome::Gda::Holder::property_source_column | ( |  | ) | const

Column number to use in coordination with the source-model property.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gnome::Gda::Holder::property_source_column | ( |  | ) |

Column number to use in coordination with the source-model property.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > Gnome::Gda::Holder::property_source_model | ( |  | ) | const

Data model among which the holder's value should be.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<DataModel> > Gnome::Gda::Holder::property_source_model | ( |  | ) |

Data model among which the holder's value should be.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gnome::Gda::Holder::set_attribute | ( | const Glib::ustring & | attribute,
|  | const Value& | value
| ) |  |

void Gnome::Gda::Holder::set_bind | ( | const Glib::RefPtr< Holder >& | bind_to | ) |

Sets holder to change when bind_to changes (and does not make bind_to change when holder changes).

For the operation to succeed, the GType of holder and bind_to must be the same, with the exception that any of them can have a Gda::TYPE_<tt>0 type (in this situation, the GType of the two Gda::Holder objects involved is set to match the other when any of them sets its type to something different than GDA_TYPE_`0`).

If bind_to is `0`, then holder will not be bound anymore.

Parameters:

  bind_to | A Gda::Holder or `0`.

Returns:
  `true` if no error occurred.

void Gnome::Gda::Holder::set_default_value | ( | const Value& | value | ) |

Sets the default value within the holder.

If value is `0` then holder won't have a default value anymore. To set a default value to `0`, then pass a Value created using gda_value_new_null().

NOTE: the default value does not need to be of the same type as the one required by holder.

Parameters:

  value | A value to set the holder's default value, or `0`.

void Gnome::Gda::Holder::set_not_null | ( | bool | not_null = `true` | ) |

Sets if the holder can have a `0` value.

If not_null is `true`, then that won't be allowed

Parameters:

  not_null | `true` if holder should not accept `0` values.

bool Gnome::Gda::Holder::set_source_model | ( | const Glib::RefPtr< DataModel >& | model,
|  | int | col
| ) |  |

Sets an hint that holder's values should be restricted among the values contained in the col column of the model data model.

Note that this is just a hint, meaning this policy is not enforced by holder's implementation.

Parameters:

  model | A Gda::DataModel object or `0`.
  col | The reference column in model.

Returns:
  `true` if no error occurred.

template <class ValueType >

bool Gnome::Gda::Holder::set_value | ( | const ValueType & | value | ) |

bool Gnome::Gda::Holder::set_value_as_value | ( | const Value& | value | ) |

Sets the value within the holder.

If holder is an alias for another holder, then the value is also set for that other holder.

On success, the action of any call to force_invalid() is cancelled as soon as this method is called (even if holder's value does not actually change)

If the value is not different from the one already contained within holder, then holder is not changed and no signal is emitted.

Note:
  the value argument is treated the same way if it is `0` or if it is a Gda::TYPE_<tt>0 value
  if holder can't accept the value value, then this method returns `false`, and holder will be left in an invalid state.
  before the change is accepted by holder, the "validate-change" signal will be emitted (the value of which can prevent the change from happening) which can be connected to to have a greater control of which values holder can have, or implement some business rules.

Parameters:

  value | A value to set the holder to, or `0`.

Returns:
  `true` if value has been set.

bool Gnome::Gda::Holder::set_value_str | ( | const Glib::RefPtr< DataHandler >& | dh,
|  | const Glib::ustring & | value
| ) |  |

Same functionality as set_value() except that it uses a string representation of the value to set, which will be converted into a GValue first (using default data handler if dh is `0`).

Note:
  if value is `0` or is the "<tt>0</tt>" string, then holder's value is set to `0`.
  if holder can't accept the value value, then this method returns `false`, and holder will be left in an invalid state.

Parameters:

  dh | A Gda::DataHandler to use, or `0`.
  value | A value to set the holder to, as a string.

Returns:
  `true` if value has been set.

bool Gnome::Gda::Holder::set_value_to_default | ( |  | ) |

Set holder's value to its default value.

Returns:
  `true` if holder has got a default value.

Glib::SignalProxy2< void,const Glib::ustring&,const Value& > Gnome::Gda::Holder::signal_attribute_changed | ( |  | ) |

Prototype:
  `void on_my_attribute_changed(const Glib::ustring& attr_name, const Value& value)`

Glib::SignalProxy0< void > Gnome::Gda::Holder::signal_changed | ( |  | ) |

Prototype:
  `void on_my_changed()`

Glib::SignalProxy0< void > Gnome::Gda::Holder::signal_source_changed | ( |  | ) |

Prototype:
  `void on_my_source_changed()`

Glib::SignalProxy1< Glib::Error,const Value& > Gnome::Gda::Holder::signal_validate_change | ( |  | ) |

Prototype:
  `Glib::Error on_my_validate_change(const Value& value)`

Value Gnome::Gda::Holder::take_static_value | ( | const Value& | value,
|  | bool & | value_changed
| ) |  |

Sets the const value within the holder.

If holder is an alias for another holder, then the value is also set for that other holder.

The value will not be freed, and user should take care of it, either for its freeing or for its correct value at the moment of query.

If the value is not different from the one already contained within holder, then holder is not changed and no signal is emitted.

Note:
  if holder can't accept the value value, then this method returns `0`, and holder will be left in an invalid state.
  before the change is accepted by holder, the "validate-change" signal will be emitted (the value of which can prevent the change from happening) which can be connected to to have a greater control of which values holder can have, or implement some business rules.

Parameters:

  value | A const value to set the holder to.
  value_changed | A boolean set with `true` if the value changes, `false` elsewhere.

Returns:
  `0` if an error occurred or if the previous GValue was `0` itself. It returns the static GValue user set previously, so that he can free it.

bool Gnome::Gda::Holder::take_value | ( | const Value& | value | ) |

Sets the value within the holder.

If holder is an alias for another holder, then the value is also set for that other holder.

On success, the action of any call to force_invalid() is cancelled as soon as this method is called (even if holder's value does not actually change).

If the value is not different from the one already contained within holder, then holder is not changed and no signal is emitted.

Note:
  if holder can't accept the value value, then this method returns `false`, and holder will be left in an invalid state.
  before the change is accepted by holder, the "validate-change" signal will be emitted (the value of which can prevent the change from happening) which can be connected to to have a greater control of which values holder can have, or implement some business rules.
  if user previously set this holder with take_static_value() the GValue stored internally will be forgiven and replaced by the value. User should then take care of the 'old' static GValue.

Parameters:

  value | A value to set the holder to.

Returns:
  `true` if value has been set.

bool Gnome::Gda::Holder::value_is_default | ( |  | ) | const

Tells if holder's current value is the default one.

Returns:
  `true` if holder holder's current value is the default one.

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::Holder > wrap | ( | GdaHolder * | 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.

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

- libgdamm/holder.h