couchdb-struct-field

couchdb-struct-field

Stability Level

, unless otherwise indicated

Synopsis

#define             COUCHDB_TYPE_STRUCT_FIELD
GType               couchdb_struct_field_get_type       (void);
CouchdbStructField * couchdb_struct_field_new           (void);
CouchdbStructField * couchdb_struct_field_new_from_string
                                                        (const char *str);
CouchdbStructField * couchdb_struct_field_ref           (CouchdbStructField *sf);
void                couchdb_struct_field_unref          (CouchdbStructField *sf);
gboolean            couchdb_struct_field_has_field      (CouchdbStructField *sf,
                                                         const char *field);
void                couchdb_struct_field_remove_field   (CouchdbStructField *sf,
                                                         const char *field);
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

COUCHDB_TYPE_STRUCT_FIELD

#define COUCHDB_TYPE_STRUCT_FIELD  (couchdb_struct_field_get_type ())


couchdb_struct_field_get_type ()

GType               couchdb_struct_field_get_type       (void);

Returns :


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_ref ()

CouchdbStructField * couchdb_struct_field_ref           (CouchdbStructField *sf);

Increments reference count of a CouchdbStructField object.

sf :

A CouchdbStructField object

Returns :

A pointer to the referenced object.

couchdb_struct_field_unref ()

void                couchdb_struct_field_unref          (CouchdbStructField *sf);

Decrements reference count of a CouchdbStructField object. When the reference count is equal to 0, the object will be destroyed and the memory it uses freed.

sf :

A 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_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

value :


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

value :


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

value :


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

value :


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

value :


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.