3 #include "AppConfiguration.h"
5 AppConfiguration::AppConfiguration(const char * fname)
9 /* Read the file. If there is an error, report it and exit. */
10 if(!config_read_file(&cfg, fname))
14 exit(3);/* from original code. */
17 int AppConfiguration::getInt(const char * path)
20 if (config_lookup_int(&cfg, path, &value) == CONFIG_FALSE)
22 fprintf(stderr, "Warning: %s was not found, or bad type requested\n", path);
27 const char * AppConfiguration::getString(const char * path)
30 if (config_lookup_string(&cfg, path, &value) == CONFIG_FALSE)
32 fprintf(stderr, "Warning: %s was not found, or bad type requested\n", path);
37 int AppConfiguration::error()
39 if (config_error_type(&cfg) == CONFIG_ERR_NONE)
44 fprintf(stderr, "%s: In file %s, line %d\n",
45 config_error_text(&cfg),
46 config_error_file(&cfg),
47 config_error_line(&cfg));
51 void AppConfiguration::release()