[evolution-data-server] Add e_cal_component_id_hash().



commit 8eb84c0795a186184e6a08adb81d918ce0e66f5e
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Mar 16 17:51:55 2013 -0400

    Add e_cal_component_id_hash().

 calendar/libecal/e-cal-component.c                 |   24 ++++++++++++++++++++
 calendar/libecal/e-cal-component.h                 |    1 +
 .../calendar/libecal/libecal-sections.txt          |    1 +
 3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index f54ec45..bb9774c 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -5221,6 +5221,30 @@ e_cal_component_id_copy (const ECalComponentId *id)
 }
 
 /**
+ * e_cal_component_id_hash:
+ * @id: an #ECalComponentId
+ *
+ * Generates a hash value for @id.
+ *
+ * Returns: a hash value for @id
+ *
+ * Since: 3.10
+ **/
+guint
+e_cal_component_id_hash (const ECalComponentId *id)
+{
+       guint uid_hash;
+       guint rid_hash;
+
+       g_return_val_if_fail (id != NULL, 0);
+
+       uid_hash = g_str_hash (id->uid);
+       rid_hash = (id->rid != NULL) ? g_str_hash (id->rid) : 0;
+
+       return uid_hash ^ rid_hash;
+}
+
+/**
  * e_cal_component_free_text_list:
  * @text_list: (element-type ECalComponentText): List of #ECalComponentText
  * structures.
diff --git a/calendar/libecal/e-cal-component.h b/calendar/libecal/e-cal-component.h
index 57df4d9..61f22eb 100644
--- a/calendar/libecal/e-cal-component.h
+++ b/calendar/libecal/e-cal-component.h
@@ -232,6 +232,7 @@ void e_cal_component_set_uid (ECalComponent *comp, const gchar *uid);
 ECalComponentId *e_cal_component_get_id (ECalComponent *comp);
 void e_cal_component_free_id (ECalComponentId *id);
 ECalComponentId *e_cal_component_id_copy (const ECalComponentId *id);
+guint e_cal_component_id_hash (const ECalComponentId *id);
 
 void e_cal_component_get_categories (ECalComponent *comp, const gchar **categories);
 void e_cal_component_set_categories (ECalComponent *comp, const gchar *categories);
diff --git a/docs/reference/calendar/libecal/libecal-sections.txt 
b/docs/reference/calendar/libecal/libecal-sections.txt
index 921a0ad..1cf48c5 100644
--- a/docs/reference/calendar/libecal/libecal-sections.txt
+++ b/docs/reference/calendar/libecal/libecal-sections.txt
@@ -257,6 +257,7 @@ e_cal_component_set_uid
 e_cal_component_get_id
 e_cal_component_free_id
 e_cal_component_id_copy
+e_cal_component_id_hash
 e_cal_component_get_categories
 e_cal_component_set_categories
 e_cal_component_get_categories_list


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