|  |  |  | Reference Manual for CouchDB GLib Bindings |  | 
|---|---|---|---|---|
| Top | Description | ||||
CouchdbStructFieldClass; CouchdbStructField * couchdb_struct_field_new (void); CouchdbStructField * couchdb_struct_field_new_from_string (const char *str); gboolean couchdb_struct_field_has_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_remove_field (CouchdbStructField *sf,const char *field); GSList * couchdb_struct_field_get_field_names (CouchdbStructField *sf); GType couchdb_struct_field_get_field_type (CouchdbStructField *sf,const char *field); CouchdbArrayField * couchdb_struct_field_get_array_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_set_array_field (CouchdbStructField *sf,const char *field,CouchdbArrayField *value); gboolean couchdb_struct_field_get_boolean_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_set_boolean_field (CouchdbStructField *sf,const char *field,gboolean value); gdouble couchdb_struct_field_get_double_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_set_double_field (CouchdbStructField *sf,const char *field,gdouble value); gint couchdb_struct_field_get_int_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_set_int_field (CouchdbStructField *sf,const char *field,gint value); const char * couchdb_struct_field_get_string_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_set_string_field (CouchdbStructField *sf,const char *field,const char *value); CouchdbStructField * couchdb_struct_field_get_struct_field (CouchdbStructField *sf,const char *field); void couchdb_struct_field_set_struct_field (CouchdbStructField *sf,const char *field,CouchdbStructField *value); const char * couchdb_struct_field_get_uuid (CouchdbStructField *sf); void couchdb_struct_field_set_uuid (CouchdbStructField *sf,const char *uuid); char * couchdb_struct_field_to_string (CouchdbStructField *sf);
CouchdbStructField * couchdb_struct_field_new           (void);
Create a new struct field object, to be added to a CouchdbDocument or to another CouchdbStructField.
| Returns : | A newly-created CouchdbStructField object. | 
CouchdbStructField * couchdb_struct_field_new_from_string
                                                        (const char *str);
Create a new struct field object, filling it with values taken from a string representing a JSON object.
| 
 | A JSON string | 
| Returns : | A newly-created CouchdbStructField object. | 
gboolean couchdb_struct_field_has_field (CouchdbStructField *sf,const char *field);
Check whether a given field exists in the given CouchdbStructField object.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field to check | 
| Returns : | TRUE if the field exists, FALSE if not. | 
void couchdb_struct_field_remove_field (CouchdbStructField *sf,const char *field);
Remove a field from the given CouchdbStructField object.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field to remove | 
GSList *            couchdb_struct_field_get_field_names
                                                        (CouchdbStructField *sf);
Get the list of field names the given CouchdbStructField object contains.
| 
 | A CouchdbStructField object | 
| Returns : | A list of strings containing the names of all the fields contained in the given CouchdbStructField object. When no longer needed, the list should be freed by calling g_slist_free. | 
GType couchdb_struct_field_get_field_type (CouchdbStructField *sf,const char *field);
Get the value type of the given CouchdbStructField's field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field to get type | 
| Returns : | Type of the field. | 
CouchdbArrayField * couchdb_struct_field_get_array_field (CouchdbStructField *sf,const char *field);
Retrieve the value of an array field from the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
| Returns : | The value of the given field. | 
void couchdb_struct_field_set_array_field (CouchdbStructField *sf,const char *field,CouchdbArrayField *value);
Set the value of an array field in the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
gboolean couchdb_struct_field_get_boolean_field (CouchdbStructField *sf,const char *field);
Retrieve the value of a boolean field from the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
| Returns : | The value of the given field. | 
void couchdb_struct_field_set_boolean_field (CouchdbStructField *sf,const char *field,gboolean value);
Set the value of a boolean field in the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
gdouble couchdb_struct_field_get_double_field (CouchdbStructField *sf,const char *field);
Retrieve the value of a decimal number field from the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
| Returns : | The value of the given field. | 
void couchdb_struct_field_set_double_field (CouchdbStructField *sf,const char *field,gdouble value);
Set the value of a decimal number field in the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
gint couchdb_struct_field_get_int_field (CouchdbStructField *sf,const char *field);
Retrieve the value of an integer field from the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
| Returns : | The value of the given field. | 
void couchdb_struct_field_set_int_field (CouchdbStructField *sf,const char *field,gint value);
Set the value of an integer field in the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
const char * couchdb_struct_field_get_string_field (CouchdbStructField *sf,const char *field);
Retrieve the value of a string field from the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
| Returns : | The value of the given field. | 
void couchdb_struct_field_set_string_field (CouchdbStructField *sf,const char *field,const char *value);
Set the value of a string field in the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
CouchdbStructField * couchdb_struct_field_get_struct_field (CouchdbStructField *sf,const char *field);
Retrieve the value of a struct field from the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
| Returns : | The value of the given field. | 
void couchdb_struct_field_set_struct_field (CouchdbStructField *sf,const char *field,CouchdbStructField *value);
Set the value of a string field in the given struct field.
| 
 | A CouchdbStructField object | 
| 
 | Name of the field | 
const char *        couchdb_struct_field_get_uuid       (CouchdbStructField *sf);
Retrieve the unique ID of the given struct field. Note that this is a convenience function to allow documents with a format similar to:
"list": { "unique-id-1": { "field": "value" }, "unique-id-2": { "field": "value" } }
So, not all CouchdbStructField objects would have a value for this, unless explicitly used by the applications storing the documents on the CouchDB database.
| 
 | A CouchdbStructField object | 
| Returns : | The unique ID of the given struct field. | 
void couchdb_struct_field_set_uuid (CouchdbStructField *sf,const char *uuid);
Set the unique ID for the given struct field. See the explanation for couchdb_struct_field_get_uuid for knowing when to use this function.
| 
 | A CouchdbStructField object | 
| 
 | Unique ID | 
char *              couchdb_struct_field_to_string      (CouchdbStructField *sf);
Convert a CouchdbStructField to a JSON string.
| 
 | A CouchdbStructField object | 
| Returns : | A string representing the contents of the given CouchdbStructField object in JSON format. |