birthday-details.vala \
email-details.vala \
favourite-details.vala \
- field-details.vala \
gender-details.vala \
group-details.vala \
web-service-details.vala \
+++ /dev/null
-/*
- * 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 ();
- }
-}
# in order from least to most complex
noinst_PROGRAMS = \
- field-details \
+ abstract-field-details \
utils \
backend-loading \
aggregation \
aggregation.vala \
$(NULL)
-field_details_SOURCES = \
- field-details.vala \
+abstract_field_details_SOURCES = \
+ abstract-field-details.vala \
$(NULL)
utils_SOURCES = \
$(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 \
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);
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);
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));
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 */
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));
}
}
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 ();
{
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)
{