settings.c File Reference

Implementation of API to handle configuration file management. More...

`#include "settings.h"`
`#include <stdio.h>`
`#include <string.h>`

Go to the source code of this file.

## Macros

#define | G_LOG_DOMAIN "libgvm base"
| GLib log domain.

## Functions

static int | settings_init_from_file (settings_t *settings, const gchar *filename, const gchar *group)
| Initialise a settings struct from a file.
void | settings_cleanup (settings_t *settings)
| Cleanup a settings structure.
int | init_settings_iterator_from_file (settings_iterator_t *iterator, const gchar *filename, const gchar *group)
| Initialise a settings iterator from a file.
void | cleanup_settings_iterator (settings_iterator_t *iterator)
| Cleanup a settings iterator.
gboolean | settings_iterator_next (settings_iterator_t *iterator)
| Increment an iterator.
const gchar * | settings_iterator_name (settings_iterator_t *iterator)
| Get the name from a settings iterator.
gchar * | settings_iterator_value (settings_iterator_t *iterator)
| Get the value from a settings iterator.

## Detailed Description

Implementation of API to handle configuration file management.

## Macro Definition Documentation

## G_LOG_DOMAIN

#define G_LOG_DOMAIN "libgvm base"

GLib log domain.

## Function Documentation

## cleanup_settings_iterator()

void cleanup_settings_iterator | ( | settings_iterator_t * | iterator | ) |

Cleanup a settings iterator.

Parameters

  [in] | iterator | Settings iterator.

## init_settings_iterator_from_file()

int init_settings_iterator_from_file | ( | settings_iterator_t * | iterator,
|  | const gchar * | filename,
|  | const gchar * | group )

Initialise a settings iterator from a file.

Parameters

  [in] | iterator | Settings iterator.
  [in] | filename | Complete name of the configuration file.
  [in] | group | Name of the group in the file.

Returns
  0 success, -1 error.

## settings_cleanup()

void settings_cleanup | ( | settings_t * | settings | ) |

Cleanup a settings structure.

Parameters

  [in] | settings | Settings structure.

## settings_init_from_file()

int settings_init_from_file | ( | settings_t * | settings,
|  | const gchar * | filename,
|  | const gchar * | group )

static

Initialise a settings struct from a file.

Parameters

  [in] | settings | Settings.
  [in] | filename | Complete name of the configuration file.
  [in] | group | Name of the group in the file.

Returns
  0 success, -1 error.

## settings_iterator_name()

const gchar * settings_iterator_name | ( | settings_iterator_t * | iterator | ) |

Get the name from a settings iterator.

Parameters

  [in] | iterator | Settings iterator.

Returns
  Name of current key.

## settings_iterator_next()

gboolean settings_iterator_next | ( | settings_iterator_t * | iterator | ) |

Increment an iterator.

Parameters

  [in] | iterator | Settings iterator.

Returns
  TRUE if there was a next item, else FALSE.

## settings_iterator_value()

gchar * settings_iterator_value | ( | settings_iterator_t * | iterator | ) |

Get the value from a settings iterator.

Parameters

  [in] | iterator | Settings iterator.

Returns
  Value of current key. Caller must g_free.