libgdamm: Gnome::Gda::DataProxy Class Reference

libgdamm 4.99.6

- 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::DataProxy Class Reference
Data Models

Proxy to hold modifications for any DataModel, providing the DataModel interface itself. More...

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

List of all members.

## Public Member Functions
virtual | ~DataProxy ()
GdaDataProxy* | gobj ()
| Provides access to the underlying C GObject.
const GdaDataProxy* | gobj () const
| Provides access to the underlying C GObject.
GdaDataProxy* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
get_proxied_model ()
| Fetch the Gda::DataModel which proxy does proxy.
get_proxied_model () const
| Fetch the Gda::DataModel which proxy does proxy.
int | get_proxied_model_n_cols () const
| Get the number of columns in the proxied data model.
int | get_proxied_model_n_rows () const
| Get the number of rows in the proxied data model.
bool | is_read_only () const
ValueVector | get_values (int proxy_row, const std::vector< int >& cols_index) const
| Retrieve a whole list of values from the proxy data model.
ValueAttribute | get_value_attributes (int proxy_row, int col) const
| Get the attributes of the value stored at (proxy_row, col) in proxy, which is an ORed value of Gda::ValueAttribute flags.
void | alter_value_attributes (int proxy_row, int col, ValueAttribute alter_flags)
| Alters the attributes of the value stored at (proxy_row, col) in proxy.
int | get_proxied_model_row (int proxy_row) const
| Get the proxy's proxied model row corresponding to proxy_row.
void | erase (int proxy_row)
| Marks the row proxy_row to be deleted.
void | unerase (int proxy_row)
| Remove the "to be deleted" mark at the row proxy_row, if it existed.
bool | row_is_deleted (int proxy_row) const
| Tells if the row number proxy_row is marked to be deleted.
bool | row_is_inserted (int proxy_row) const
| Tells if the row number proxy_row is a row which has been inserted in proxy (and is thus not in the proxied data model).
void | cancel_row_changes (int proxy_row, int col)
| Resets data at the corresponding row and column.
void | apply_row_changes (int proxy_row)
| Commits the modified data in the proxy back into the Gda::DataModel.
bool | has_changed () const
| Tells if proxy contains any modifications not applied to the proxied data model.
bool | row_has_changed (int proxy_row) const
| Tells if the row number proxy_row has changed.
int | get_n_new_rows () const
| Get the number of rows which have been added to proxy and which are not part of the proxied data model.
int | get_n_modified_rows () const
| Get the number of rows which have been modified in the proxy (the sum of rows existing in the proxied data model which have been modified, and new rows).
void | set_sample_size (int sample_size)
| Sets the size of each chunk of data to display: the maximum number of rows which can be "displayed" at a time (the maximum number of rows which proxy pretends to have).
int | get_sample_size () const
| Get the size of each chunk of data displayed at a time.
void | set_sample_start (int sample_start)
| Sets the number of the first row to be available in proxy (in reference to the proxied data model)
int | get_sample_start () const
| Get the number of the first row to be available in proxy (in reference to the proxied data model)
int | get_sample_end () const
| Get the number of the last row to be available in proxy (in reference to the proxied data model)
bool | apply_all_changes ()
| Apply all the changes stored in the proxy to the proxied data model.
bool | cancel_all_changes ()
| Cancel all the changes stored in the proxy (the proxy will be reset to its state as it was just after creation).
int | get_filtered_n_rows ()
| Get the total number of filtered rows in proxy if a filter has been applied.
get_filter_expr ()
| Get the current filter expression used by proxy.
void | get_filter_expr (const Glib::ustring& filter_expr)
| Sets a filter among the rows presented by proxy.
void | set_ordering_column (int col)
| Orders by the col column.
< property_model ()
| Proxied data model.
< property_model () const
| Proxied data model.
property_prepend_null_entry ()
| Tells if a row composed of NULL values is inserted as the proxy's first row.
< bool > | property_prepend_null_entry () const
| Tells if a row composed of NULL values is inserted as the proxy's first row.
property_defer_sync ()
| Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step.
< bool > | property_defer_sync () const
| Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step.
property_sample_size ()
| Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model.
property_sample_size () const
| Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model.
bool > | signal_row_delete_changed ()
int > | signal_sample_changed ()
signal_sample_size_changed ()
signal_filter_changed ()
< signal_validate_row_changes ()
int > | signal_row_changes_applied ()
## Static Public Member Functions
static DataModel >& model)
## Protected Member Functions
| DataProxy (const DataModel >& model)
virtual void | on_row_delete_changed (int row, bool to_be_deleted)
virtual void | on_sample_changed (int sample_start, int sample_end)
virtual void | on_sample_size_changed (int sample_size)
virtual void | on_row_changes_applied (int row, int proxied_row)
## Related Functions
(Note that these are not member functions.)
< Gnome::Gda::DataProxy > | wrap (GdaDataProxy* object, bool take_copy=false)
| A

## Detailed Description

Proxy to hold modifications for any DataModel, providing the DataModel interface itself.

This object stores modifications made to a DataModel object which is proxied until asked to make the changes inside the DataModel. It also filters the proxied data model to show only a sample (a defined number of continuous rows) of it.

Specifically, for a proxied data model having nb_cols columns and nb_rows rows, the DataProxy object has the following attributes:

- 2 * nb_cols columns:
  - The first (>= 0) nb_cols columns are the current values stored in the proxy (which correspond to the values of the proxied data model if the considered row has not been changed). The associated values are writable.
  - The last nb_cols columns are the values stored in the proxied data model, at column col - nb_cols.
- A variable number of rows depending on the following attributes:
  - Whether the proxy is configured to have an empty row as the first row.
  - Whether the proxy only displays parts of the proxied data model.
  - Whether new rows have been added to the proxy.

Note that unless explicitely mentioned, the columns are read-only.

## Constructor & Destructor Documentation

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

Gnome::Gda::DataProxy::DataProxy | ( | const DataModel >& | model | ) | `[explicit, protected]`

## Member Function Documentation

void Gnome::Gda::DataProxy::alter_value_attributes | ( | int | proxy_row,
|  | int | col,
|  | ValueAttribute | alter_flags
| ) |  |

Alters the attributes of the value stored at (proxy_row, col) in proxy.

the alter_flags can only contain the GDA_VALUE_ATTR_IS_`0`, GDA_VALUE_ATTR_IS_DEFAULT and GDA_VALUE_ATTR_IS_UNCHANGED flags (other flags are ignored).

Parameters:

  proxy_row | A proxy row number.
  col | A valid column number.
  alter_flags | Flags to alter the attributes.

bool Gnome::Gda::DataProxy::apply_all_changes | ( |  | ) |

Apply all the changes stored in the proxy to the proxied data model.

The changes are done row after row, and if an error occurs, then it is possible that not all the changes to all the rows have been applied.

Returns:
  `true` if no error occurred.

void Gnome::Gda::DataProxy::apply_row_changes | ( | int | proxy_row | ) |

Commits the modified data in the proxy back into the Gda::DataModel.

Parameters:

  proxy_row | The row number to commit.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::DataProxy::cancel_all_changes | ( |  | ) |

Cancel all the changes stored in the proxy (the proxy will be reset to its state as it was just after creation).

Returns:
  `true` if no error occurred.

void Gnome::Gda::DataProxy::cancel_row_changes | ( | int | proxy_row,
|  | int | col
| ) |  |

Resets data at the corresponding row and column.

If proxy_row corresponds to a new row, then that new row is deleted from proxy.

Parameters:

  proxy_row | The row to cancel changes.
  col | The column to cancel changes, or less than 0 to cancel any change on the row row.

static DataProxy> Gnome::Gda::DataProxy::create | ( | const DataModel >& | model | ) | `[static]`

void Gnome::Gda::DataProxy::erase | ( | int | proxy_row | ) |

Marks the row proxy_row to be deleted.

Parameters:

  proxy_row | A proxy row number.

Glib::ustring Gnome::Gda::DataProxy::get_filter_expr | ( |  | ) |

Get the current filter expression used by proxy.

Returns:
  The current filter expression or `0` if no filter has been set.

void Gnome::Gda::DataProxy::get_filter_expr | ( | const Glib::ustring & | filter_expr | ) |

Sets a filter among the rows presented by proxy.

The filter is defined by a filter expression which can be any SQL valid expression using proxy's columns. For instance if proxy has the "id" and "name" columns, then a filter can be "length(name) < 5" to filter only the rows where the length of the name is strictly inferior to 5, or "id >= 1000 and id < 2000 order by name limit 50" to filter only the rows where the id is between 1000 and 2000, ordered by name and limited to 50 rows.

Note about column names: real column names can be used (double quoted if necessary), but columns can also be named "_<column number>" with column numbers starting at 1.

Note that any previous filter expression is replaced with the new filter_expr if no error occurs (if an error occurs, then any previous filter is left unchanged).

Parameters:

  filter_expr | An SQL based expression which will filter the contents of proxy, or `0` to remove any previous filter.

Returns:
  `true` if no error occurred.

int Gnome::Gda::DataProxy::get_filtered_n_rows | ( |  | ) |

Get the total number of filtered rows in proxy if a filter has been applied.

As new rows (rows added to the proxy and not yet added to the proxied data model) and rows to remove (rows marked for removal but not yet removed from the proxied data model) are also filtered, the returned number also contains references to new rows and rows to be removed.

Returns:
  The number of filtered rows in proxy, or -1 if no filter has been applied.

int Gnome::Gda::DataProxy::get_n_modified_rows | ( |  | ) | const

Get the number of rows which have been modified in the proxy (the sum of rows existing in the proxied data model which have been modified, and new rows).

Returns:
  The number of modified rows.

int Gnome::Gda::DataProxy::get_n_new_rows | ( |  | ) | const

Get the number of rows which have been added to proxy and which are not part of the proxied data model.

Returns:
  The number of new rows.

DataModel> Gnome::Gda::DataProxy::get_proxied_model | ( |  | ) |

Fetch the Gda::DataModel which proxy does proxy.

Returns:
  The proxied data model.

DataModel> Gnome::Gda::DataProxy::get_proxied_model | ( |  | ) | const

Fetch the Gda::DataModel which proxy does proxy.

Returns:
  The proxied data model.

int Gnome::Gda::DataProxy::get_proxied_model_n_cols | ( |  | ) | const

Get the number of columns in the proxied data model.

Returns:
  The number of columns, or -1 if an error occurred.

int Gnome::Gda::DataProxy::get_proxied_model_n_rows | ( |  | ) | const

Get the number of rows in the proxied data model.

Returns:
  The number of rows, or -1 if the number of rows is not known.

int Gnome::Gda::DataProxy::get_proxied_model_row | ( | int | proxy_row | ) | const

Get the proxy's proxied model row corresponding to proxy_row.

Parameters:

  proxy_row | A proxy row number.

Returns:
  The proxied model's row, or -1 if proxy row which only exists proxy.

int Gnome::Gda::DataProxy::get_sample_end | ( |  | ) | const

Get the number of the last row to be available in proxy (in reference to the proxied data model)

Returns:
  The number of the last proxied model's row.

int Gnome::Gda::DataProxy::get_sample_size | ( |  | ) | const

Get the size of each chunk of data displayed at a time.

Returns:
  The chunk (or sample) size, or 0 if chunking is disabled.

int Gnome::Gda::DataProxy::get_sample_start | ( |  | ) | const

Get the number of the first row to be available in proxy (in reference to the proxied data model)

Returns:
  The number of the first proxied model's row.

ValueAttribute Gnome::Gda::DataProxy::get_value_attributes | ( | int | proxy_row,
|  | int | col
| ) |  | const

Get the attributes of the value stored at (proxy_row, col) in proxy, which is an ORed value of Gda::ValueAttribute flags.

Parameters:

  proxy_row | A proxy row.
  col | A valid proxy column.

Returns:
  The attribute.

ValueVector Gnome::Gda::DataProxy::get_values | ( | int | proxy_row,
|  | const std::vector< int > & | cols_index
| ) |  | const

Retrieve a whole list of values from the proxy data model.

This function calls gda_data_proxy_get_value() for each column index specified in cols_index, and generates a SList on the way.

Parameters:

  proxy_row | A proxy row.
  cols_index | Array containing the columns for which the values are requested.
  n_cols | Size of cols_index.

Returns:
  A new list of values (the list must be freed, not the values), or `0` if an error occurred.

GdaDataProxy* Gnome::Gda::DataProxy::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::DataModel.

const GdaDataProxy* Gnome::Gda::DataProxy::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::DataModel.

GdaDataProxy* Gnome::Gda::DataProxy::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::DataProxy::has_changed | ( |  | ) | const

Tells if proxy contains any modifications not applied to the proxied data model.

Returns:
  `true` if there are some modifications in proxy.

bool Gnome::Gda::DataProxy::is_read_only | ( |  | ) | const

Returns:
  `true` if the proxied data model is itself read-only.

virtual void Gnome::Gda::DataProxy::on_row_changes_applied | ( | int | row,
|  | int | proxied_row
| ) |  | `[protected, virtual]`

virtual void Gnome::Gda::DataProxy::on_row_delete_changed | ( | int | row,
|  | bool | to_be_deleted
| ) |  | `[protected, virtual]`

virtual void Gnome::Gda::DataProxy::on_sample_changed | ( | int | sample_start,
|  | int | sample_end
| ) |  | `[protected, virtual]`

virtual void Gnome::Gda::DataProxy::on_sample_size_changed | ( | int | sample_size | ) | `[protected, virtual]`

Glib::PropertyProxy<bool> Gnome::Gda::DataProxy::property_defer_sync | ( |  | ) |

Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step.

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::DataProxy::property_defer_sync | ( |  | ) | const

Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step.

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.

DataModel> > Gnome::Gda::DataProxy::property_model | ( |  | ) |

Proxied data model.

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.

DataModel> > Gnome::Gda::DataProxy::property_model | ( |  | ) | const

Proxied data model.

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::DataProxy::property_prepend_null_entry | ( |  | ) |

Tells if a row composed of NULL values is inserted as the proxy's first row.

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::DataProxy::property_prepend_null_entry | ( |  | ) | const

Tells if a row composed of NULL values is inserted as the proxy's first row.

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::DataProxy::property_sample_size | ( |  | ) |

Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model.

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::DataProxy::property_sample_size | ( |  | ) | const

Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model.

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.

bool Gnome::Gda::DataProxy::row_has_changed | ( | int | proxy_row | ) | const

Tells if the row number proxy_row has changed.

Parameters:

  proxy_row | A proxy row number.

Returns:
  `true` if the row has changed.

bool Gnome::Gda::DataProxy::row_is_deleted | ( | int | proxy_row | ) | const

Tells if the row number proxy_row is marked to be deleted.

Parameters:

  proxy_row | A proxy row number.

Returns:
  `true` if the row is marked to be deleted.

bool Gnome::Gda::DataProxy::row_is_inserted | ( | int | proxy_row | ) | const

Tells if the row number proxy_row is a row which has been inserted in proxy (and is thus not in the proxied data model).

Parameters:

  proxy_row | A proxy row number.

Returns:
  `true` if the row is an inserted row.

void Gnome::Gda::DataProxy::set_ordering_column | ( | int | col | ) |

Orders by the col column.

Parameters:

  col | The column number to order from.

Returns:
  `true` if no error occurred.

void Gnome::Gda::DataProxy::set_sample_size | ( | int | sample_size | ) |

Sets the size of each chunk of data to display: the maximum number of rows which can be "displayed" at a time (the maximum number of rows which proxy pretends to have).

The default value is arbitrary 300 as it is big enough to be able to display quite a lot of data, but small enough to avoid too much data displayed at the same time.

Note:
  the rows which have been added but not yet committed will always be displayed regardless of the current chunk of data, and the modified rows which are not visible when the displayed chunk of data changes are still held as modified rows.

To remove the chunking of the data to display, simply pass sample_size the %0 value.

Parameters:

  sample_size | The requested size of a chunk, or 0.

void Gnome::Gda::DataProxy::set_sample_start | ( | int | sample_start | ) |

Sets the number of the first row to be available in proxy (in reference to the proxied data model)

Parameters:

  sample_start | The number of the first row to be displayed.

Glib::SignalProxy0< void > Gnome::Gda::DataProxy::signal_filter_changed | ( |  | ) |

Prototype:
  `void on_my_filter_changed()`

Glib::SignalProxy2< void,int,int > Gnome::Gda::DataProxy::signal_row_changes_applied | ( |  | ) |

Prototype:
  `void on_my_row_changes_applied(int row, int proxied_row)`

Glib::SignalProxy2< void,int,bool > Gnome::Gda::DataProxy::signal_row_delete_changed | ( |  | ) |

Prototype:
  `void on_my_row_delete_changed(int row, bool to_be_deleted)`

Glib::SignalProxy2< void,int,int > Gnome::Gda::DataProxy::signal_sample_changed | ( |  | ) |

Prototype:
  `void on_my_sample_changed(int sample_start, int sample_end)`

Glib::SignalProxy1< void,int > Gnome::Gda::DataProxy::signal_sample_size_changed | ( |  | ) |

Prototype:
  `void on_my_sample_size_changed(int sample_size)`

Glib::Error,int,int > Gnome::Gda::DataProxy::signal_validate_row_changes | ( |  | ) |

Prototype:
  `Glib::Error on_my_validate_row_changes(int row, int proxied_row)`

void Gnome::Gda::DataProxy::unerase | ( | int | proxy_row | ) |

Remove the "to be deleted" mark at the row proxy_row, if it existed.

Parameters:

  proxy_row | A proxy row number.

## Friends And Related Function Documentation

Gnome::Gda::DataProxy > wrap | ( | GdaDataProxy * | 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/dataproxy.h