rcfile

rcfile

Synopsis




                    RcLine;
                    RcSection;
                    RcFile;
RcFile*             bmp_rcfile_new                      (void);
void                bmp_rcfile_free                     (RcFile *file);
RcFile*             bmp_rcfile_open                     (const gchar *filename);
gboolean            bmp_rcfile_write                    (RcFile *file,
                                                         const gchar *filename);
gboolean            bmp_rcfile_read_string              (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gchar **value);
gboolean            bmp_rcfile_read_int                 (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gint *value);
gboolean            bmp_rcfile_read_bool                (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gboolean *value);
gboolean            bmp_rcfile_read_float               (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gfloat *value);
gboolean            bmp_rcfile_read_double              (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gdouble *value);
void                bmp_rcfile_write_string             (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         const gchar *value);
void                bmp_rcfile_write_int                (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gint value);
void                bmp_rcfile_write_boolean            (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gboolean value);
void                bmp_rcfile_write_float              (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gfloat value);
void                bmp_rcfile_write_double             (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gdouble value);
void                bmp_rcfile_remove_key               (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key);

Description

Details

RcLine

typedef struct {
    gchar *key;
    gchar *value;
} RcLine;

RcLine objects contain key->value mappings.

gchar *key;

A key for the key->value mapping.

gchar *value;

A value for the key->value mapping.

RcSection

typedef struct {
    gchar *name;
    GList *lines;
} RcSection;

RcSection objects contain collections of key->value mappings.

gchar *name;

The name for the RcSection.

GList *lines;

A list of key->value mappings for the RcSection.

RcFile

typedef struct {
    GList *sections;
} RcFile;

An RcFile object contains a collection of key->value mappings organized by section.

GList *sections;

A list of sections.

bmp_rcfile_new ()

RcFile*             bmp_rcfile_new                      (void);

RcFile object factory.

Returns :

A RcFile object.

bmp_rcfile_free ()

void                bmp_rcfile_free                     (RcFile *file);

RcFile object destructor.

file :

A RcFile object to destroy.

bmp_rcfile_open ()

RcFile*             bmp_rcfile_open                     (const gchar *filename);

Opens an rcfile and returns an RcFile object representing it.

filename :

Path to rcfile to open.

Returns :

An RcFile object representing the rcfile given.

bmp_rcfile_write ()

gboolean            bmp_rcfile_write                    (RcFile *file,
                                                         const gchar *filename);

Writes the contents of a RcFile object to disk.

file :

A RcFile object to write to disk.

filename :

A path to write the RcFile object's data to.

Returns :

TRUE on success, FALSE otherwise.

bmp_rcfile_read_string ()

gboolean            bmp_rcfile_read_string              (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gchar **value);

Looks up a value in an RcFile and places it in value.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to look in.

key :

The name of the identifier to look up.

value :

A pointer to a memory location to place the data.

Returns :

TRUE on success, FALSE otherwise.

bmp_rcfile_read_int ()

gboolean            bmp_rcfile_read_int                 (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gint *value);

Looks up a value in an RcFile and places it in value.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to look in.

key :

The name of the identifier to look up.

value :

A pointer to a memory location to place the data.

Returns :

TRUE on success, FALSE otherwise.

bmp_rcfile_read_bool ()

gboolean            bmp_rcfile_read_bool                (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gboolean *value);

Looks up a value in an RcFile and places it in value.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to look in.

key :

The name of the identifier to look up.

value :

A pointer to a memory location to place the data.

Returns :

TRUE on success, FALSE otherwise.

bmp_rcfile_read_float ()

gboolean            bmp_rcfile_read_float               (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gfloat *value);

Looks up a value in an RcFile and places it in value.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to look in.

key :

The name of the identifier to look up.

value :

A pointer to a memory location to place the data.

Returns :

TRUE on success, FALSE otherwise.

bmp_rcfile_read_double ()

gboolean            bmp_rcfile_read_double              (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gdouble *value);

Looks up a value in an RcFile and places it in value.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to look in.

key :

The name of the identifier to look up.

value :

A pointer to a memory location to place the data.

Returns :

TRUE on success, FALSE otherwise.

bmp_rcfile_write_string ()

void                bmp_rcfile_write_string             (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         const gchar *value);

Sets a value in an RcFile for key.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to set the key in.

key :

The name of the identifier to set.

value :

The value to set for that identifier.

bmp_rcfile_write_int ()

void                bmp_rcfile_write_int                (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gint value);

Sets a value in an RcFile for key.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to set the key in.

key :

The name of the identifier to set.

value :

The value to set for that identifier.

bmp_rcfile_write_boolean ()

void                bmp_rcfile_write_boolean            (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gboolean value);

Sets a value in an RcFile for key.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to set the key in.

key :

The name of the identifier to set.

value :

The value to set for that identifier.

bmp_rcfile_write_float ()

void                bmp_rcfile_write_float              (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gfloat value);

Sets a value in an RcFile for key.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to set the key in.

key :

The name of the identifier to set.

value :

The value to set for that identifier.

bmp_rcfile_write_double ()

void                bmp_rcfile_write_double             (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key,
                                                         gdouble value);

Sets a value in an RcFile for key.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to set the key in.

key :

The name of the identifier to set.

value :

The value to set for that identifier.

bmp_rcfile_remove_key ()

void                bmp_rcfile_remove_key               (RcFile *file,
                                                         const gchar *section,
                                                         const gchar *key);

Removes key from an RcFile object.

file :

A RcFile object to write to disk.

section :

The section of the RcFile to set the key in.

key :

The name of the identifier to remove.