## MateConfSchema

MateConfSchema — A MateConfSchema describes a MateConfEntry

## Synopsis

                        MateConfSchema;
    MateConfSchema *       mateconf_schema_new                    (void);
    void                mateconf_schema_free                   (MateConfSchema *sc);
    MateConfSchema *       mateconf_schema_copy                   (const MateConfSchema *sc);
    MateConfValueType      mateconf_schema_get_type               (const MateConfSchema *schema);
    const char *        mateconf_schema_get_locale             (const MateConfSchema *schema);
    const char *        mateconf_schema_get_short_desc         (const MateConfSchema *schema);
    const char *        mateconf_schema_get_long_desc          (const MateConfSchema *schema);
    const char *        mateconf_schema_get_owner              (const MateConfSchema *schema);
    MateConfValue *        mateconf_schema_get_default_value      (const MateConfSchema *schema);
    MateConfValueType      mateconf_schema_get_car_type           (const MateConfSchema *schema);
    MateConfValueType      mateconf_schema_get_cdr_type           (const MateConfSchema *schema);
    MateConfValueType      mateconf_schema_get_list_type          (const MateConfSchema *schema);
    void                mateconf_schema_set_type               (MateConfSchema *sc,
                                                             MateConfValueType type);
    void                mateconf_schema_set_locale             (MateConfSchema *sc,
                                                             const gchar *locale);
    void                mateconf_schema_set_short_desc         (MateConfSchema *sc,
                                                             const gchar *desc);
    void                mateconf_schema_set_long_desc          (MateConfSchema *sc,
                                                             const gchar *desc);
    void                mateconf_schema_set_owner              (MateConfSchema *sc,
                                                             const gchar *owner);
    void                mateconf_schema_set_default_value      (MateConfSchema *sc,
                                                             const MateConfValue *val);
    void                mateconf_schema_set_default_value_nocopy
                                                            (MateConfSchema *sc,
                                                             MateConfValue *val);
    void                mateconf_schema_set_car_type           (MateConfSchema *sc,
                                                             MateConfValueType type);
    void                mateconf_schema_set_cdr_type           (MateConfSchema *sc,
                                                             MateConfValueType type);
    void                mateconf_schema_set_list_type          (MateConfSchema *sc,
                                                             MateConfValueType type);

## Description

A "schema" describes a key-value pair in a MateConf database. It may include information such as default value and value type, as well as documentation describing the pair, the name of the application that created the pair, etc.

A MateConfSchema duplicates some of the information about the value it describes, such as type information. In these cases, the type information provided describes what the type of the value should be, not what the type actually is.

## Details

### MateConfSchema

    typedef struct _MateConfSchema MateConfSchema;

An opaque data type representing a description of a key-value pair.

### mateconf_schema_new ()

    MateConfSchema *       mateconf_schema_new                    (void);

Creates a new MateConfSchema.

Returns : | newly allocated MateConfSchema

### mateconf_schema_free ()

    void                mateconf_schema_free                   (MateConfSchema *sc);

Deallocates a MateConfSchema. Also frees any allocated memory inside the MateConfSchema.

`sc` : | a MateConfSchema to destroy.

### mateconf_schema_copy ()

    MateConfSchema *       mateconf_schema_copy                   (const MateConfSchema *sc);

Copies a MateConfSchema. The copy is a deep copy, that is, any allocated memory inside the MateConfSchema will also be copied.

`sc` : | a MateConfSchema to copy.
Returns : | a newly allocated MateConfSchema

### mateconf_schema_get_type ()

    MateConfValueType      mateconf_schema_get_type               (const MateConfSchema *schema);

Returns the type of the entry described by a MateConfSchema

`schema` : | a MateConfSchema
Returns : | the entry type.

### mateconf_schema_get_locale ()

    const char *        mateconf_schema_get_locale             (const MateConfSchema *schema);

Returns the locale for a MateConfSchema. The returned string is not a copy, so don't try to free it. It is "owned" by the MateConfSchema and will be destroyed when the MateConfSchema is destroyed.

`schema` : | a MateConfSchema
Returns : | the locale

### mateconf_schema_get_short_desc ()

    const char *        mateconf_schema_get_short_desc         (const MateConfSchema *schema);

Returns the short description for a MateConfSchema. The returned string is not a copy, don't try to free it. It is "owned" by the MateConfSchema and will be destroyed when the MateConfSchema is destroyed.

`schema` : | a MateConfSchema.
Returns : | the short description.

### mateconf_schema_get_long_desc ()

    const char *        mateconf_schema_get_long_desc          (const MateConfSchema *schema);

Returns the long description for a MateConfSchema. The returned string is not a copy, don't try to free it. It is "owned" by the MateConfSchema and will be destroyed when the MateConfSchema is destroyed.

`schema` : | a MateConfSchema
Returns : | the long description.

### mateconf_schema_get_owner ()

    const char *        mateconf_schema_get_owner              (const MateConfSchema *schema);

Returns the owner of a MateConfSchema. The returned string is not a copy, don't try to free it. It is "owned" by the MateConfSchema and will be destroyed when the MateConfSchema is destroyed.

`schema` : | a MateConfSchema.
Returns : | the owner.

### mateconf_schema_get_default_value ()

    MateConfValue *        mateconf_schema_get_default_value      (const MateConfSchema *schema);

Returns the default value of the entry that is described by a MateConfSchema.

`schema` : | a MateConfSchema.
Returns : | the default value of the entry.

### mateconf_schema_get_car_type ()

    MateConfValueType      mateconf_schema_get_car_type           (const MateConfSchema *schema);

Returns the default type of the first member of the pair in the entry (which should be of type `MATECONF_VALUE_PAIR`) described by `schema`.

`schema` : | a MateConfSchema.
Returns : | the type of the first member of the pair element of the entry.

### mateconf_schema_get_cdr_type ()

    MateConfValueType      mateconf_schema_get_cdr_type           (const MateConfSchema *schema);

Returns the default type of the second member of the pair in the entry (which should be of type `MATECONF_VALUE_PAIR`) described by `schema`.

`schema` : | a MateConfSchema.
Returns : | the type of the second member of the pair element of the entry.

### mateconf_schema_get_list_type ()

    MateConfValueType      mateconf_schema_get_list_type          (const MateConfSchema *schema);

Returns the default type of the list elements of the entry (which should be of default type `MATECONF_VALUE_LIST`) described by `schema`.

+`schema`: a MateConfSchema. +`Returns`: the type of the list elements of the entry.

`schema` : |
Returns : |

### mateconf_schema_set_type ()

    void                mateconf_schema_set_type               (MateConfSchema *sc,
                                                             MateConfValueType type);

Sets the MateConfValueType of the MateConfSchema to `type`.

`sc` : | a MateConfSchema.
`type` : | the type.

### mateconf_schema_set_locale ()

    void                mateconf_schema_set_locale             (MateConfSchema *sc,
                                                             const gchar *locale);

Sets the locale for a MateConfSchema to `locale`. `locale` is copied.

`sc` : | a MateConfSchema.
`locale` : | the locale.

### mateconf_schema_set_short_desc ()

    void                mateconf_schema_set_short_desc         (MateConfSchema *sc,
                                                             const gchar *desc);

Sets the short description of a MateConfSchema to `desc`. `desc` is copied.

`sc` : | a MateConfSchema.
`desc` : | the short description.

### mateconf_schema_set_long_desc ()

    void                mateconf_schema_set_long_desc          (MateConfSchema *sc,
                                                             const gchar *desc);

Sets the long description of a MateConfSchema to `desc`. `desc` is copied.

`sc` : | a MateConfSchema.
`desc` : | the long description.

### mateconf_schema_set_owner ()

    void                mateconf_schema_set_owner              (MateConfSchema *sc,
                                                             const gchar *owner);

Sets the "owner" of the MateConfSchema, where the owner is the name of the application that created the entry.

`sc` : | a MateConfSchema.
`owner` : | the name of the creating application.

### mateconf_schema_set_default_value ()

    void                mateconf_schema_set_default_value      (MateConfSchema *sc,
                                                             const MateConfValue *val);

Sets the default value for the entry described by the MateConfSchema. The MateConfValue is copied. Alternatively, use `mateconf_schema_set_default_value_nocopy()`.

`sc` : | a MateConfSchema.
`val` : | the default value.

### mateconf_schema_set_default_value_nocopy ()

    void                mateconf_schema_set_default_value_nocopy
                                                            (MateConfSchema *sc,
                                                             MateConfValue *val);

Sets the default value for the entry described by the MateConfSchema. The MateConfValue is not copied; the MateConfSchema takes ownership of it. Alternatively, use `mateconf_schema_set_default_value()`.

`sc` : | a MateConfSchema.
`val` : | the default value.

### mateconf_schema_set_car_type ()

    void                mateconf_schema_set_car_type           (MateConfSchema *sc,
                                                             MateConfValueType type);

Sets the MateConfValueType of the first member (car) of the entry (which should be of type `MATECONF_VALUE_PAIR`) described by MateConfSchema to `type`.

`sc` : | a MateConfSchema.
`type` : | the type.

### mateconf_schema_set_cdr_type ()

    void                mateconf_schema_set_cdr_type           (MateConfSchema *sc,
                                                             MateConfValueType type);

Sets the MateConfValueType of the second member (cdr) of the entry (which should be of type `MATECONF_VALUE_PAIR`) described by MateConfSchema to `type`.

`sc` : | a MateConfSchema.
`type` : | the type.

### mateconf_schema_set_list_type ()

    void                mateconf_schema_set_list_type          (MateConfSchema *sc,
                                                             MateConfValueType type);

Sets the MateConfValueType of the list elements of the entry (which should be of type `MATECONF_VALUE_LIST`) described by MateConfSchema to `type`.

`sc` : | a MateConfSchema.
`type` : | the type.