added add and remove to config
This commit is contained in:
parent
ef1888ae71
commit
da2be7780b
2 changed files with 326 additions and 39 deletions
|
|
@ -67,6 +67,58 @@ void ARC_Config_RegisterType(ARC_Config *config, ARC_String *typeName, ARC_Confi
|
|||
*/
|
||||
void ARC_Config_RegisterTypeWithCStr(ARC_Config *config, const char *typeNameCStr, ARC_ConfigType type);
|
||||
|
||||
/**
|
||||
* @brief add a value with a given keyname
|
||||
*
|
||||
* @note name should be prefaced with <group>:: to specify group, or just the name if it is in the default group
|
||||
* @note not specifying the group will use the current group
|
||||
* @note this function uses ARC_Config_AddWithCStr so it shares error messages with that function
|
||||
* @note value will be freed on cleanup or remove
|
||||
*
|
||||
* @param[in] config ARC_Config to add value to
|
||||
* @param[in] type the type of a variable to add to specified group
|
||||
* @param[in] name name of a variable to add to specified group
|
||||
* @param[in] value the value of the variable to add, will be freed
|
||||
*/
|
||||
void ARC_Config_Add(ARC_Config *config, ARC_String *type, ARC_String *name, void *value);
|
||||
|
||||
/**
|
||||
* @brief add a value with a given keyname
|
||||
*
|
||||
* @note name should be prefaced with <group>:: to specify group, or just the name if it is in the default group
|
||||
* @note not specifying the group will use the current group
|
||||
* @note value will be freed on cleanup or remove
|
||||
*
|
||||
* @param[in] config ARC_Config to add value to
|
||||
* @param[in] type the type of a variable to add to specified group
|
||||
* @param[in] name name of a variable to add to specified group
|
||||
* @param[in] value the value of the variable to add, will be freed
|
||||
*/
|
||||
void ARC_Config_AddWithCStr(ARC_Config *config, const char *type, const char *name, void *value);
|
||||
|
||||
/**
|
||||
* @brief remove a value with a given keyname
|
||||
*
|
||||
* @note name should be prefaced with <group>:: to specify group, or just the name if it is in the default group
|
||||
* @note not specifying the group will use the current group
|
||||
* @note this function uses ARC_Config_RemoveWithCStr so it shares error messages with that function
|
||||
*
|
||||
* @param[in] config ARC_Config to remove value from
|
||||
* @param[in] name name of a variable to remove to specified group
|
||||
*/
|
||||
void ARC_Config_Remove(ARC_Config *config, ARC_String *name);
|
||||
|
||||
/**
|
||||
* @brief remove a value with a given keyname
|
||||
*
|
||||
* @note name should be prefaced with <group>:: to specify group, or just the name if it is in the default group
|
||||
* @note not specifying the group will use the current group
|
||||
*
|
||||
* @param[in] config ARC_Config to remove value from
|
||||
* @param[in] name name of a variable to remove to specified group
|
||||
*/
|
||||
void ARC_Config_RemoveWithCStr(ARC_Config *config, const char *name);
|
||||
|
||||
/**
|
||||
* @brief sets current group in config
|
||||
*
|
||||
|
|
@ -75,7 +127,7 @@ void ARC_Config_RegisterTypeWithCStr(ARC_Config *config, const char *typeNameCSt
|
|||
*
|
||||
* @param[in] config ARC_Config we are setting current group in
|
||||
* @param[in] groupname name of group that will be set
|
||||
*/
|
||||
*/
|
||||
void ARC_Config_SetGroup(ARC_Config *config, ARC_String *groupName);
|
||||
|
||||
/**
|
||||
|
|
@ -85,32 +137,32 @@ void ARC_Config_SetGroup(ARC_Config *config, ARC_String *groupName);
|
|||
*
|
||||
* @param[in] config ARC_Config we are setting current group in
|
||||
* @param[in] groupname name of group that will be set
|
||||
*/
|
||||
*/
|
||||
void ARC_Config_SetGroupWithCStr(ARC_Config *config, const char *groupName);
|
||||
|
||||
/**
|
||||
* @brief get a value from a given name
|
||||
*
|
||||
* @note name should be prefaced with <group>:: to specify group
|
||||
* @note name should be prefaced with <group>:: to specify group, or just the name if it is in the default group
|
||||
*
|
||||
* @param[in] config ARC_Config to get value from
|
||||
* @param[in] name name of a variable that has been read in
|
||||
*
|
||||
* @return the stored element on success, or NULL on failure
|
||||
*/
|
||||
*/
|
||||
void *ARC_Config_Get(ARC_Config *config, ARC_String *name);
|
||||
|
||||
/**
|
||||
* @brief get a value from a given keyname
|
||||
*
|
||||
* @note name should be prefaced with <group>:: to specify group
|
||||
* @note name should be prefaced with <group>:: to specify group, or just the name if it is in the default group
|
||||
* @note this function uses ARC_Config_Get so it shares error messages with that function
|
||||
*
|
||||
* @param[in] config ARC_Config to get value from
|
||||
* @param[in] name name of a variable that has been read in
|
||||
*
|
||||
* @return the stored element on success, or NULL on failure
|
||||
*/
|
||||
*/
|
||||
void *ARC_Config_GetWithCStr(ARC_Config *config, const char *name);
|
||||
|
||||
/**
|
||||
|
|
@ -205,15 +257,16 @@ void ARC_Config_UnloadFromFile(ARC_Config *config, ARC_String *data);
|
|||
#define ARC_CONFIG_STRING_CHARS 0x37
|
||||
#define ARC_CONFIG_STRING_CHAR 0x38
|
||||
#define ARC_CONFIG_ESCAPE_CHAR 0x39
|
||||
#define ARC_CONFIG_NUMBER_SIGN 0x3A
|
||||
#define ARC_CONFIG_NUMBER_TAG 0x3B
|
||||
#define ARC_CONFIG_WHITESPACE 0x3C
|
||||
#define ARC_CONFIG_COMMENT 0x3D
|
||||
#define ARC_CONFIG_LINE_COMMENT 0x3E
|
||||
#define ARC_CONFIG_MULTI_LINE_COMMENT 0x3F
|
||||
#define ARC_CONFIG_LINE_CHARS 0x40
|
||||
#define ARC_CONFIG_MULTI_LINE_CHARS 0x41
|
||||
#define ARC_CONFIG_COMMENT_CHAR 0x42
|
||||
#define ARC_CONFIG_FLOAT 0x3A
|
||||
#define ARC_CONFIG_NUMBER_SIGN 0x3B
|
||||
#define ARC_CONFIG_NUMBER_TAG 0x3C
|
||||
#define ARC_CONFIG_WHITESPACE 0x3D
|
||||
#define ARC_CONFIG_COMMENT 0x3E
|
||||
#define ARC_CONFIG_LINE_COMMENT 0x3F
|
||||
#define ARC_CONFIG_MULTI_LINE_COMMENT 0x40
|
||||
#define ARC_CONFIG_LINE_CHARS 0x41
|
||||
#define ARC_CONFIG_MULTI_LINE_CHARS 0x42
|
||||
#define ARC_CONFIG_COMMENT_CHAR 0x43
|
||||
|
||||
/**
|
||||
* @brief TODO: write this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue