1 // Generated by gmmproc 2.46.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <libgdamm/datamodel.h>
7 #include <libgdamm/private/datamodel_p.h>
8
9
10 /* $Id: datamodel.ccg,v 1.11 2006/11/08 01:42:01 murrayc Exp $ */
11 // -*- C++ -*- // this is for the .ccg, I realize gensig puts one in
12
13 /* datamodel.cc
14 *
15 * Copyright 2003 libgdamm Development Team
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free
29 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32 #include <libgdamm/serverprovider.h>
33 #include <libgda/gda-data-model.h>
34 #include <libgda/gda-data-model-extra.h>
35 #include <libgda/gda-data-model-iter-extra.h>
36 #include <libgda/gda-data-model-array.h>
37 #include <libgda/gda-enum-types.h>
38
39
40 namespace Gnome
41 {
42
43 namespace Gda
44 {
45
46
export_to_file(DataModelIOFormat format,const std::string & file,const std::vector<int> & cols,const std::vector<int> & rows,const Glib::RefPtr<Set> & options)47 bool DataModel::export_to_file(DataModelIOFormat format, const std::string& file, const std::vector<int>& cols, const std::vector<int>& rows, const Glib::RefPtr<Set>& options)
48 {
49 GError* gerror = 0;
50 bool retvalue = gda_data_model_export_to_file(gobj(), static_cast<GdaDataModelIOFormat>(format), file.c_str(), cols.data(), cols.size(), rows.data(), rows.size(), options->gobj(), &gerror);
51
52 if(gerror)
53 ::Glib::Error::throw_exception(gerror);
54
55 return retvalue;
56 }
57
export_to_string(DataModelIOFormat format,const std::vector<int> & cols,const std::vector<int> & rows,const Glib::RefPtr<Set> & options)58 Glib::ustring DataModel::export_to_string(DataModelIOFormat format, const std::vector<int>& cols, const std::vector<int>& rows, const Glib::RefPtr<Set>& options)
59 {
60 gchar* retvalue = gda_data_model_export_to_string(gobj(), static_cast<GdaDataModelIOFormat>(format), cols.data(), cols.size(), rows.data(), rows.size(), options->gobj());
61 Glib::ustring cppretvalue(retvalue);
62 g_free(retvalue);
63
64 return cppretvalue;
65 }
66
67
68 } /* namespace Gda */
69
70 } /* namespace Gnome */
71
72
73 namespace
74 {
75
76
DataModel_signal_row_inserted_callback(GdaDataModel * self,gint p0,void * data)77 static void DataModel_signal_row_inserted_callback(GdaDataModel* self, gint p0,void* data)
78 {
79 using namespace Gnome::Gda;
80 typedef sigc::slot< void,int > SlotType;
81
82 auto obj = dynamic_cast<DataModel*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
83 // Do not try to call a signal on a disassociated wrapper.
84 if(obj)
85 {
86 try
87 {
88 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
89 (*static_cast<SlotType*>(slot))(p0
90 );
91 }
92 catch(...)
93 {
94 Glib::exception_handlers_invoke();
95 }
96 }
97 }
98
99 static const Glib::SignalProxyInfo DataModel_signal_row_inserted_info =
100 {
101 "row_inserted",
102 (GCallback) &DataModel_signal_row_inserted_callback,
103 (GCallback) &DataModel_signal_row_inserted_callback
104 };
105
106
DataModel_signal_row_updated_callback(GdaDataModel * self,gint p0,void * data)107 static void DataModel_signal_row_updated_callback(GdaDataModel* self, gint p0,void* data)
108 {
109 using namespace Gnome::Gda;
110 typedef sigc::slot< void,int > SlotType;
111
112 auto obj = dynamic_cast<DataModel*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
113 // Do not try to call a signal on a disassociated wrapper.
114 if(obj)
115 {
116 try
117 {
118 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
119 (*static_cast<SlotType*>(slot))(p0
120 );
121 }
122 catch(...)
123 {
124 Glib::exception_handlers_invoke();
125 }
126 }
127 }
128
129 static const Glib::SignalProxyInfo DataModel_signal_row_updated_info =
130 {
131 "row_updated",
132 (GCallback) &DataModel_signal_row_updated_callback,
133 (GCallback) &DataModel_signal_row_updated_callback
134 };
135
136
DataModel_signal_row_removed_callback(GdaDataModel * self,gint p0,void * data)137 static void DataModel_signal_row_removed_callback(GdaDataModel* self, gint p0,void* data)
138 {
139 using namespace Gnome::Gda;
140 typedef sigc::slot< void,int > SlotType;
141
142 auto obj = dynamic_cast<DataModel*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
143 // Do not try to call a signal on a disassociated wrapper.
144 if(obj)
145 {
146 try
147 {
148 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
149 (*static_cast<SlotType*>(slot))(p0
150 );
151 }
152 catch(...)
153 {
154 Glib::exception_handlers_invoke();
155 }
156 }
157 }
158
159 static const Glib::SignalProxyInfo DataModel_signal_row_removed_info =
160 {
161 "row_removed",
162 (GCallback) &DataModel_signal_row_removed_callback,
163 (GCallback) &DataModel_signal_row_removed_callback
164 };
165
166
167 static const Glib::SignalProxyInfo DataModel_signal_reset_info =
168 {
169 "reset",
170 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
171 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
172 };
173
174
175 static const Glib::SignalProxyInfo DataModel_signal_changed_info =
176 {
177 "changed",
178 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
179 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
180 };
181
182
183 } // anonymous namespace
184
185
DataModelError(Gnome::Gda::DataModelError::Code error_code,const Glib::ustring & error_message)186 Gnome::Gda::DataModelError::DataModelError(Gnome::Gda::DataModelError::Code error_code, const Glib::ustring& error_message)
187 :
188 Glib::Error (GDA_DATA_MODEL_ERROR, error_code, error_message)
189 {}
190
DataModelError(GError * gobject)191 Gnome::Gda::DataModelError::DataModelError(GError* gobject)
192 :
193 Glib::Error (gobject)
194 {}
195
code() const196 Gnome::Gda::DataModelError::Code Gnome::Gda::DataModelError::code() const
197 {
198 return static_cast<Code>(Glib::Error::code());
199 }
200
throw_func(GError * gobject)201 void Gnome::Gda::DataModelError::throw_func(GError* gobject)
202 {
203 throw Gnome::Gda::DataModelError(gobject);
204 }
205
206 // static
value_type()207 GType Glib::Value<Gnome::Gda::DataModelError::Code>::value_type()
208 {
209 return gda_data_model_error_get_type();
210 }
211
212 // static
value_type()213 GType Glib::Value<Gnome::Gda::DataModelAccessFlags>::value_type()
214 {
215 return gda_data_model_access_flags_get_type();
216 }
217
218 // static
value_type()219 GType Glib::Value<Gnome::Gda::DataModelHint>::value_type()
220 {
221 return gda_data_model_hint_get_type();
222 }
223
224 // static
value_type()225 GType Glib::Value<Gnome::Gda::DataModelIOFormat>::value_type()
226 {
227 return gda_data_model_io_format_get_type();
228 }
229
230
231 namespace Glib
232 {
233
wrap(GdaDataModel * object,bool take_copy)234 Glib::RefPtr<Gnome::Gda::DataModel> wrap(GdaDataModel* object, bool take_copy)
235 {
236 return Glib::RefPtr<Gnome::Gda::DataModel>( dynamic_cast<Gnome::Gda::DataModel*> (Glib::wrap_auto_interface<Gnome::Gda::DataModel> ((GObject*)(object), take_copy)) );
237 //We use dynamic_cast<> in case of multiple inheritance.
238 }
239
240 } // namespace Glib
241
242
243 namespace Gnome
244 {
245
246 namespace Gda
247 {
248
249
250 /* The *_Class implementation: */
251
init()252 const Glib::Interface_Class& DataModel_Class::init()
253 {
254 if(!gtype_) // create the GType if necessary
255 {
256 // Glib::Interface_Class has to know the interface init function
257 // in order to add interfaces to implementing types.
258 class_init_func_ = &DataModel_Class::iface_init_function;
259
260 // We can not derive from another interface, and it is not necessary anyway.
261 gtype_ = gda_data_model_get_type();
262 }
263
264 return *this;
265 }
266
iface_init_function(void * g_iface,void *)267 void DataModel_Class::iface_init_function(void* g_iface, void*)
268 {
269 const auto klass = static_cast<BaseClassType*>(g_iface);
270
271 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
272 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
273 g_assert(klass != nullptr);
274
275
276 klass->row_inserted = &row_inserted_callback;
277 klass->row_updated = &row_updated_callback;
278 klass->row_removed = &row_removed_callback;
279 klass->reset = &reset_callback;
280 klass->changed = &changed_callback;
281 }
282
283
row_inserted_callback(GdaDataModel * self,gint p0)284 void DataModel_Class::row_inserted_callback(GdaDataModel* self, gint p0)
285 {
286 const auto obj_base = static_cast<Glib::ObjectBase*>(
287 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
288
289 // Non-gtkmmproc-generated custom classes implicitly call the default
290 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
291 // generated classes can use this optimisation, which avoids the unnecessary
292 // parameter conversions if there is no possibility of the virtual function
293 // being overridden:
294 if(obj_base && obj_base->is_derived_())
295 {
296 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
297 if(obj) // This can be NULL during destruction.
298 {
299 try // Trap C++ exceptions which would normally be lost because this is a C callback.
300 {
301 // Call the virtual member method, which derived classes might override.
302 obj->on_row_inserted(p0
303 );
304 return;
305 }
306 catch(...)
307 {
308 Glib::exception_handlers_invoke();
309 }
310 }
311 }
312
313 const auto base = static_cast<BaseClassType*>(
314 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
315 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
316 ) );
317
318 // Call the original underlying C function:
319 if(base && base->row_inserted)
320 (*base->row_inserted)(self, p0);
321 }
row_updated_callback(GdaDataModel * self,gint p0)322 void DataModel_Class::row_updated_callback(GdaDataModel* self, gint p0)
323 {
324 const auto obj_base = static_cast<Glib::ObjectBase*>(
325 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
326
327 // Non-gtkmmproc-generated custom classes implicitly call the default
328 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
329 // generated classes can use this optimisation, which avoids the unnecessary
330 // parameter conversions if there is no possibility of the virtual function
331 // being overridden:
332 if(obj_base && obj_base->is_derived_())
333 {
334 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
335 if(obj) // This can be NULL during destruction.
336 {
337 try // Trap C++ exceptions which would normally be lost because this is a C callback.
338 {
339 // Call the virtual member method, which derived classes might override.
340 obj->on_row_updated(p0
341 );
342 return;
343 }
344 catch(...)
345 {
346 Glib::exception_handlers_invoke();
347 }
348 }
349 }
350
351 const auto base = static_cast<BaseClassType*>(
352 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
353 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
354 ) );
355
356 // Call the original underlying C function:
357 if(base && base->row_updated)
358 (*base->row_updated)(self, p0);
359 }
row_removed_callback(GdaDataModel * self,gint p0)360 void DataModel_Class::row_removed_callback(GdaDataModel* self, gint p0)
361 {
362 const auto obj_base = static_cast<Glib::ObjectBase*>(
363 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
364
365 // Non-gtkmmproc-generated custom classes implicitly call the default
366 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
367 // generated classes can use this optimisation, which avoids the unnecessary
368 // parameter conversions if there is no possibility of the virtual function
369 // being overridden:
370 if(obj_base && obj_base->is_derived_())
371 {
372 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
373 if(obj) // This can be NULL during destruction.
374 {
375 try // Trap C++ exceptions which would normally be lost because this is a C callback.
376 {
377 // Call the virtual member method, which derived classes might override.
378 obj->on_row_removed(p0
379 );
380 return;
381 }
382 catch(...)
383 {
384 Glib::exception_handlers_invoke();
385 }
386 }
387 }
388
389 const auto base = static_cast<BaseClassType*>(
390 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
391 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
392 ) );
393
394 // Call the original underlying C function:
395 if(base && base->row_removed)
396 (*base->row_removed)(self, p0);
397 }
reset_callback(GdaDataModel * self)398 void DataModel_Class::reset_callback(GdaDataModel* self)
399 {
400 const auto obj_base = static_cast<Glib::ObjectBase*>(
401 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
402
403 // Non-gtkmmproc-generated custom classes implicitly call the default
404 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
405 // generated classes can use this optimisation, which avoids the unnecessary
406 // parameter conversions if there is no possibility of the virtual function
407 // being overridden:
408 if(obj_base && obj_base->is_derived_())
409 {
410 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
411 if(obj) // This can be NULL during destruction.
412 {
413 try // Trap C++ exceptions which would normally be lost because this is a C callback.
414 {
415 // Call the virtual member method, which derived classes might override.
416 obj->on_reset();
417 return;
418 }
419 catch(...)
420 {
421 Glib::exception_handlers_invoke();
422 }
423 }
424 }
425
426 const auto base = static_cast<BaseClassType*>(
427 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
428 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
429 ) );
430
431 // Call the original underlying C function:
432 if(base && base->reset)
433 (*base->reset)(self);
434 }
changed_callback(GdaDataModel * self)435 void DataModel_Class::changed_callback(GdaDataModel* self)
436 {
437 const auto obj_base = static_cast<Glib::ObjectBase*>(
438 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
439
440 // Non-gtkmmproc-generated custom classes implicitly call the default
441 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
442 // generated classes can use this optimisation, which avoids the unnecessary
443 // parameter conversions if there is no possibility of the virtual function
444 // being overridden:
445 if(obj_base && obj_base->is_derived_())
446 {
447 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
448 if(obj) // This can be NULL during destruction.
449 {
450 try // Trap C++ exceptions which would normally be lost because this is a C callback.
451 {
452 // Call the virtual member method, which derived classes might override.
453 obj->on_changed();
454 return;
455 }
456 catch(...)
457 {
458 Glib::exception_handlers_invoke();
459 }
460 }
461 }
462
463 const auto base = static_cast<BaseClassType*>(
464 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
465 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
466 ) );
467
468 // Call the original underlying C function:
469 if(base && base->changed)
470 (*base->changed)(self);
471 }
472
473
wrap_new(GObject * object)474 Glib::ObjectBase* DataModel_Class::wrap_new(GObject* object)
475 {
476 return new DataModel((GdaDataModel*)(object));
477 }
478
479
480 /* The implementation: */
481
DataModel()482 DataModel::DataModel()
483 :
484 Glib::Interface(datamodel_class_.init())
485 {}
486
DataModel(GdaDataModel * castitem)487 DataModel::DataModel(GdaDataModel* castitem)
488 :
489 Glib::Interface((GObject*)(castitem))
490 {}
491
DataModel(const Glib::Interface_Class & interface_class)492 DataModel::DataModel(const Glib::Interface_Class& interface_class)
493 : Glib::Interface(interface_class)
494 {
495 }
496
DataModel(DataModel && src)497 DataModel::DataModel(DataModel&& src) noexcept
498 : Glib::Interface(std::move(src))
499 {}
500
operator =(DataModel && src)501 DataModel& DataModel::operator=(DataModel&& src) noexcept
502 {
503 Glib::Interface::operator=(std::move(src));
504 return *this;
505 }
506
~DataModel()507 DataModel::~DataModel() noexcept
508 {}
509
510 // static
add_interface(GType gtype_implementer)511 void DataModel::add_interface(GType gtype_implementer)
512 {
513 datamodel_class_.init().add_interface(gtype_implementer);
514 }
515
516 DataModel::CppClassType DataModel::datamodel_class_; // initialize static member
517
get_type()518 GType DataModel::get_type()
519 {
520 return datamodel_class_.init().get_type();
521 }
522
523
get_base_type()524 GType DataModel::get_base_type()
525 {
526 return gda_data_model_get_type();
527 }
528
529
freeze()530 void DataModel::freeze()
531 {
532 gda_data_model_freeze(gobj());
533 }
534
thaw()535 void DataModel::thaw()
536 {
537 gda_data_model_thaw(gobj());
538 }
539
get_n_rows() const540 int DataModel::get_n_rows() const
541 {
542 return gda_data_model_get_n_rows(const_cast<GdaDataModel*>(gobj()));
543 }
544
get_n_columns() const545 int DataModel::get_n_columns() const
546 {
547 return gda_data_model_get_n_columns(const_cast<GdaDataModel*>(gobj()));
548 }
549
get_column_index(const Glib::ustring & name)550 int DataModel::get_column_index(const Glib::ustring& name)
551 {
552 return gda_data_model_get_column_index(gobj(), name.c_str());
553 }
554
describe_column(int col)555 Glib::RefPtr<Column> DataModel::describe_column(int col)
556 {
557 Glib::RefPtr<Column> retvalue = Glib::wrap(gda_data_model_describe_column(gobj(), col));
558 if(retvalue)
559 retvalue->reference(); //The function does not do a ref for us.
560 return retvalue;
561 }
562
describe_column(int col) const563 Glib::RefPtr<const Column> DataModel::describe_column(int col) const
564 {
565 return const_cast<DataModel*>(this)->describe_column(col);
566 }
567
get_column_title(int col) const568 Glib::ustring DataModel::get_column_title(int col) const
569 {
570 return Glib::convert_const_gchar_ptr_to_ustring(gda_data_model_get_column_title(const_cast<GdaDataModel*>(gobj()), col));
571 }
572
set_column_title(int col,const Glib::ustring & title)573 void DataModel::set_column_title(int col, const Glib::ustring& title)
574 {
575 gda_data_model_set_column_title(gobj(), col, title.c_str());
576 }
577
get_value_at(int col,int row) const578 Value DataModel::get_value_at(int col, int row) const
579 {
580 GError* gerror = nullptr;
581 Value retvalue = Value(gda_data_model_get_value_at(const_cast<GdaDataModel*>(gobj()), col, row, &(gerror)));
582 if(gerror)
583 ::Glib::Error::throw_exception(gerror);
584 return retvalue;
585 }
586
get_typed_value_at(int col,int row,GType expected_type,bool nullok) const587 Value DataModel::get_typed_value_at(int col, int row, GType expected_type, bool nullok) const
588 {
589 GError* gerror = nullptr;
590 Value retvalue = Value(gda_data_model_get_typed_value_at(const_cast<GdaDataModel*>(gobj()), col, row, expected_type, static_cast<int>(nullok), &(gerror)));
591 if(gerror)
592 ::Glib::Error::throw_exception(gerror);
593 return retvalue;
594 }
595
get_attributes_at(int col,int row)596 ValueAttribute DataModel::get_attributes_at(int col, int row)
597 {
598 return ((ValueAttribute)(gda_data_model_get_attributes_at(gobj(), col, row)));
599 }
600
create_iter()601 Glib::RefPtr<DataModelIter> DataModel::create_iter()
602 {
603 return Glib::wrap(gda_data_model_create_iter(gobj()));
604 }
605
set_value_at(int col,int row,const Value & value)606 bool DataModel::set_value_at(int col, int row, const Value& value)
607 {
608 GError* gerror = nullptr;
609 bool retvalue = gda_data_model_set_value_at(gobj(), col, row, (value).gobj(), &(gerror));
610 if(gerror)
611 ::Glib::Error::throw_exception(gerror);
612 return retvalue;
613 }
614
set_values(int row,const std::vector<Value> & values)615 bool DataModel::set_values(int row, const std::vector<Value>& values)
616 {
617 GError* gerror = nullptr;
618 bool retvalue = gda_data_model_set_values(gobj(), row, Glib::ListHandler<Value, ValueTraits>::vector_to_list(values).data(), &(gerror));
619 if(gerror)
620 ::Glib::Error::throw_exception(gerror);
621 return retvalue;
622 }
623
get_access_flags() const624 DataModelAccessFlags DataModel::get_access_flags() const
625 {
626 return ((DataModelAccessFlags)(gda_data_model_get_access_flags(const_cast<GdaDataModel*>(gobj()))));
627 }
628
append_values(const std::vector<Value> & values)629 int DataModel::append_values(const std::vector<Value>& values)
630 {
631 GError* gerror = nullptr;
632 int retvalue = gda_data_model_append_values(gobj(), Glib::ListHandler<Value, ValueTraits>::vector_to_list(values).data(), &(gerror));
633 if(gerror)
634 ::Glib::Error::throw_exception(gerror);
635 return retvalue;
636 }
637
append_row()638 bool DataModel::append_row()
639 {
640 GError* gerror = nullptr;
641 bool retvalue = gda_data_model_append_row(gobj(), &(gerror));
642 if(gerror)
643 ::Glib::Error::throw_exception(gerror);
644 return retvalue;
645 }
646
remove_row(int row)647 bool DataModel::remove_row(int row)
648 {
649 GError* gerror = nullptr;
650 bool retvalue = gda_data_model_remove_row(gobj(), row, &(gerror));
651 if(gerror)
652 ::Glib::Error::throw_exception(gerror);
653 return retvalue;
654 }
655
get_row_from_values(const ValueVector & values,const std::vector<int> & cols_index)656 int DataModel::get_row_from_values(const ValueVector& values, const std::vector<int>& cols_index)
657 {
658 return gda_data_model_get_row_from_values(gobj(), Glib::SListHandler<Value, ValueTraits>::vector_to_slist(values).data(), const_cast<gint*>(Glib::ArrayHandler<int>::vector_to_array(cols_index).data()));
659 }
660
send_hint(DataModelHint hint,const Value & hint_value)661 void DataModel::send_hint(DataModelHint hint, const Value& hint_value)
662 {
663 gda_data_model_send_hint(gobj(), ((GdaDataModelHint)(hint)), (hint_value).gobj());
664 }
665
import_from_model(const Glib::RefPtr<DataModel> & from,bool overwrite,GHashTable * cols_trans)666 bool DataModel::import_from_model(const Glib::RefPtr<DataModel>& from, bool overwrite, GHashTable * cols_trans)
667 {
668 GError* gerror = nullptr;
669 bool retvalue = gda_data_model_import_from_model(gobj(), Glib::unwrap(from), static_cast<int>(overwrite), cols_trans, &(gerror));
670 if(gerror)
671 ::Glib::Error::throw_exception(gerror);
672 return retvalue;
673 }
674
import_from_string(const Glib::ustring & string,GHashTable * cols_trans,const Glib::RefPtr<const Set> & options)675 bool DataModel::import_from_string(const Glib::ustring& string, GHashTable * cols_trans, const Glib::RefPtr<const Set>& options)
676 {
677 GError* gerror = nullptr;
678 bool retvalue = gda_data_model_import_from_string(gobj(), string.c_str(), cols_trans, const_cast<GdaSet*>(Glib::unwrap(options)), &(gerror));
679 if(gerror)
680 ::Glib::Error::throw_exception(gerror);
681 return retvalue;
682 }
683
import_from_file(const std::string & file,GHashTable * cols_trans,const Glib::RefPtr<const Set> & options)684 bool DataModel::import_from_file(const std::string& file, GHashTable * cols_trans, const Glib::RefPtr<const Set>& options)
685 {
686 GError* gerror = nullptr;
687 bool retvalue = gda_data_model_import_from_file(gobj(), file.c_str(), cols_trans, const_cast<GdaSet*>(Glib::unwrap(options)), &(gerror));
688 if(gerror)
689 ::Glib::Error::throw_exception(gerror);
690 return retvalue;
691 }
692
dump(FILE * to_stream) const693 void DataModel::dump(FILE* to_stream) const
694 {
695 gda_data_model_dump(const_cast<GdaDataModel*>(gobj()), to_stream);
696 }
697
dump_as_string() const698 Glib::ustring DataModel::dump_as_string() const
699 {
700 return Glib::convert_return_gchar_ptr_to_ustring(gda_data_model_dump_as_string(const_cast<GdaDataModel*>(gobj())));
701 }
702
set_column_name(int col,const Glib::ustring & name)703 void DataModel::set_column_name(int col, const Glib::ustring& name)
704 {
705 gda_data_model_set_column_name(gobj(), col, name.c_str());
706 }
707
get_column_name(int col) const708 Glib::ustring DataModel::get_column_name(int col) const
709 {
710 return Glib::convert_const_gchar_ptr_to_ustring(gda_data_model_get_column_name(const_cast<GdaDataModel*>(gobj()), col));
711 }
712
iter_move_next_default(const Glib::RefPtr<DataModelIter> & iter)713 bool DataModel::iter_move_next_default(const Glib::RefPtr<DataModelIter>& iter)
714 {
715 return gda_data_model_iter_move_next_default(gobj(), Glib::unwrap(iter));
716 }
717
iter_move_prev_default(const Glib::RefPtr<DataModelIter> & iter)718 bool DataModel::iter_move_prev_default(const Glib::RefPtr<DataModelIter>& iter)
719 {
720 return gda_data_model_iter_move_prev_default(gobj(), Glib::unwrap(iter));
721 }
722
iter_move_to_row_default(const Glib::RefPtr<DataModelIter> & iter,int row)723 bool DataModel::iter_move_to_row_default(const Glib::RefPtr<DataModelIter>& iter, int row)
724 {
725 return gda_data_model_iter_move_to_row_default(gobj(), Glib::unwrap(iter), row);
726 }
727
728
signal_row_inserted()729 Glib::SignalProxy1< void,int > DataModel::signal_row_inserted()
730 {
731 return Glib::SignalProxy1< void,int >(this, &DataModel_signal_row_inserted_info);
732 }
733
734
signal_row_updated()735 Glib::SignalProxy1< void,int > DataModel::signal_row_updated()
736 {
737 return Glib::SignalProxy1< void,int >(this, &DataModel_signal_row_updated_info);
738 }
739
740
signal_row_removed()741 Glib::SignalProxy1< void,int > DataModel::signal_row_removed()
742 {
743 return Glib::SignalProxy1< void,int >(this, &DataModel_signal_row_removed_info);
744 }
745
746
signal_reset()747 Glib::SignalProxy0< void > DataModel::signal_reset()
748 {
749 return Glib::SignalProxy0< void >(this, &DataModel_signal_reset_info);
750 }
751
752
signal_changed()753 Glib::SignalProxy0< void > DataModel::signal_changed()
754 {
755 return Glib::SignalProxy0< void >(this, &DataModel_signal_changed_info);
756 }
757
758
on_row_inserted(int row)759 void Gnome::Gda::DataModel::on_row_inserted(int row)
760 {
761 const auto base = static_cast<BaseClassType*>(
762 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
763 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
764 ) );
765
766 if(base && base->row_inserted)
767 (*base->row_inserted)(gobj(),row);
768 }
on_row_updated(int row)769 void Gnome::Gda::DataModel::on_row_updated(int row)
770 {
771 const auto base = static_cast<BaseClassType*>(
772 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
773 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
774 ) );
775
776 if(base && base->row_updated)
777 (*base->row_updated)(gobj(),row);
778 }
on_row_removed(int row)779 void Gnome::Gda::DataModel::on_row_removed(int row)
780 {
781 const auto base = static_cast<BaseClassType*>(
782 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
783 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
784 ) );
785
786 if(base && base->row_removed)
787 (*base->row_removed)(gobj(),row);
788 }
on_reset()789 void Gnome::Gda::DataModel::on_reset()
790 {
791 const auto base = static_cast<BaseClassType*>(
792 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
793 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
794 ) );
795
796 if(base && base->reset)
797 (*base->reset)(gobj());
798 }
on_changed()799 void Gnome::Gda::DataModel::on_changed()
800 {
801 const auto base = static_cast<BaseClassType*>(
802 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
803 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
804 ) );
805
806 if(base && base->changed)
807 (*base->changed)(gobj());
808 }
809
810
811 } // namespace Gda
812
813 } // namespace Gnome
814
815
816