[couchdb-glib] Added couchdb_document_has_field API function
- From: Rodrigo Moya <rodrigo src gnome org>
- To: svn-commits-list gnome org
- Subject: [couchdb-glib] Added couchdb_document_has_field API function
- Date: Fri, 12 Jun 2009 07:56:49 -0400 (EDT)
commit 44216802e9ef7576a48a396f7635706b999140b7
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Fri Jun 12 13:25:09 2009 +0200
Added couchdb_document_has_field API function
couchdb-glib/couchdb-document.c | 12 ++++++++++++
couchdb-glib/couchdb-glib.h | 1 +
couchdb-glib/utils.h | 4 ----
3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/couchdb-glib/couchdb-document.c b/couchdb-glib/couchdb-document.c
index 64be2e4..587b532 100644
--- a/couchdb-glib/couchdb-document.c
+++ b/couchdb-glib/couchdb-document.c
@@ -146,6 +146,18 @@ couchdb_document_get_revision (CouchDBDocument *document)
}
gboolean
+couchdb_document_has_field (CouchDBDocument *document, const char *field)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (COUCHDB_IS_DOCUMENT (document), FALSE);
+ g_return_val_if_fail (field != NULL, FALSE);
+
+ return json_object_get_member (json_node_get_object (document->root_node),
+ field) ? TRUE : FALSE;
+}
+
+gboolean
couchdb_document_get_boolean_field (CouchDBDocument *document, const char *field)
{
g_return_val_if_fail (COUCHDB_IS_DOCUMENT (document), FALSE);
diff --git a/couchdb-glib/couchdb-glib.h b/couchdb-glib/couchdb-glib.h
index 7e8d6a4..2d1064a 100644
--- a/couchdb-glib/couchdb-glib.h
+++ b/couchdb-glib/couchdb-glib.h
@@ -80,6 +80,7 @@ void couchdb_document_set_id (CouchDBDocument *document, const char
const char *couchdb_document_get_revision (CouchDBDocument *document);
+gboolean couchdb_document_has_field (CouchDBDocument *document, const char *field);
gboolean couchdb_document_get_boolean_field (CouchDBDocument *document, const char *field);
void couchdb_document_set_boolean_field (CouchDBDocument *document, const char *field, gboolean value);
gint couchdb_document_get_int_field (CouchDBDocument *document, const char *field);
diff --git a/couchdb-glib/utils.h b/couchdb-glib/utils.h
index fbfbba5..ba6b17f 100644
--- a/couchdb-glib/utils.h
+++ b/couchdb-glib/utils.h
@@ -32,10 +32,6 @@ struct _CouchDB {
SoupSession *http_session;
};
-struct _CouchDBObject {
- JsonNode *root_node;
-};
-
struct _CouchDBDatabaseInfo {
gint ref_count;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]