|
NAMEAG_Config —
agar configuration interface
SYNOPSIS#include <agar/core.h> DESCRIPTIONTheAG_Config object records configuration settings
global to an Agar application. This includes user preferences which are to be
preserved after the application has exited. Settings are stored as
AG_Variable(3)
values.
Library or application-specific data may also be stored in the configuration object. Variable names should not start with "ag_", the prefix is reserved for internal Agar settings. Note that our AG_Variable(3) system implements pointers (or "bindings"), so it is always possible for a parameter value to be specified as a pointer to an external piece of data. INTERFACEAG_Config *AG_ConfigObject (void);
The The The The CONFIGURATION PARAMETERSThe following parameters are registered by Agar-Core:
EXAMPLESThe following code sets an integer option and a string. The configuration is then immediately saved to disk:AG_SetInt(agConfig, "my-setting", 1); AG_SetString(agConfig, "my-string", "Foo bar"); AG_ConfigSave(); The following Agar-GUI code displays a checkbox controlling the value of "my-setting": AG_Checkbox *cb; cb = AG_CheckboxNew(win, 0, "My setting"); AG_BindVariable(cb, "state", agConfig, "my-setting"); The following code binds "my-ext-setting" to an external variable, and then reads the configuration from disk. If the saved configuration has "my-ext-setting" defined, then the variable will be set accordingly: int myExtSetting = 0; AG_BindInt(agConfig, "my-ext-setting", &myExtSetting); AG_ConfigLoad(); SEE ALSOAG_Intro(3), AG_Object(3)HISTORYTheAG_Config interface first appeared in Agar 1.0
Visit the GSP FreeBSD Man Page Interface. |