#ifndef CONF_PAR_H
#define CONF_PAR_H

#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif

struct conf_par_entry {
    char * section;
    char * name;
    char * value;
    char * comment;
};

enum conf_par_flags {
    CP_DEFAULT               = 0x0,
    CP_KEEP_COMMENTS         = 0x1,
    CP_SECTIONS_ARE_VARIANTS = 0x2,
    CP_STRING_BUF_IO         = 0x3
};

struct conf_par;

struct conf_par * conf_par_new();
void conf_par_delete(struct conf_par * hdl);

void conf_par_config(struct conf_par * hdl, enum conf_par_flags flags,
                     const char * separators,
                     const char * spacers,
                     const char * comment_mark);

int conf_par_parse(struct conf_par * hdl,  const char * conf_file);
const struct conf_par_entry * conf_par_next(struct conf_par * hdl,
                                            const char * section);
void conf_par_rewind(struct conf_par * hdl);

void conf_par_append(struct conf_par * hdl, const struct conf_par_entry * e);

int conf_par_store(struct conf_par * hdl,  const char * conf_file);

/** Switch current locale to POSIX when converting value strings 
 *  into floating point values
 */
void conf_par_clear_locale(struct conf_par * hdl);
void conf_par_restore_locale(struct conf_par * hdl);

#if 0
{
#endif
#ifdef __cplusplus
}
#endif
#endif
