libgdamm: Gnome::Gda::DataModelImport Class Reference

libgdamm 4.99.10

- 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 | List of all members
Gnome::Gda::DataModelImport Class Reference
Data Models

Importing data from a string or a file. More...

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

## Public Member Functions
| DataModelImport (DataModelImport&& src) noexcept
DataModelImport& | operator= (DataModelImport&& src) noexcept
virtual | ~DataModelImport () noexcept
GdaDataModelImport* | gobj ()
| Provides access to the underlying C GObject. More...
const GdaDataModelImport* | gobj () const
| Provides access to the underlying C GObject. More...
GdaDataModelImport* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
GSList* | get_errors ()
| Get the list of errors which model has to report. More...
void | clean_errors ()
| Clears the history of errors model has to report. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_data_string () const
| String to import. More...
Glib::PropertyProxy_ReadOnly< std::string > | property_filename () const
| File to import. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Set > > | property_options () const
| Options to configure the import. More...
Glib::PropertyProxy_ReadOnly< bool > | property_random_access () const
| Random access to the data model is possible. More...
Glib::PropertyProxy_ReadOnly< xmlNodePtr > | property_xml_node () const
| XML node to import from. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (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::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (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 ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (void *data) const
Public Member Functions inherited from Gnome::Gda::DataModel
| DataModel (DataModel&& src) noexcept
DataModel& | operator= (DataModel&& src) noexcept
virtual | ~DataModel () noexcept
GdaDataModel* | gobj ()
| Provides access to the underlying C GObject. More...
const GdaDataModel* | gobj () const
| Provides access to the underlying C GObject. More...
void | freeze ()
| Disables notifications of changes on the given data model. More...
void | thaw ()
| Re-enables notifications of changes on the given data model. More...
int | get_n_rows () const
int | get_n_columns () const
int | get_column_index (const Glib::ustring& name)
| Get the index of the first column named name in model. More...
Glib::RefPtr< Column > | describe_column (int col)
| Queries the underlying data model implementation for a description of a given column. More...
Glib::RefPtr< const Column > | describe_column (int col) const
| Queries the underlying data model implementation for a description of a given column. More...
Glib::ustring | get_column_title (int col) const
void | set_column_title (int col, const Glib::ustring& title)
| Sets the title of the given col in model. More...
Value | get_value_at (int col, int row) const
| Retrieves the data stored in the given position (identified by the col and row parameters) on a data model. More...
Value | get_typed_value_at (int col, int row, GType expected_type, bool nullok) const
| Upon errors `0` will be returned and error will be assigned a Error from the Gda::DATA_MODEL_ERROR domain. More...
ValueAttribute | get_attributes_at (int col, int row)
| Get the attributes of the value stored at (row, col) in model, which is an ORed value of Gda::ValueAttribute flags. More...
Glib::RefPtr< DataModelIter > | create_iter ()
| Creates a new iterator object Gda::DataModelIter object which can be used to iterate through rows in model. More...
bool | set_value_at (int col, int row, const Value& value)
| Modifies a value in model, at ( col, row). More...
bool | set_values (int row, const std::vector< Value >& values)
| In a similar way to set_value_at(), this method modifies a data model's contents by setting several values at once. More...
DataModelAccessFlags | get_access_flags () const
| Get the attributes of model such as how to access the data it contains if it's modifiable, etc. More...
int | append_values (const std::vector< Value >& values)
| Appends a row to the given data model. More...
bool | append_row ()
| Appends a row to the data model (the new row will possibly have `0` values for all columns, or some other values depending on the data model implementation) More...
bool | remove_row (int row)
| Removes a row from the data model. More...
int | get_row_from_values (const ValueVector& values, const std::vector< int >& cols_index)
| Returns the first row where all the values in values at the columns identified at cols_index match. More...
void | send_hint (DataModelHint hint, const Value& hint_value)
| Sends a hint to the data model. More...
Glib::ustring | export_to_string (DataModelIOFormat format, const std::vector< int >& cols, const std::vector< int >& rows, const Glib::RefPtr< Set >& options)
| Exports data contained in model to the a string; the format is specified using the format argument. More...
bool | export_to_file (DataModelIOFormat format, const std::string& file, const std::vector< int >& cols, const std::vector< int >& rows, const Glib::RefPtr< Set >& options)
| Exports data contained in model to the file; the format is specified using the format argument. More...
bool | import_from_model (const Glib::RefPtr< DataModel >& from, bool overwrite, GHashTable* cols_trans)
| Copy the contents of the from data model to the to data model. More...
bool | import_from_string (const Glib::ustring&string, GHashTable* cols_trans, const Glib::RefPtr< const Set >& options)
| Loads the data from string into model. More...
bool | import_from_file (const std::string& file, GHashTable* cols_trans, const Glib::RefPtr< const Set >& options)
| Imports data contained in the file file into model; the format is detected. More...
void | dump (FILE* to_stream) const
| Dumps a textual representation of the model to the to_stream stream. More...
Glib::ustring | dump_as_string () const
| Dumps a textual representation of the model into a new string. More...
void | set_column_name (int col, const Glib::ustring& name)
| Sets the name of the given col in model, and if its title is not set, also sets the title to name. More...
Glib::ustring | get_column_name (int col) const
bool | iter_move_next_default (const Glib::RefPtr< DataModelIter >& iter)
bool | iter_move_prev_default (const Glib::RefPtr< DataModelIter >& iter)
bool | iter_move_to_row_default (const Glib::RefPtr< DataModelIter >& iter, int row)
Glib::SignalProxy1< void, int > | signal_row_inserted ()
Glib::SignalProxy1< void, int > | signal_row_updated ()
Glib::SignalProxy1< void, int > | signal_row_removed ()
Glib::SignalProxy0< void > | signal_reset ()
Glib::SignalProxy0< void > | signal_changed ()
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
virtual | ~Interface () noexcept
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () 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< DataModelImport > | create (const std::string& filename, bool random_access, const Glib::RefPtr< const Set >& options)
static Glib::RefPtr< DataModelImport > | create (const gchar* data, bool random_access, const Glib::RefPtr< const Set >& options)
static Glib::RefPtr< DataModelImport > | create (xmlNodePtr node)
Static Public Member Functions inherited from Gnome::Gda::DataModel
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions
| DataModelImport (const std::string& filename, bool random_access, const Glib::RefPtr< const Set >& options)
| DataModelImport (const gchar* data, bool random_access, const Glib::RefPtr< const Set >& options)
| DataModelImport (xmlNodePtr node)
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
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gnome::Gda::DataModel
| DataModel ()
| You should derive from this class to use it. More...
virtual void | on_row_inserted (int row)
| This is a default handler for the signal signal_row_inserted(). More...
virtual void | on_row_updated (int row)
| This is a default handler for the signal signal_row_updated(). More...
virtual void | on_row_removed (int row)
| This is a default handler for the signal signal_row_removed(). More...
virtual void | on_reset ()
| This is a default handler for the signal signal_reset(). More...
virtual void | on_changed ()
| This is a default handler for the signal signal_changed(). More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gnome::Gda::DataModelImport > | wrap (GdaDataModelImport* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gnome::Gda::DataModel
Glib::RefPtr< Gnome::Gda::DataModel > | wrap (GdaDataModel* 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
Public Types inherited from Gnome::Gda::DataModel
typedef std::vector< Value > | ValueVector

## Detailed Description

Importing data from a string or a file.

This data model imports data from a string or a file. The data can either be in a CSV (comma separated values) format or in an XML format as described by the libgda-array.dtd DTD (It is also possible to import data from an already-build XML tree validated against that DTD). The caller must decide, upon construction, if the new DataModelImport must support random access or simply cursor based access. Random access makes it easier to use the resulting data model but consumes more memory as all the data is copied in memory, and this is thus not suitable for large data sets. Note that importing from an already-built XML tree will always result in a random access data model.

Various import options can be specified using parameters in a Set object. The available options depend on the format of the imported data listed here:

- "SEPARATOR" (string, CVS import only): specifies the separator to consider.
- "ESCAPE_CHAR" (string, CVS import only): specifies the character used to "escape" the strings contained between two separators.
- "ENCODING" (string, CVS import only): specifies the character set used in the imported data.
- "TITLE_AS_FIRST_LINE" (boolean, CVS import only): TRUE to specify that the first line of the imported data contains the column names.
- "GDA_TYPE_<col number>" (gda type, CVS import only): specifies the requested GDA type for the column numbered "col number".
- "DBMS_TYPE_<col number>" (string, CVS import only): specifies the requested DBMS type for the column numbered "col number"; if the DBMS type is listed in the dictionary used by the created model, then the GDA type is set in accordance.

## Constructor & Destructor Documentation

Gnome::Gda::DataModelImport::DataModelImport | ( | DataModelImport&& | src | ) |
| noexcept

virtual Gnome::Gda::DataModelImport::~DataModelImport | ( |  | ) |
| virtualnoexcept

Gnome::Gda::DataModelImport::DataModelImport | ( | const std::string & | filename,
|  | bool | random_access,
|  | const Glib::RefPtr< const Set >& | options
| ) |  |
| protected

Gnome::Gda::DataModelImport::DataModelImport | ( | const gchar * | data,
|  | bool | random_access,
|  | const Glib::RefPtr< const Set >& | options
| ) |  |
| protected

Gnome::Gda::DataModelImport::DataModelImport | ( | xmlNodePtr | node | ) |
| explicitprotected

## Member Function Documentation

void Gnome::Gda::DataModelImport::clean_errors | ( |  | ) |

Clears the history of errors model has to report.

static Glib::RefPtr<DataModelImport> Gnome::Gda::DataModelImport::create | ( | const std::string & | filename,
|  | bool | random_access,
|  | const Glib::RefPtr< const Set >& | options
| ) |  |
| static

static Glib::RefPtr<DataModelImport> Gnome::Gda::DataModelImport::create | ( | const gchar * | data,
|  | bool | random_access,
|  | const Glib::RefPtr< const Set >& | options
| ) |  |
| static

static Glib::RefPtr<DataModelImport> Gnome::Gda::DataModelImport::create | ( | xmlNodePtr | node | ) |
| static

GSList* Gnome::Gda::DataModelImport::get_errors | ( |  | ) |

Get the list of errors which model has to report.

The returned list is a list of Error structures, and must not be modified

Returns
  The list of errors (which must not be modified), or `0`.

static GType Gnome::Gda::DataModelImport::get_type | ( |  | ) |
| static

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

GdaDataModelImport* Gnome::Gda::DataModelImport::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GdaDataModelImport* Gnome::Gda::DataModelImport::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GdaDataModelImport* Gnome::Gda::DataModelImport::gobj_copy | ( |  | ) |

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

DataModelImport& Gnome::Gda::DataModelImport::operator= | ( | DataModelImport&& | src | ) |
| noexcept

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gnome::Gda::DataModelImport::property_data_string | ( |  | ) | const

String to import.

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< std::string > Gnome::Gda::DataModelImport::property_filename | ( |  | ) | const

File to import.

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<Set> > Gnome::Gda::DataModelImport::property_options | ( |  | ) | const

Options to configure the import.

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< bool > Gnome::Gda::DataModelImport::property_random_access | ( |  | ) | const

Random access to the data model is possible.

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< xmlNodePtr > Gnome::Gda::DataModelImport::property_xml_node | ( |  | ) | const

XML node to import from.

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

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::DataModelImport > wrap | ( | GdaDataModelImport * | 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/datamodelimport.h