#ifndef ARC_STD_PARSER_CHEMICAL_H_ #define ARC_STD_PARSER_CHEMICAL_H_ #ifdef __cplusplus extern "C" { #endif #include #include "arc/std/parser.h" /** * @brief the config type for archeus, loads in a config file which syntax is specified in the documentation * @TODO: add documentation link here */ typedef struct ARC_Chemical ARC_Chemical; /** * @brief a function callback to create a type stored within a config */ typedef void (* ARC_ChemicalType_CopyFn)(void **type, ARC_ParserTagToken *parsedData, ARC_Chemical *chemical); /** * @brief a function callback to destroy a type */ typedef void (* ARC_ChemicalType_DestroyFn)(void *type); /** * @brief the functions for used for loading and unloading a type, the name will be the key of a hashtable */ typedef struct ARC_ChemicalType { ARC_ChemicalType_CopyFn copyFn; ARC_ChemicalType_DestroyFn destroyFn; } ARC_ChemicalType; /** * @brief creates the arc config type (a type that loads in chemical files and can have types added to it) */ void ARC_Chemical_Create(ARC_Chemical **chemical); /** * @brief destroys an ARC_Chemical type */ void ARC_Chemical_Destroy(ARC_Chemical *chemical); /** * @brief adds creation and destruction functions for a new user provided type will be used for chemical load and unload functions * * @note this function uses ARC_Chemical_RegisterTypeWithCStr so it shares error messages with that function * * @param[in] chemical the ARC_Chemical to set the new type into * @param[in] typeName the name of the type like "uint32" or "ARC_Rect" that will be read in from a chemical file * @param[in] type the copy and destroy functions for the type used on load and unload */ void ARC_Chemical_RegisterType(ARC_Chemical *chemical, ARC_String *typeName, ARC_ChemicalType type); /** * @brief adds creation and destruction functions for a new user provided type * * @param[in] chemical the ARC_Chemical to set the new type into * @param[in] typeName the name of the type like "uint32" or "ARC_Rect" that will be read in from a chemical file * @param[in] type the copy and destroy functions for the type used on load and unload */ void ARC_Chemical_RegisterTypeWithCStr(ARC_Chemical *chemical, const char *typeNameCStr, ARC_ChemicalType type); /** * @brief sets current group in config * * @note ARC_Chemical_Get will use this set group * @note this function uses ARC_Chemical_SetGroupWithCStr so it shares error messages with that function * * @param[in] chemical ARC_Config we are setting current group in * @param[in] groupname name of group that will be set */ void ARC_Chemical_SetGroup(ARC_Chemical *chemical, ARC_String *groupName); /** * @brief sets current group in config * * @note ARC_Chemical_Get will use this set group * * @param[in] chemical ARC_Config we are setting current group in * @param[in] groupname name of group that will be set */ void ARC_Chemical_SetGroupWithCStr(ARC_Chemical *chemical, const char *groupName); /** * @brief get a value from a given keyname * * @note name may be prefaced with :: to specify group * @note this function uses ARC_Chemical_GetWithCStr so it shares error messages with that function * * @param[in] chemical ARC_Chemical to get value from * @param[in] element name of a variable that has been read in * * @return the stored element on success, or NULL on failure */ void *ARC_Chemical_Get(ARC_Chemical *chemical, ARC_String *element); /** * @brief get a value from a given keyname * * @note name may be prefaced with :: to specify group * * @param[in] chemical ARC_Chemical to get value from * @param[in] element name of a variable that has been read in * * @return the stored element on success, or NULL on failure */ void *ARC_Chemical_GetWithCStr(ARC_Chemical *chemical, const char *element); /** * @brief TODO: write this */ void ARC_Chemical_LoadFromString(ARC_Chemical *chemical, ARC_String **string); /** * @brief TODO: write this */ void ARC_Chemical_LoadFromFile(ARC_Chemical *chemical, ARC_String *path); /** * @brief TODO: write this */ void ARC_Chemical_UnloadFromString(ARC_Chemical *chemical, ARC_String **string); /** * @brief TODO: write this */ void ARC_Chemical_UnloadFromFile(ARC_Chemical *chemical, ARC_String *data); #ifdef __cplusplus } #endif #endif //ARC_STD_PARSER_CHEMICAL_H_