Archeus 0.0.0
A C library and game engine that focuses on documentation
Loading...
Searching...
No Matches
config.h File Reference
#include "arc/std/hashtable.h"
#include "arc/std/string.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define ARC_KEY_BUCKET_SIZE   0x20
 
#define ARC_GROUP_BUCKET_SIZE   0x20
 
#define ARC_GROUP_DATA_BUCKET_SIZE   0x20
 
#define ARC_CONFIG_FILE_IO_LOAD   0x00
 commands that can be used in ARC_Config_FileIO
 
#define ARC_CONFIG_FILE_IO_UNLOAD   0x01
 

Typedefs

typedef uint8_t(* ARC_ConfigKeyRead) (ARC_Config *config, ARC_String *string, void **value)
 a function to read a key from string to a ARC_ConfigTypeTemplate
 
typedef void(* ARC_ConfigKeyDelete) (ARC_Config *config, ARC_String *string, void *value)
 a function to delete a value from a key in ARC_Config
 
typedef void(* ARC_ConfigKey_AddFunc) (ARC_Config *config)
 external callback to add keys to config
 

Functions

void ARC_Config_AddKey (ARC_Config *config, ARC_String *type, ARC_ConfigKeyRead keyRead, ARC_ConfigKeyDelete keyDelete)
 adds a usable key to ARC_Config
 
void ARC_Config_AddKeyCString (ARC_Config *config, const char *type, uint64_t length, ARC_ConfigKeyRead keyRead, ARC_ConfigKeyDelete keyDelete)
 adds a key from a cstring
 
void ARC_Config_Create (ARC_Config **config)
 creates ARC_Config type
 
void ARC_Config_Destroy (ARC_Config *config)
 destroys ARC_Config type
 
void ARC_Config_SetGroup (ARC_Config *config, ARC_String *groupname)
 sets current group in config
 
void ARC_Config_Get (ARC_Config *config, ARC_String *keyname, void **value)
 get a value from a given keyname
 
void ARC_Config_FileIO (ARC_Config *config, ARC_String *path, uint8_t command)
 handles file io for ARC_Config Type
 

Macro Definition Documentation

◆ ARC_CONFIG_FILE_IO_LOAD

#define ARC_CONFIG_FILE_IO_LOAD   0x00

commands that can be used in ARC_Config_FileIO

Definition at line 107 of file config.h.

◆ ARC_CONFIG_FILE_IO_UNLOAD

#define ARC_CONFIG_FILE_IO_UNLOAD   0x01

Definition at line 108 of file config.h.

◆ ARC_GROUP_BUCKET_SIZE

#define ARC_GROUP_BUCKET_SIZE   0x20

Definition at line 13 of file config.h.

◆ ARC_GROUP_DATA_BUCKET_SIZE

#define ARC_GROUP_DATA_BUCKET_SIZE   0x20

Definition at line 14 of file config.h.

◆ ARC_KEY_BUCKET_SIZE

#define ARC_KEY_BUCKET_SIZE   0x20

Definition at line 12 of file config.h.

Typedef Documentation

◆ ARC_ConfigKey_AddFunc

typedef void(* ARC_ConfigKey_AddFunc) (ARC_Config *config)

external callback to add keys to config

Definition at line 69 of file config.h.

◆ ARC_ConfigKeyDelete

typedef void(* ARC_ConfigKeyDelete) (ARC_Config *config, ARC_String *string, void *value)

a function to delete a value from a key in ARC_Config

Parameters
configARC_Config that can be used to check for references in data
valuepointer of data to be deleted
Note
this function can be NULL if memory does not need to be cleaned for this type if there is an error, set arc_errno

Definition at line 44 of file config.h.

◆ ARC_ConfigKeyRead

typedef uint8_t(* ARC_ConfigKeyRead) (ARC_Config *config, ARC_String *string, void **value)

a function to read a key from string to a ARC_ConfigTypeTemplate

Parameters
configARC_Config to store data to
stringARC_String of data that is being read in
valuevalue that is read in
Note
use ARC_Config_StoreValue(ARC_Config *config, ARC_String *name, void *value); to store a value to the config if there is an error, set arc_errno
Returns
0 if value not a reference, 1 if value is a reference

Definition at line 33 of file config.h.

Function Documentation

◆ ARC_Config_AddKey()

void ARC_Config_AddKey ( ARC_Config * config,
ARC_String * type,
ARC_ConfigKeyRead keyRead,
ARC_ConfigKeyDelete keyDelete )

adds a usable key to ARC_Config

Parameters
configARC_Config to add keys to
typestring of key type
keyReadfunction for reading/creating key from string
keyDeletefunction for deleting stored key

◆ ARC_Config_AddKeyCString()

void ARC_Config_AddKeyCString ( ARC_Config * config,
const char * type,
uint64_t length,
ARC_ConfigKeyRead keyRead,
ARC_ConfigKeyDelete keyDelete )

adds a key from a cstring

Parameters
configARC_Config to add keys to
typecstring of key type
lengthlength of cstring
keyReadfunction for reading/creating key from string
keyDeletefunction for deleting stored key

◆ ARC_Config_Create()

void ARC_Config_Create ( ARC_Config ** config)

creates ARC_Config type

Parameters
configARC_Config to initialize

◆ ARC_Config_Destroy()

void ARC_Config_Destroy ( ARC_Config * config)

destroys ARC_Config type

◆ ARC_Config_FileIO()

void ARC_Config_FileIO ( ARC_Config * config,
ARC_String * path,
uint8_t command )

handles file io for ARC_Config Type

Parameters
configARC_Config where io operations will take place
pathfile path for io

◆ ARC_Config_Get()

void ARC_Config_Get ( ARC_Config * config,
ARC_String * keyname,
void ** value )

get a value from a given keyname

Note
name may be prefaced with <group>:: to specify group
Parameters
configARC_Config to get value from
keynamename of key to get from config
valuedata retrieved from config

◆ ARC_Config_SetGroup()

void ARC_Config_SetGroup ( ARC_Config * config,
ARC_String * groupname )

sets current group in config

Note
ARC_Config_Get will use this set group
Parameters
configARC_Config we are setting current group in
groupnamename of group that will be set