summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2011-10-19 21:18:23 (GMT)
committerTravis Reitter <travis.reitter@collabora.co.uk>2011-10-24 18:34:16 (GMT)
commite66fba36c1ef69674aca7b631debbc47928952b1 (patch)
tree36c5ed6abca5a0da43cb57f21c87c97e6f3701fe
parent67bd5f4e8b8a1b59354b08b8945ed5201b8a3eb4 (diff)
downloadfolks-e66fba36c1ef69674aca7b631debbc47928952b1.tar.gz
folks-e66fba36c1ef69674aca7b631debbc47928952b1.tar.xz
Always include parameters in AFD-derived subclass equal() functions.
Helps: bgo#662433 - AbstractFieldDetails.equal() is ambiguous about checking parameters.
-rw-r--r--folks/abstract-field-details.vala19
-rw-r--r--folks/note-details.vala4
-rw-r--r--folks/phone-details.vala4
-rw-r--r--folks/postal-address-details.vala3
-rw-r--r--folks/role-details.vala4
5 files changed, 31 insertions, 3 deletions
diff --git a/folks/abstract-field-details.vala b/folks/abstract-field-details.vala
index ec74bfb..e36a8da 100644
--- a/folks/abstract-field-details.vala
+++ b/folks/abstract-field-details.vala
@@ -239,6 +239,25 @@ public abstract class Folks.AbstractFieldDetails<T> : Object
return this.parameters_equal<T> (that);
}
+ /**
+ * An equality function which only considers parameters.
+ *
+ * This function compares:
+ * * {@link AbstractFieldDetails.parameters}
+ *
+ * And does not compare:
+ * * {@link AbstractFieldDetails.value}s
+ * * {@link AbstractFieldDetails.id}s
+ *
+ * @param that another {@link AbstractFieldDetails}
+ *
+ * @return whether the elements' {@link AbstractFieldDetails.value}s are
+ * equal.
+ *
+ * @see AbstractFieldDetails.equal
+ * @see AbstractFieldDetails.values_equal
+ * @since UNRELEASED
+ */
public virtual bool parameters_equal (AbstractFieldDetails<T> that)
{
/* Check that the parameter names and their values match exactly in both
diff --git a/folks/note-details.vala b/folks/note-details.vala
index c11a699..4b8f14e 100644
--- a/folks/note-details.vala
+++ b/folks/note-details.vala
@@ -67,8 +67,10 @@ public class Folks.NoteFieldDetails : AbstractFieldDetails<string>
*/
public override bool equal (AbstractFieldDetails<string> that)
{
- var that_nfd = that as NoteFieldDetails;
+ if (!base.equal<string> (that))
+ return false;
+ var that_nfd = that as NoteFieldDetails;
if (that_nfd == null)
return false;
diff --git a/folks/phone-details.vala b/folks/phone-details.vala
index f4c61a8..8491822 100644
--- a/folks/phone-details.vala
+++ b/folks/phone-details.vala
@@ -68,8 +68,10 @@ public class Folks.PhoneFieldDetails : AbstractFieldDetails<string>
*/
public override bool equal (AbstractFieldDetails<string> that)
{
- var that_fd = that as PhoneFieldDetails;
+ if (!base.equal<string> (that))
+ return false;
+ var that_fd = that as PhoneFieldDetails;
if (that_fd == null)
return false;
diff --git a/folks/postal-address-details.vala b/folks/postal-address-details.vala
index 6d77800..e77d83f 100644
--- a/folks/postal-address-details.vala
+++ b/folks/postal-address-details.vala
@@ -252,6 +252,9 @@ public class Folks.PostalAddressFieldDetails :
*/
public override bool equal (AbstractFieldDetails<PostalAddress> that)
{
+ if (!base.parameters_equal<PostalAddress> (that))
+ return false;
+
/* This is fairly-dumb but smart matching is an i10n nightmare. */
return this.value.to_string () == that.value.to_string ();
}
diff --git a/folks/role-details.vala b/folks/role-details.vala
index 62cc712..1590c4a 100644
--- a/folks/role-details.vala
+++ b/folks/role-details.vala
@@ -167,10 +167,12 @@ public class Folks.RoleFieldDetails : AbstractFieldDetails<Role>
public override bool equal (AbstractFieldDetails<Role> that)
{
var that_fd = that as RoleFieldDetails;
-
if (that_fd == null)
return false;
+ if (!base.parameters_equal<Role> (that))
+ return false;
+
return Role.equal (this.value, that_fd.value);
}