#ifndef __Choices__H
#define __Choices__H

#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

const char* Choices_ReadFrom(const char* pfilename, const char* psection, const char* pvariable, const char* defval);
int Choices_ReadIntFrom(const char* pfilename, const char* psection, const char* pvariable, int defval);
bool Choices_ReadBoolFrom(const char* pfilename, const char* psection, const char* pvariable, bool defval);

#ifdef __CC_NORCROFT
#pragma -v1 // hint to the compiler to check f/s/printf format
#endif
bool Choices_WriteTo(const char* pfilename, const char* psection, const char* pvariable, const char* pformat, ...);
#ifdef __CC_NORCROFT
#pragma -v0 // return to default
#endif
bool Choices_RemoveSectionFrom(const char* pfilename, const char* psection);

void throw_Choices_Choices(const char* pfilename);
void Choices_NotChoices(void);
void Choices_FlushPendingWrites(void);

const char* Choices_GetFilename(void);

const char* Choices_Read(const char* psection, const char* pvariable, const char* defval);
int Choices_ReadInt(const char* psection, const char* pvariable, int defval);
bool Choices_ReadBool(const char* psection, const char* pvariable, bool defval);
void Choices_Update(const char* psection, const char* pvariable, const char** pval);
void Choices_UpdateInt(const char* psection, const char* pvariable, int* pval, int min, int max);
void Choices_UpdateBool(const char* psection, const char* pvariable, bool* pval);

#ifdef __CC_NORCROFT
#pragma -v1 // hint to the compiler to check f/s/printf format
#endif
bool Choices_Write(const char* psection, const char* pvariable, const char* pformat, ...);
#ifdef __CC_NORCROFT
#pragma -v0 // return to default
#endif

#ifdef __cplusplus
}
#endif

#endif
