Container for a single Gda::Value. More...
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. |
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, ...)
virtual Gnome::Gda::Holder::~Holder | ( | ) | [virtual] |
Gnome::Gda::Holder::Holder | ( | GType | g_type, |
const Glib::ustring & | id | ||
) | [protected] |
Glib::RefPtr<Holder> Gnome::Gda::Holder::copy | ( | ) | const |
Copy constructor.
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 <link linkend="libgda-40-Attributes-manager.synopsis">this section</link>.
attribute | Attribute name as a string. |
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.
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.
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.
GType Gnome::Gda::Holder::get_g_type | ( | ) | const |
Get holder's type.
Glib::ustring Gnome::Gda::Holder::get_id | ( | ) | const |
Get the ID of holder.
The ID can be set using holder's "id" property
bool Gnome::Gda::Holder::get_not_null | ( | ) | const |
Get wether the holder can be 0
or not.
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.
col | A place to store the column in the model sourcing the holder, or 0 . |
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.
col | A place to store the column in the model sourcing the holder, or 0 . |
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.
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).
dh | A Gda::DataHandler to use, or 0 . |
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)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
bind_to | A Gda::Holder or 0 . |
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.
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
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.
model | A Gda::DataModel object or 0 . |
col | The reference column in model. |
true
if no error occurred. 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.
0
or if it is a Gda::TYPE_<tt>0 valuefalse
, and holder will be left in an invalid state.value | A value to set the holder to, or 0 . |
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
).
0
or is the "<tt>0</tt>" string, then holder's value is set to 0
. false
, and holder will be left in an invalid state. dh | A Gda::DataHandler to use, or 0 . |
value | A value to set the holder to, as a string. |
true
if value has been set. bool Gnome::Gda::Holder::set_value_to_default | ( | ) |
Set holder's value to its default value.
true
if holder has got a default value. Glib::SignalProxy2< void,const Glib::ustring&,const Value& > Gnome::Gda::Holder::signal_attribute_changed | ( | ) |
void on_my_attribute_changed(const Glib::ustring& attr_name, const Value& value)
Glib::SignalProxy0< void > Gnome::Gda::Holder::signal_changed | ( | ) |
void on_my_changed()
Glib::SignalProxy0< void > Gnome::Gda::Holder::signal_source_changed | ( | ) |
void on_my_source_changed()
Glib::SignalProxy1< Glib::Error,const Value& > Gnome::Gda::Holder::signal_validate_change | ( | ) |
Glib::Error on_my_validate_change(const Value& value)
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.
0
, and holder will be left in an invalid state.value | A const value to set the holder to. |
value_changed | A boolean set with true if the value changes, false elsewhere. |
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.
false
, and holder will be left in an invalid state.value | A value to set the holder to. |
true
if value has been set. bool Gnome::Gda::Holder::value_is_default | ( | ) | const |
Tells if holder's current value is the default one.
true
if holder holder's current value is the default one. Glib::RefPtr< Gnome::Gda::Holder > wrap | ( | GdaHolder * | object, |
bool | take_copy = false |
||
) | [related] |
A Glib::wrap() method for this object.
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. |