Remove FieldDetails (obsoleted by AbstractFieldDetails and implementors)
authorTravis Reitter <travis.reitter@collabora.co.uk>
Thu, 11 Aug 2011 14:44:53 +0000 (16:44 +0200)
committerTravis Reitter <travis.reitter@collabora.co.uk>
Fri, 12 Aug 2011 15:54:38 +0000 (17:54 +0200)
folks/Makefile.am
folks/field-details.vala [deleted file]
tests/folks/Makefile.am
tests/folks/abstract-field-details.vala [moved from tests/folks/field-details.vala with 88% similarity]
tools/inspect/utils.vala

index e71c637..1fde141 100644 (file)
@@ -20,7 +20,6 @@ libfolks_la_SOURCES = \
        birthday-details.vala \
        email-details.vala \
        favourite-details.vala \
-       field-details.vala \
        gender-details.vala \
        group-details.vala \
        web-service-details.vala \
diff --git a/folks/field-details.vala b/folks/field-details.vala
deleted file mode 100644 (file)
index 73950c4..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2011 Collabora Ltd.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- *       Marco Barisione <marco.barisione@collabora.co.uk>
- *       Travis Reitter <travis.reitter@collabora.co.uk>
- */
-
-using GLib;
-using Gee;
-
-/**
- * Object representing any type of string value that can have some vCard-like
- * parameters associated with it.
- *
- * Some contact details, like phone numbers or URLs, can have some
- * extra details associated with them.
- * For instance, a phone number expressed in vcard notation as
- * `tel;type=work,voice:(111) 555-1234` would be represented as
- * a AbstractFieldDetails with value "(111) 555-1234" and with parameters
- * `['type': ('work', 'voice')]`.
- *
- * @since UNRELEASED
- */
-public class Folks.FieldDetails : AbstractFieldDetails<string>
-{
-  /**
-   * Create a new FieldDetails.
-   *
-   * @param value the value of the field
-   * @param parameters initial parameters. See
-   * {@link AbstractFieldDetails.parameters}. A `null` value is equivalent to an
-   * empty map of parameters.
-   *
-   * @return a new FieldDetails
-   *
-   * @since 0.3.5
-   */
-  public FieldDetails (string value,
-      MultiMap<string, string>? parameters = null)
-    {
-      this.value = value;
-      if (parameters != null)
-        this.parameters = parameters;
-    }
-
-  /**
-   * {@inheritDoc}
-   *
-   * @since UNRELEASED
-   */
-  public override bool equal (AbstractFieldDetails<string> that)
-    {
-      return base.equal<string> (that);
-    }
-
-  /**
-   * {@inheritDoc}
-   *
-   * @since UNRELEASED
-   */
-  public override uint hash ()
-    {
-      return base.hash ();
-    }
-}
index 0d24b12..cbb895b 100644 (file)
@@ -39,7 +39,7 @@ AM_VALAFLAGS = \
 
 # in order from least to most complex
 noinst_PROGRAMS = \
-       field-details \
+       abstract-field-details \
        utils \
        backend-loading \
        aggregation \
@@ -69,8 +69,8 @@ aggregation_SOURCES = \
        aggregation.vala \
        $(NULL)
 
-field_details_SOURCES = \
-       field-details.vala \
+abstract_field_details_SOURCES = \
+       abstract-field-details.vala \
        $(NULL)
 
 utils_SOURCES = \
@@ -95,7 +95,7 @@ MAINTAINERCLEANFILES = \
         $(addsuffix .c,$(noinst_PROGRAMS)) \
         backend_loading_vala.stamp \
         aggregation_vala.stamp \
-        field_details_vala.stamp \
+        abstract_field_details_vala.stamp \
         utils_vala.stamp \
         avatar_cache_vala.stamp \
         object_cache_vala.stamp \
similarity index 88%
rename from tests/folks/field-details.vala
rename to tests/folks/abstract-field-details.vala
index 3b94573..ed3cdd4 100644 (file)
 using Gee;
 using Folks;
 
-public class FieldDetailsTests : Folks.TestCase
+public class EmailFieldDetailsTests : Folks.TestCase
 {
-  public FieldDetailsTests ()
+  public EmailFieldDetailsTests ()
     {
-      base ("FieldDetails");
+      base ("EmailFieldDetails");
       this.add_test ("parameter replacement", this.test_param_replacement);
       this.add_test ("simple equality", this.test_simple_equality);
       this.add_test ("parameter equality", this.test_params_equality);
@@ -45,10 +45,10 @@ public class FieldDetailsTests : Folks.TestCase
       string param_name = "metasyntactic-variables";
       string[] values_1 = {"foo", "bar", "baz"};
       string[] values_2 = {"qux", "quxx"};
-      FieldDetails details;
+      EmailFieldDetails details;
       Collection<string> values;
 
-      details = new FieldDetails (param_name);
+      details = new EmailFieldDetails (param_name);
 
       foreach (var val in values_1)
         details.add_parameter (param_name, val);
@@ -93,9 +93,9 @@ public class FieldDetailsTests : Folks.TestCase
 
   public void test_simple_equality ()
     {
-      FieldDetails details_a_1 = new FieldDetails ("foo");
-      FieldDetails details_a_2 = new FieldDetails ("foo");
-      FieldDetails details_b_1 = new FieldDetails ("bar");
+      EmailFieldDetails details_a_1 = new EmailFieldDetails ("foo");
+      EmailFieldDetails details_a_2 = new EmailFieldDetails ("foo");
+      EmailFieldDetails details_b_1 = new EmailFieldDetails ("bar");
 
       /* Very-basic comparisons */
       assert (details_a_1.equal (details_a_2));
@@ -106,8 +106,8 @@ public class FieldDetailsTests : Folks.TestCase
 
   public void test_params_equality ()
     {
-      FieldDetails details_a_1 = new FieldDetails ("foo");
-      FieldDetails details_a_2 = new FieldDetails ("foo");
+      EmailFieldDetails details_a_1 = new EmailFieldDetails ("foo");
+      EmailFieldDetails details_a_2 = new EmailFieldDetails ("foo");
 
       /* Add the parameters differently to the two instances to ensure these
        * methods work as expected */
@@ -162,7 +162,7 @@ public class FieldDetailsTests : Folks.TestCase
       assert (!details_a_1.equal (details_b_1));
 
       /* Comparing different derived classes */
-      FieldDetails details_c_1 = new FieldDetails ("foo@example.org");
+      EmailFieldDetails details_c_1 = new EmailFieldDetails ("foo@example.org");
       assert (!details_a_1.equal (details_c_1));
     }
 }
@@ -172,7 +172,7 @@ public int main (string[] args)
   Test.init (ref args);
 
   TestSuite root = TestSuite.get_root ();
-  root.add_suite (new FieldDetailsTests ().get_suite ());
+  root.add_suite (new EmailFieldDetailsTests ().get_suite ());
 
   Test.run ();
 
index 66c9f29..4d68e39 100644 (file)
@@ -346,8 +346,8 @@ private class Folks.Inspect.Utils
         {
           output_string = "{ ";
           bool first = true;
-          Set<FieldDetails> prop_list =
-              (Set<FieldDetails>) prop_value.get_object ();
+          var prop_list =
+              (Set<AbstractFieldDetails<string>>) prop_value.get_object ();
 
           foreach (var p in prop_list)
             {