libgdamm: Gnome::Gda::DataModelIter Class Reference

Data model iterator. More...

Inheritance diagram for Gnome::Gda::DataModelIter:
Collaboration diagram for Gnome::Gda::DataModelIter:

Public Member Functions

 DataModelIter (DataModelIter&& src) noexcept
 
DataModelIteroperator= (DataModelIter&& src) noexcept
 
virtual ~DataModelIter () noexcept
 
GdaDataModelIter* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdaDataModelIter* gobj () const
 Provides access to the underlying C GObject. More...

 
GdaDataModelIter* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
bool is_valid () const
 Tells if iter is a valid iterator (if it actually corresponds to a valid row in the model) More...

 
bool move_next ()
 Moves iter one row further than where it already is (synchronizes the values of the parameters in iter with the values at the new row). More...

 
bool move_prev ()
 Moves iter one row before where it already is (synchronizes the values of the parameters in iter with the values at the new row). More...

 
bool move_to_row (int row)
 Synchronizes the values of the parameters in iter with the values at the row row. More...

 
int get_row () const
 Get the row which iter represents in the data model. More...

 
void invalidate_contents ()
 Declare all the parameters in iter invalid, without modifying the Gda::DataModel iter is for or changing the row it represents. More...

 
Glib::RefPtr< Holderget_holder_for_field (int col)
 Fetch a pointer to the Gda::Holder object which is synchronized with data at column col. More...

 
Glib::RefPtr< const Holderget_holder_for_field (int col) const
 Fetch a pointer to the Gda::Holder object which is synchronized with data at column col. More...

 
Value get_value_at (int col) const
 
Value get_value_for_field (const Glib::ustring& field_name) const
 Get the value stored at the column field_name in iter. More...

 
bool set_value_at (int col, const Value& value)
 Sets a value in iter, at the column specified by col. More...

 
Glib::PropertyProxy< int > property_current_row ()
 Current represented row in the data model. More...

 
Glib::PropertyProxy_ReadOnly< int > property_current_row () const
 Current represented row in the data model. More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< DataModel > > property_data_model () const
 Data model for which the iter is for. More...

 
Glib::PropertyProxy< Glib::RefPtr< DataModel > > property_forced_model ()
 Overrides the data model the iter is attached to (reserved for internal usage). More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< DataModel > > property_forced_model () const
 Overrides the data model the iter is attached to (reserved for internal usage). More...

 
Glib::PropertyProxy< bool > property_update_model ()
 
Glib::PropertyProxy_ReadOnly< bool > property_update_model () const
 
Glib::SignalProxy0< void > signal_end_of_data ()
 
Glib::SignalProxy1< void, int > signal_row_changed ()
 
- Public Member Functions inherited from Gnome::Gda::Set
 Set (Set&& src) noexcept
 
Setoperator= (Set&& src) noexcept
 
virtual ~Set () noexcept
 
GdaSet* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdaSet* gobj () const
 Provides access to the underlying C GObject. More...

 
GdaSet* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
Glib::RefPtr< Setcopy ()
 Creates a new Gda::Set object, copy of set. More...

 
Value get_holder_value (const Glib::ustring& holder_id) const
 Get the value of the Gda::Holder which ID is holder_id. More...

 
template<class T >
bool set_holder_value (const Glib::ustring& holder_id, T value)
 Set the value of the Gda::Holder which ID is holder_id to a specified value. More...

 
Glib::RefPtr< Holderget_holder (const Glib::ustring& holder_id)
 Finds a Gda::Holder using its ID. More...

 
Glib::RefPtr< const Holderget_holder (const Glib::ustring& holder_id) const
 Finds a Gda::Holder using its ID. More...

 
void add_holder (const Glib::RefPtr< Holder >& holder)
 Adds holder to the list of holders managed within set. More...

 
void add_holder_as_value (const Glib::ustring& id, const Gda::Value& value)
 Add a holder. More...

 
template<class ValueType >
void add_holder (const Glib::ustring& id, const ValueType& value)
 Add a holder. More...

 
void remove_holder (const Glib::RefPtr< Holder >& holder)
 Removes a Gda::Holder from the list of holders managed by set. More...

 
void merge_with_set (const Glib::RefPtr< Set >& set_to_merge)
 Add to set all the holders of set_to_merge. More...

 
bool is_valid () const
 This method tells if all set's Gda::Holder objects are valid, and if they represent a valid combination of values, as defined by rules external to Libgda: the "validate-set" signal is emitted and if none of the signal handlers return an error, then the returned value is true, otherwise the return value is false as soon as a signal handler returns an error. More...

 
Glib::SignalProxy1< void, const Glib::RefPtr< Holder >& > signal_holder_changed ()
 
Glib::SignalProxy0< void > signal_public_data_changed ()
 
Glib::SignalProxy0< Glib::Errorsignal_validate_set ()
 
Glib::SignalProxy2< Glib::Error, const Glib::RefPtr< Holder >&, const Value& > signal_validate_holder_change ()
 
Glib::SignalProxy3< void, const Glib::RefPtr< Holder >&, const Glib::ustring&, Valuesignal_holder_attr_changed ()
 
Glib::PropertyProxy< Glib::ustringproperty_description ()
 Description. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_description () const
 Description. More...

 
Glib::PropertyProxy< Glib::ustringproperty_id ()
 Id. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_id () const
 Id. More...

 
Glib::PropertyProxy< Glib::ustringproperty_name ()
 Name. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_name () const
 Name. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
void connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
sigc::connection connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable ()
 
 trackable (const trackable &src)
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (void *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (void *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< DataModelItercreate (const Glib::RefPtr< DataModel >& data_model)
 
- Static Public Member Functions inherited from Gnome::Gda::Set
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< Setcreate (const HolderVector& holders=HolderVector())
 

Protected Member Functions

 DataModelIter (const Glib::RefPtr< DataModel >& data_model)
 
virtual void on_end_of_data ()
 This is a default handler for the signal signal_end_of_data(). More...

 
virtual void on_row_changed (int row)
 This is a default handler for the signal signal_row_changed(). More...

 
- Protected Member Functions inherited from Gnome::Gda::Set
 Set (const HolderVector& holders)
 
virtual void on_holder_changed (const Glib::RefPtr< Holder >& holder)
 This is a default handler for the signal signal_holder_changed(). More...

 
virtual void on_public_data_changed ()
 This is a default handler for the signal signal_public_data_changed(). More...

 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
virtual ~Object () noexcept
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gnome::Gda::DataModelIterwrap (GdaDataModelIter* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Additional Inherited Members

- Public Types inherited from Glib::Object
typedef void(* DestroyNotify) (gpointer data)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Protected Types inherited from Gnome::Gda::Set
typedef std::vector< Glib::RefPtr< Holder > > HolderVector
 

Detailed Description

Data model iterator.

A Gda::DataModelIter object is used to iterate through the rows of a Gda::DataModel. If the data model is accessible in a random access way then any number of Gda::DataModelIter objects can be created on the same data model, and if the data model only supports a cursor based access then only one Gda::DataModelIter can be created. In any case creating a Gda::DataModelIter should be done using the create_iter() method.

When a Gda::DataModelIter is valid (that is when it points to an existing row in the data model it iterates through), the individual values (corresponding to each column of the data model, at the pointer row) can be accessed using the get_value_at() or get_value_for_field() methods (or in the same way Gda::Set's values are accessed as Gda::DataModelIter inherits the Gda::Set).

Right after being created, a Gda::DataModelIter is invalid (does not point to any row of its data model). To read the first row of the data model, use the move_next() method. Calling this method several times will move the iterator forward, up to when the data model has no more rows and the Gda::DataModelIter will be declared invalid (and move_next() has returned FALSE). Note that at this point, the number of rows in the data model will be known.

If the data model supports it, a Gda::DataModelIter can be moved backwards using the move_prev() method. However if the iterator is invalid, moving backwards will not be possible (on the contrary to move_next() which moves to the first row).

The move_to_row() method, if the iterator can be moved both forward and backwards, can move the iterator to a specific row (sometimes faster than moving it forward or backwards a number of times).

Constructor & Destructor Documentation

Gnome::Gda::DataModelIter::DataModelIter ( DataModelIter&&  src)
noexcept
virtual Gnome::Gda::DataModelIter::~DataModelIter ( )
virtualnoexcept
Gnome::Gda::DataModelIter::DataModelIter ( const Glib::RefPtr< DataModel >&  data_model)
explicitprotected

Member Function Documentation

static Glib::RefPtr<DataModelIter> Gnome::Gda::DataModelIter::create ( const Glib::RefPtr< DataModel >&  data_model)
static
Glib::RefPtr<Holder> Gnome::Gda::DataModelIter::get_holder_for_field ( int  col)

Fetch a pointer to the Gda::Holder object which is synchronized with data at column col.

Parameters
colThe requested column.
Returns
The Gda::Holder, or 0 if an error occurred.
Glib::RefPtr<const Holder> Gnome::Gda::DataModelIter::get_holder_for_field ( int  col) const

Fetch a pointer to the Gda::Holder object which is synchronized with data at column col.

Parameters
colThe requested column.
Returns
The Gda::Holder, or 0 if an error occurred.
int Gnome::Gda::DataModelIter::get_row ( ) const

Get the row which iter represents in the data model.

Returns
The row number, or -1 if iter is invalid.
static GType Gnome::Gda::DataModelIter::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

Value Gnome::Gda::DataModelIter::get_value_at ( int  col) const
Value Gnome::Gda::DataModelIter::get_value_for_field ( const Glib::ustring field_name) const

Get the value stored at the column field_name in iter.

Parameters
field_nameThe requested column name.
Returns
The Value, or 0.
GdaDataModelIter* Gnome::Gda::DataModelIter::gobj ( )
inline

Provides access to the underlying C GObject.

const GdaDataModelIter* Gnome::Gda::DataModelIter::gobj ( ) const
inline

Provides access to the underlying C GObject.

GdaDataModelIter* Gnome::Gda::DataModelIter::gobj_copy ( )

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

void Gnome::Gda::DataModelIter::invalidate_contents ( )

Declare all the parameters in iter invalid, without modifying the Gda::DataModel iter is for or changing the row it represents.

This method is for internal usage. Note that for is_valid() to return false, it is also necessary to set the "current-row" property to -1.

bool Gnome::Gda::DataModelIter::is_valid ( ) const

Tells if iter is a valid iterator (if it actually corresponds to a valid row in the model)

Returns
true if iter is valid.
bool Gnome::Gda::DataModelIter::move_next ( )

Moves iter one row further than where it already is (synchronizes the values of the parameters in iter with the values at the new row).

If the iterator was on the data model's last row, then it can't be moved forward anymore, and the returned value is false; nore also that the "current-row" property is set to -1 (which means that is_valid() would return false)

If any other error occurred then the returned value is false, but the "current-row" property is set to the new current row (one row more than it was before the call). In this case each Gda::Holder composing iter for which an error occurred will be invalid (see Gda::Holder::is_valid()).

Returns
true if the iterator is now at the next row.
bool Gnome::Gda::DataModelIter::move_prev ( )

Moves iter one row before where it already is (synchronizes the values of the parameters in iter with the values at the new row).

If the iterator was on the data model's first row, then it can't be moved backwards anymore, and the returned value is false; note also that the "current-row" property is set to -1 (which means that is_valid() would return false).

If any other error occurred then the returned value is false, but the "current-row" property is set to the new current row (one row less than it was before the call). In this case each Gda::Holder composing iter for which an error occurred will be invalid (see Gda::Holder::is_valid()).

Returns
true if the iterator is now at the previous row.
bool Gnome::Gda::DataModelIter::move_to_row ( int  row)

Synchronizes the values of the parameters in iter with the values at the row row.

If row is not a valid row, then the returned value is false, and the "current-row" property is set to -1 (which means that is_valid() would return false)

If any other error occurred then the returned value is false, but the "current-row" property is set to the row row. In this case each Gda::Holder composing iter for which an error occurred will be invalid (see Gda::Holder::is_valid()).

Parameters
rowThe row to set iter to.
Returns
true if no error occurred.
virtual void Gnome::Gda::DataModelIter::on_end_of_data ( )
protectedvirtual

This is a default handler for the signal signal_end_of_data().

virtual void Gnome::Gda::DataModelIter::on_row_changed ( int  row)
protectedvirtual

This is a default handler for the signal signal_row_changed().

DataModelIter& Gnome::Gda::DataModelIter::operator= ( DataModelIter&&  src)
noexcept
Glib::PropertyProxy< int > Gnome::Gda::DataModelIter::property_current_row ( )

Current represented row in the data model.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< int > Gnome::Gda::DataModelIter::property_current_row ( ) const

Current represented row in the data model.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > Gnome::Gda::DataModelIter::property_data_model ( ) const

Data model for which the iter is for.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<DataModel> > Gnome::Gda::DataModelIter::property_forced_model ( )

Overrides the data model the iter is attached to (reserved for internal usage).

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > Gnome::Gda::DataModelIter::property_forced_model ( ) const

Overrides the data model the iter is attached to (reserved for internal usage).

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gnome::Gda::DataModelIter::property_update_model ( )
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gnome::Gda::DataModelIter::property_update_model ( ) const
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
bool Gnome::Gda::DataModelIter::set_value_at ( int  col,
const Value value 
)

Sets a value in iter, at the column specified by col.

Parameters
colThe column number.
valueA Value (not 0).
Returns
true if no error occurred.
Glib::SignalProxy0< void > Gnome::Gda::DataModelIter::signal_end_of_data ( )
Slot Prototype:
void on_my_end_of_data()
Glib::SignalProxy1< void,int > Gnome::Gda::DataModelIter::signal_row_changed ( )
Slot Prototype:
void on_my_row_changed(int row)

Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::DataModelIter > wrap ( GdaDataModelIter *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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/datamodeliter.h