[libgdamm] GeometricPoint: Wrap as an opaque boxed type.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdamm] GeometricPoint: Wrap as an opaque boxed type.
- Date: Mon, 30 Oct 2017 20:37:53 +0000 (UTC)
commit 6556165e7848422b7aa17ef796f26c19fee22e11
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Oct 29 22:31:52 2017 +0100
GeometricPoint: Wrap as an opaque boxed type.
Now that the C type is opaque (the implementation is not in
the header).
libgda/libgdamm/value.cc | 5 ++-
libgda/libgdamm/value.h | 2 +-
libgda/src/filelist.am | 1 +
libgda/src/geometricpoint.ccg | 29 +++++++++++++++++++++++++
libgda/src/geometricpoint.hg | 47 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 81 insertions(+), 3 deletions(-)
---
diff --git a/libgda/libgdamm/value.cc b/libgda/libgdamm/value.cc
index fbba312..8022cf3 100644
--- a/libgda/libgdamm/value.cc
+++ b/libgda/libgdamm/value.cc
@@ -380,12 +380,13 @@ void Value::set_double(double val)
GeometricPoint Value::get_geometric_point() const
{
- return *(gda_value_get_geometric_point(const_cast<GValue*>(gobj())));
+ const GdaGeometricPoint* cobj = gda_value_get_geometric_point(const_cast<GValue*>(gobj()));
+ return Glib::wrap(const_cast<GdaGeometricPoint*>(cobj), true /* take_copy */);
}
void Value::set(const GeometricPoint& val)
{
- gda_value_set_geometric_point(gobj(), &(val));
+ gda_value_set_geometric_point(gobj(), val.gobj());
}
int Value::get_int() const
diff --git a/libgda/libgdamm/value.h b/libgda/libgdamm/value.h
index da76ac6..074bad1 100644
--- a/libgda/libgdamm/value.h
+++ b/libgda/libgdamm/value.h
@@ -26,6 +26,7 @@
*/
#include <libgdamm/numeric.h>
+#include <libgdamm/geometricpoint.h>
#include <glibmm/value.h>
#include <glibmm/date.h>
#include <libgda/gda-value.h> //TODO: Patch libgda to use the struct _ technique.
@@ -37,7 +38,6 @@ namespace Gnome
namespace Gda
{
-typedef GdaGeometricPoint GeometricPoint;
typedef GdaTime Time;
typedef GdaTimestamp Timestamp;
diff --git a/libgda/src/filelist.am b/libgda/src/filelist.am
index 4870fe5..c8af655 100644
--- a/libgda/src/filelist.am
+++ b/libgda/src/filelist.am
@@ -26,6 +26,7 @@ files_hg = \
datamodeliter.hg \
dataproxy.hg \
dataselect.hg \
+ geometricpoint.hg \
handlerbin.hg \
handlerboolean.hg \
handlernumerical.hg \
diff --git a/libgda/src/geometricpoint.ccg b/libgda/src/geometricpoint.ccg
new file mode 100644
index 0000000..370db04
--- /dev/null
+++ b/libgda/src/geometricpoint.ccg
@@ -0,0 +1,29 @@
+/* Copyright 2011 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgda/gda-value.h>
+
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+} /* namespace Gda */
+
+} /* namespace Gnome */
diff --git a/libgda/src/geometricpoint.hg b/libgda/src/geometricpoint.hg
new file mode 100644
index 0000000..4dc1aa6
--- /dev/null
+++ b/libgda/src/geometricpoint.hg
@@ -0,0 +1,47 @@
+/* Copyright 2011 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or(at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/ustring.h>
+#include <glibmm/value.h>
+
+_DEFS(libgdamm,libgda)
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+
+/** TODO
+ */
+class GeometricPoint
+{
+ _CLASS_BOXEDTYPE(GeometricPoint, GdaGeometricPoint, gda_geometric_point_new, gda_geometric_point_copy,
gda_geometric_point_free)
+ _IGNORE(gda_geometric_point_new, gda_geometric_point_copy, gda_geometric_point_free)
+public:
+
+ _WRAP_METHOD(double get_x() const, gda_geometric_point_get_x)
+ _WRAP_METHOD(void set_x(double x), gda_geometric_point_set_x)
+ _WRAP_METHOD(int get_y() const, gda_geometric_point_get_y)
+ _WRAP_METHOD(void set_y(double y), gda_geometric_point_set_y)
+};
+
+
+} // namespace Gda
+} // namespace Gnome
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]