couchdb-struct-field

couchdb-struct-field

Synopsis

                    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);

Description

Details

CouchdbStructFieldClass

typedef struct {
	GObjectClass parent_class;
} CouchdbStructFieldClass;


couchdb_struct_field_new ()

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.

couchdb_struct_field_new_from_string ()

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.

str :

A JSON string

Returns :

A newly-created CouchdbStructField object.

couchdb_struct_field_has_field ()

gboolean            couchdb_struct_field_has_field      (CouchdbStructField *sf,
                                                         const char *field);

Check whether a given field exists in the given CouchdbStructField object.

sf :

A CouchdbStructField object

field :

Name of the field to check

Returns :

TRUE if the field exists, FALSE if not.

couchdb_struct_field_remove_field ()

void                couchdb_struct_field_remove_field   (CouchdbStructField *sf,
                                                         const char *field);

Remove a field from the given CouchdbStructField object.

sf :

A CouchdbStructField object

field :

Name of the field to remove

couchdb_struct_field_get_field_names ()

GSList *            couchdb_struct_field_get_field_names
                                                        (CouchdbStructField *sf);

Get the list of field names the given CouchdbStructField object contains.

sf :

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.

couchdb_struct_field_get_field_type ()

GType               couchdb_struct_field_get_field_type (CouchdbStructField *sf,
                                                         const char *field);

Get the value type of the given CouchdbStructField's field.

sf :

A CouchdbStructField object

field :

Name of the field to get type

Returns :

Type of the field.

couchdb_struct_field_get_array_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.

sf :

A CouchdbStructField object

field :

Name of the field

Returns :

The value of the given field.

couchdb_struct_field_set_array_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.

sf :

A CouchdbStructField object

field :

Name of the field

couchdb_struct_field_get_boolean_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.

sf :

A CouchdbStructField object

field :

Name of the field

Returns :

The value of the given field.

couchdb_struct_field_set_boolean_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.

sf :

A CouchdbStructField object

field :

Name of the field

couchdb_struct_field_get_double_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.

sf :

A CouchdbStructField object

field :

Name of the field

Returns :

The value of the given field.

couchdb_struct_field_set_double_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.

sf :

A CouchdbStructField object

field :

Name of the field

couchdb_struct_field_get_int_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.

sf :

A CouchdbStructField object

field :

Name of the field

Returns :

The value of the given field.

couchdb_struct_field_set_int_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.

sf :

A CouchdbStructField object

field :

Name of the field

couchdb_struct_field_get_string_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.

sf :

A CouchdbStructField object

field :

Name of the field

Returns :

The value of the given field.

couchdb_struct_field_set_string_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.

sf :

A CouchdbStructField object

field :

Name of the field

couchdb_struct_field_get_struct_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.

sf :

A CouchdbStructField object

field :

Name of the field

Returns :

The value of the given field.

couchdb_struct_field_set_struct_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.

sf :

A CouchdbStructField object

field :

Name of the field

couchdb_struct_field_get_uuid ()

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.

sf :

A CouchdbStructField object

Returns :

The unique ID of the given struct field.

couchdb_struct_field_set_uuid ()

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.

sf :

A CouchdbStructField object

uuid :

Unique ID

couchdb_struct_field_to_string ()

char *              couchdb_struct_field_to_string      (CouchdbStructField *sf);

Convert a CouchdbStructField to a JSON string.

sf :

A CouchdbStructField object

Returns :

A string representing the contents of the given CouchdbStructField object in JSON format.