[folks] Added equal method to PostalAddress



commit cc94fe53590cdfe0867696f5a52332a69ab8a4e5
Author: Raul Gutierrez Segales <raul gutierrez segales collabora co uk>
Date:   Fri Mar 4 21:56:33 2011 +0000

    Added equal method to PostalAddress

 NEWS                            |    1 +
 folks/postal-address-owner.vala |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index ac810f8..bb07dba 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ API changes:
 * Add NoteOwner interface
 * Add PostalAddressOwner interface
 * Add PostalAddressOwner.uid as a convenience for backends
+* Add PostalAddress.equal()
 
 Overview of changes from libfolks 0.3.5 to libfolks 0.3.6
 =========================================================
diff --git a/folks/postal-address-owner.vala b/folks/postal-address-owner.vala
index 91198fe..b487a85 100644
--- a/folks/postal-address-owner.vala
+++ b/folks/postal-address-owner.vala
@@ -184,6 +184,29 @@ public class Folks.PostalAddress : Object
               types:          types,
               uid:            uid);
     }
+
+  public bool equal (PostalAddress with)
+    {
+      if (this.po_box != with.po_box ||
+          this.extension != with.extension ||
+          this.street != with.street ||
+          this.locality != with.locality ||
+          this.region != with.region ||
+          this.postal_code != with.postal_code ||
+          this.country != with.country ||
+          this.address_format != with.address_format ||
+          this.types.length () != with.types.length () ||
+          this.uid != with.uid)
+        return false;
+
+      for (int i=0; i<this.types.length (); i++)
+        {
+          if (this.types.nth_data (i) != with.types.nth_data (i))
+            return false;
+        }
+
+      return true;
+    }
 }
 
 /**



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