[geocode-glib] bounding-box: Add equality method



commit 9eba9f7ffcabb5d00cf015d532a0f74107ffbeae
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Nov 14 15:44:28 2016 +0000

    bounding-box: Add equality method
    
    Add a method for checking that two #GeocodeBoundingBox instances are
    equal. This will be used in upcoming commits.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774631

 geocode-glib/geocode-bounding-box.c |   26 ++++++++++++++++++++++++++
 geocode-glib/geocode-bounding-box.h |    3 +++
 geocode-glib/geocode-glib.symbols   |    1 +
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/geocode-glib/geocode-bounding-box.c b/geocode-glib/geocode-bounding-box.c
index b1cd1f8..cb32258 100644
--- a/geocode-glib/geocode-bounding-box.c
+++ b/geocode-glib/geocode-bounding-box.c
@@ -275,6 +275,32 @@ geocode_bounding_box_new (gdouble top,
 }
 
 /**
+ * geocode_bounding_box_equal:
+ * @a: a bounding box
+ * @b: another bounding box
+ *
+ * Compare two #GeocodeBoundingBox instances for equality. This compares all
+ * fields and only returns %TRUE if the instances are exactly equal.
+ *
+ * Both instances must be non-%NULL.
+ *
+ * Returns: %TRUE if the instances are equal, %FALSE otherwise
+ * Since: UNRELEASED
+ */
+gboolean
+geocode_bounding_box_equal (GeocodeBoundingBox *a,
+                            GeocodeBoundingBox *b)
+{
+        g_return_val_if_fail (GEOCODE_IS_BOUNDING_BOX (a), FALSE);
+        g_return_val_if_fail (GEOCODE_IS_BOUNDING_BOX (b), FALSE);
+
+        return (a->priv->top == b->priv->top &&
+                a->priv->bottom == b->priv->bottom &&
+                a->priv->left == b->priv->left &&
+                a->priv->right == b->priv->right);
+}
+
+/**
  * geocode_bounding_box_get_top:
  * @bbox: a #GeocodeBoundingBox
  *
diff --git a/geocode-glib/geocode-bounding-box.h b/geocode-glib/geocode-bounding-box.h
index 8cc43b6..d0d6c97 100644
--- a/geocode-glib/geocode-bounding-box.h
+++ b/geocode-glib/geocode-bounding-box.h
@@ -71,6 +71,9 @@ GeocodeBoundingBox *geocode_bounding_box_new  (gdouble top,
                                                gdouble left,
                                                gdouble right);
 
+gboolean geocode_bounding_box_equal     (GeocodeBoundingBox *a,
+                                         GeocodeBoundingBox *b);
+
 gdouble geocode_bounding_box_get_top    (GeocodeBoundingBox *bbox);
 gdouble geocode_bounding_box_get_bottom (GeocodeBoundingBox *bbox);
 gdouble geocode_bounding_box_get_left   (GeocodeBoundingBox *bbox);
diff --git a/geocode-glib/geocode-glib.symbols b/geocode-glib/geocode-glib.symbols
index 76067de..1ab3425 100644
--- a/geocode-glib/geocode-glib.symbols
+++ b/geocode-glib/geocode-glib.symbols
@@ -77,6 +77,7 @@ geocode_place_get_osm_id
 geocode_place_get_osm_type
 geocode_bounding_box_get_type
 geocode_bounding_box_new
+geocode_bounding_box_equal
 geocode_bounding_box_get_top
 geocode_bounding_box_get_bottom
 geocode_bounding_box_get_left


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]