]> err.no Git - libchamplain/commitdiff
Bindings for ChamplainBaseMarker
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Sun, 12 Apr 2009 07:16:48 +0000 (09:16 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 13 Apr 2009 00:08:25 +0000 (20:08 -0400)
bindings/perl/Champlain/MANIFEST
bindings/perl/Champlain/maps
bindings/perl/Champlain/t/ChamplainBaseMarker.t [new file with mode: 0644]
bindings/perl/Champlain/xs/ChamplainBaseMarker.c [new file with mode: 0644]
bindings/perl/Champlain/xs/ChamplainBaseMarker.xs [new file with mode: 0644]

index 085b6caeddf3dbc66c9cd3171c7b3f7ca68cd442..a414e2862c456453812082e0153de53917fdd3c7 100644 (file)
@@ -8,6 +8,7 @@ maps
 maps-gtk
 champlain-perl.h
 xs/Champlain.xs
+xs/ChamplainBaseMarker.xs
 xs/ChamplainLayer.xs
 xs/ChamplainMapSource.xs
 xs/ChamplainMarker.xs
@@ -17,6 +18,7 @@ xs/ChamplainView.xs
 xs/ChamplainZoomLevel.xs
 xs/Gtk2ChamplainViewEmbed.xs
 t/Champlain.t
+t/ChamplainBaseMarker.t
 t/ChamplainLayer.t
 t/ChamplainMapSource.t
 t/ChamplainMarker.t
index 65a3b2c7bdcf6a6a6c499950bbf9ac364769f669..43ec21652d581fb092700beb35e0846241395190 100644 (file)
@@ -1,6 +1,7 @@
 CHAMPLAIN_TYPE_VIEW                ChamplainView              GObject  Champlain::View
 CHAMPLAIN_TYPE_VIEW_SCROLL_MODE    ChamplainScrollMode        GEnum    Champlain::ScrollMode
 CHAMPLAIN_TYPE_LAYER               ChamplainLayer             GObject  Champlain::Layer
+CHAMPLAIN_TYPE_BASE_MARKER         ChamplainBaseMarker        GObject  Champlain::BaseMarker
 CHAMPLAIN_TYPE_MARKER              ChamplainMarker            GObject  Champlain::Marker
 CHAMPLAIN_TYPE_MAP_SOURCE          ChamplainMapSource         GObject  Champlain::MapSource
 CHAMPLAIN_TYPE_ZOOM_LEVEL          ChamplainZoomLevel         GObject  Champlain::ZoomLevel
diff --git a/bindings/perl/Champlain/t/ChamplainBaseMarker.t b/bindings/perl/Champlain/t/ChamplainBaseMarker.t
new file mode 100644 (file)
index 0000000..80ae725
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Clutter::TestHelper tests => 5;
+
+use Champlain;
+
+
+exit tests();
+
+
+sub tests {
+       my $marker = Champlain::BaseMarker->new();
+       isa_ok($marker, 'Champlain::BaseMarker');
+
+       my ($latitude, $longitude) = $marker->get('latitude', 'longitude');
+       is($latitude, 0.0, "Initial latitude is at 0.0");
+       is($longitude, 0.0, "Initial longitude is at 0.0");
+
+       $marker->set_position(20.0, 40.0);
+       ($latitude, $longitude) = $marker->get('latitude', 'longitude');
+       is($latitude, 20.0, "set_position() changed the latitude");
+       is($longitude, 40.0, "set_position() changed the longitude");
+
+       return 0;
+}
+
diff --git a/bindings/perl/Champlain/xs/ChamplainBaseMarker.c b/bindings/perl/Champlain/xs/ChamplainBaseMarker.c
new file mode 100644 (file)
index 0000000..b909501
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * This file was generated automatically by ExtUtils::ParseXS version 2.19 from the
+ * contents of ChamplainBaseMarker.xs. Do not edit this file, edit ChamplainBaseMarker.xs instead.
+ *
+ *     ANY CHANGES MADE HERE WILL BE LOST! 
+ *
+ */
+
+#line 1 "xs/ChamplainBaseMarker.xs"
+#include "champlain-perl.h"
+
+
+#ifndef PERL_UNUSED_VAR
+#  define PERL_UNUSED_VAR(var) if (0) var = var
+#endif
+
+#line 18 "xs/ChamplainBaseMarker.c"
+
+XS(XS_Champlain__BaseMarker_new); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Champlain__BaseMarker_new)
+{
+#ifdef dVAR
+    dVAR; dXSARGS;
+#else
+    dXSARGS;
+#endif
+    if (items != 1)
+       Perl_croak(aTHX_ "Usage: %s(%s)", "Champlain::BaseMarker::new", "class");
+    PERL_UNUSED_VAR(cv); /* -W */
+    {
+       ClutterActor *  RETVAL;
+
+       RETVAL = champlain_base_marker_new(/* No args */);
+       ST(0) = newSVClutterActor (RETVAL);
+
+       sv_2mortal(ST(0));
+    }
+    XSRETURN(1);
+}
+
+
+XS(XS_Champlain__BaseMarker_set_position); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Champlain__BaseMarker_set_position)
+{
+#ifdef dVAR
+    dVAR; dXSARGS;
+#else
+    dXSARGS;
+#endif
+    if (items != 3)
+       Perl_croak(aTHX_ "Usage: %s(%s)", "Champlain::BaseMarker::set_position", "marker, longitude, latitude");
+    PERL_UNUSED_VAR(cv); /* -W */
+    {
+       ChamplainBaseMarker *   marker = SvChamplainBaseMarker (ST(0));
+       gdouble longitude = (double)SvNV(ST(1));
+       gdouble latitude = (double)SvNV(ST(2));
+
+       champlain_base_marker_set_position(marker, longitude, latitude);
+    }
+    XSRETURN_EMPTY;
+}
+
+#ifdef __cplusplus
+extern "C"
+#endif
+XS(boot_Champlain__BaseMarker); /* prototype to pass -Wmissing-prototypes */
+XS(boot_Champlain__BaseMarker)
+{
+#ifdef dVAR
+    dVAR; dXSARGS;
+#else
+    dXSARGS;
+#endif
+    char* file = __FILE__;
+
+    PERL_UNUSED_VAR(cv); /* -W */
+    PERL_UNUSED_VAR(items); /* -W */
+    XS_VERSION_BOOTCHECK ;
+
+        newXS("Champlain::BaseMarker::new", XS_Champlain__BaseMarker_new, file);
+        newXS("Champlain::BaseMarker::set_position", XS_Champlain__BaseMarker_set_position, file);
+    if (PL_unitcheckav)
+         call_list(PL_scopestack_ix, PL_unitcheckav);
+    XSRETURN_YES;
+}
+
diff --git a/bindings/perl/Champlain/xs/ChamplainBaseMarker.xs b/bindings/perl/Champlain/xs/ChamplainBaseMarker.xs
new file mode 100644 (file)
index 0000000..b924702
--- /dev/null
@@ -0,0 +1,16 @@
+#include "champlain-perl.h"
+
+
+MODULE = Champlain::BaseMarker  PACKAGE = Champlain::BaseMarker  PREFIX = champlain_base_marker_
+
+PROTOTYPES: DISABLE
+
+
+ClutterActor*
+champlain_base_marker_new (class)
+       C_ARGS: /* No args */
+
+
+void
+champlain_base_marker_set_position (ChamplainBaseMarker *marker, gdouble longitude, gdouble latitude)
+