[couchdb-glib] Added couchdb_document_contact_address_new function



commit e8bb573bf5f8b27ff035d9e8c2cc4a7562ca441e
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Wed Jun 24 18:00:54 2009 +0200

    Added couchdb_document_contact_address_new function

 couchdb-glib/couchdb-document-contact.c |   30 ++++++++++++++++++++++++++
 couchdb-glib/couchdb-document-contact.h |   35 ++++++++++++++++++------------
 2 files changed, 51 insertions(+), 14 deletions(-)
---
diff --git a/couchdb-glib/couchdb-document-contact.c b/couchdb-glib/couchdb-document-contact.c
index 6bafc4f..ed055ff 100644
--- a/couchdb-glib/couchdb-document-contact.c
+++ b/couchdb-glib/couchdb-document-contact.c
@@ -389,6 +389,36 @@ couchdb_document_contact_phone_set_description (CouchDBStructField *sf, const ch
 	json_object_set_string_member (sf->json_object, "description", description);
 }
 
+CouchDBStructField *
+couchdb_document_contact_address_new (const char *street,
+				      const char *city,
+				      const char *state,
+				      const char *country,
+				      const char *postalcode,
+				      const char *pobox,
+				      const char *description)
+{
+	CouchDBStructField *sf;
+
+	sf = couchdb_struct_field_new_from_json_object (json_object_new ());
+	if (street)
+		couchdb_document_contact_address_set_street (sf, street);
+	if (city)
+		couchdb_document_contact_address_set_city (sf, city);
+	if (state)
+		couchdb_document_contact_address_set_state (sf, state);
+	if (country)
+		couchdb_document_contact_address_set_country (sf, country);
+	if (postalcode)
+		couchdb_document_contact_address_set_postalcode (sf, postalcode);
+	if (pobox)
+		couchdb_document_contact_address_set_pobox (sf, pobox);
+	if (description)
+		couchdb_document_contact_address_set_description (sf, description);
+
+	return sf;
+}
+
 const char *
 couchdb_document_contact_address_get_street (CouchDBStructField *sf)
 {
diff --git a/couchdb-glib/couchdb-document-contact.h b/couchdb-glib/couchdb-document-contact.h
index 47e044a..e1224bf 100644
--- a/couchdb-glib/couchdb-document-contact.h
+++ b/couchdb-glib/couchdb-document-contact.h
@@ -69,19 +69,26 @@ void                couchdb_document_contact_phone_set_description (CouchDBStruc
 /*
  * 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);
+CouchDBStructField *couchdb_document_contact_address_new (const char *street,
+							  const char *city,
+							  const char *state,
+							  const char *country,
+							  const char *postalcode,
+							  const char *pobox,
+							  const char *description);
+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]