[couchdb-glib] Add functions for contact's postal addresses
- From: Rodrigo Moya <rodrigo src gnome org>
- To: svn-commits-list gnome org
- Subject: [couchdb-glib] Add functions for contact's postal addresses
- Date: Mon, 22 Jun 2009 07:02:04 -0400 (EDT)
commit 05ea33fd6595587a9a065d335b3596c5da12fcd9
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Mon Jun 22 12:31:16 2009 +0200
Add functions for contact's postal addresses
configure.ac | 2 +-
couchdb-glib/couchdb-document-contact.c | 144 +++++++++++++++++++++++++++++++
couchdb-glib/couchdb-document-contact.h | 22 +++++
3 files changed, 167 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 62690f6..4e3fa0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([couchdb-glib], [0.2], [], [couchdb-glib])
+AC_INIT([couchdb-glib], [0.3], [], [couchdb-glib])
AC_PREREQ([2.59])
diff --git a/couchdb-glib/couchdb-document-contact.c b/couchdb-glib/couchdb-document-contact.c
index 0e098e2..747f3e1 100644
--- a/couchdb-glib/couchdb-document-contact.c
+++ b/couchdb-glib/couchdb-document-contact.c
@@ -156,6 +156,31 @@ couchdb_document_contact_get_phone_numbers (CouchDBDocument *document)
return list;
}
+void
+couchdb_document_contact_set_phone_numbers (CouchDBDocument *document, GSList *list)
+{
+}
+
+GSList *
+couchdb_document_contact_get_addresses (CouchDBDocument *document)
+{
+ GSList *list = NULL;
+ JsonObject *addresses;
+
+ g_return_val_if_fail (COUCHDB_IS_DOCUMENT (document), NULL);
+ g_return_val_if_fail (couchdb_document_is_contact (document), NULL);
+
+ addresses = json_object_get_object_member (
+ json_node_get_object (document->root_node), "addresses");
+ if (addresses) {
+ json_object_foreach_member (addresses,
+ (JsonObjectForeach) foreach_object_cb,
+ &list);
+ }
+
+ return list;
+}
+
const char *
couchdb_document_contact_email_get_address (CouchDBStructField *sf)
{
@@ -239,3 +264,122 @@ couchdb_document_contact_phone_set_description (CouchDBStructField *sf, const ch
json_object_set_string_member (sf->json_object, "description", description);
}
+
+const char *
+couchdb_document_contact_address_get_street (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "address1");
+}
+
+void
+couchdb_document_contact_address_set_street (CouchDBStructField *sf, const char *street)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (street != NULL);
+
+ json_object_set_string_member (sf->json_object, "address1", street);
+}
+
+const char *
+couchdb_document_contact_address_get_city (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "city");
+}
+
+void
+couchdb_document_contact_address_set_city (CouchDBStructField *sf, const char *city)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (city != NULL);
+
+ json_object_set_string_member (sf->json_object, "city", city);
+}
+
+const char *
+couchdb_document_contact_address_get_state (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "state");
+}
+
+void
+couchdb_document_contact_address_set_state (CouchDBStructField *sf, const char *state)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (state != NULL);
+
+ json_object_set_string_member (sf->json_object, "state", state);
+}
+
+const char *
+couchdb_document_contact_address_get_country (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "country");
+}
+
+void
+couchdb_document_contact_address_set_country (CouchDBStructField *sf, const char *country)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (country != NULL);
+
+ json_object_set_string_member (sf->json_object, "country", country);
+}
+
+const char *
+couchdb_document_contact_address_get_postalcode (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "postalcode");
+}
+
+void
+couchdb_document_contact_address_set_postalcode (CouchDBStructField *sf, const char *postalcode)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (postalcode != NULL);
+
+ json_object_set_string_member (sf->json_object, "postalcode", postalcode);
+}
+
+const char *
+couchdb_document_contact_address_get_pobox (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "pobox");
+}
+
+void
+couchdb_document_contact_address_set_pobox (CouchDBStructField *sf, const char *pobox)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (pobox != NULL);
+
+ json_object_set_string_member (sf->json_object, "pobox", pobox);
+}
+
+const char *
+couchdb_document_contact_address_get_description (CouchDBStructField *sf)
+{
+ g_return_val_if_fail (sf != NULL, NULL);
+
+ return json_object_get_string_member (sf->json_object, "description");
+}
+
+void
+couchdb_document_contact_address_set_description (CouchDBStructField *sf, const char *description)
+{
+ g_return_if_fail (sf != NULL);
+ g_return_if_fail (description != NULL);
+
+ json_object_set_string_member (sf->json_object, "description", description);
+}
diff --git a/couchdb-glib/couchdb-document-contact.h b/couchdb-glib/couchdb-document-contact.h
index 01b6e5c..7571b4e 100644
--- a/couchdb-glib/couchdb-document-contact.h
+++ b/couchdb-glib/couchdb-document-contact.h
@@ -39,6 +39,10 @@ GSList *couchdb_document_contact_get_email_addresses (CouchDBDocument *docum
void couchdb_document_contact_set_email_addresses (CouchDBDocument *document, GSList *list);
GSList *couchdb_document_contact_get_phone_numbers (CouchDBDocument *document);
+void couchdb_document_contact_set_phone_numbers (CouchDBDocument *document, GSList *list);
+
+GSList *couchdb_document_contact_get_addresses (CouchDBDocument *document);
+void couchdb_document_contact_set_addresses (CouchDBDocument *document, GSList *list);
/*
* Utility functions to manipulate email addresses fields
@@ -60,4 +64,22 @@ void couchdb_document_contact_phone_set_number (CouchDBStructField *sf, c
const char *couchdb_document_contact_phone_get_description (CouchDBStructField *sf);
void couchdb_document_contact_phone_set_description (CouchDBStructField *sf, const char *description);
+/*
+ * Utility functions to manipulate addresses
+ */
+const char *couchdb_document_contact_address_get_street (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_street (CouchDBStructField *sf, const char *street);
+const char *couchdb_document_contact_address_get_city (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_city (CouchDBStructField *sf, const char *city);
+const char *couchdb_document_contact_address_get_state (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_state (CouchDBStructField *sf, const char *state);
+const char *couchdb_document_contact_address_get_country (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_country (CouchDBStructField *sf, const char *country);
+const char *couchdb_document_contact_address_get_postalcode (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_postalcode (CouchDBStructField *sf, const char *postalcode);
+const char *couchdb_document_contact_address_get_pobox (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_pobox (CouchDBStructField *sf, const char *pobox);
+const char *couchdb_document_contact_address_get_description (CouchDBStructField *sf);
+void couchdb_document_contact_address_set_description (CouchDBStructField *sf, const char *description);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]