Applet API reference

Functions

Checking key existance

bool wapi_key_exists(_wap_t_config_variable *table, const char *key)

Checks if specified key exists in passed table.

bool wapi_index_exists(_wap_t_config_variable *array, size_t index)

Checks if specified index exists inside passed array.

Extracting variable from key directories

_wap_t_config_variable *wapi_get_var_from_table(_wap_t_config_variable *table, const char *key)

Extracts variable with specified key from table.

_wap_t_config_variable *wapi_get_var_from_array(_wap_t_config_variable *array, size_t index)

Extracts variable with specified index from array.

Converting variable to type

const char *wapi_var_as_string(_wap_t_config_variable *var)

Converts variable to string.

int64_t wapi_var_as_integer(_wap_t_config_variable *var)

Converts variable to integer.

double wapi_var_as_floating(_wap_t_config_variable *var)

Converts variable to floating.

bool wapi_var_as_boolean(_wap_t_config_variable *var)

Converts variable to boolean.

Error handling

bool wapi_error()

Check if errno is set to error, returns true if error is present.

void wapi_error_print()

Prints error if it’s present.

Structs

struct _wap_t_config_variable

Entire toml-based applet config.

union content
struct array

Public Members

unsigned int _size
struct _wap_t_config_variable *_content
struct table

Public Members

unsigned int _size
struct _wap_t_config_variable *_content
union value

Public Members

const char *string
int64_t integer
double floating
bool boolean
union key

Public Members

const char *string
unsigned int number
struct wap_t_applet_config

Public Members

_wap_t_config_variable root
struct wap_t_applet_info

Basic informations about applet.

Public Members

const char *name
unsigned int version

Enums

enum wap_t_config_var_type

Variable types used in applet config struct.

Values:

enumerator WAP_CONF_VAR_TYPE_STRING
enumerator WAP_CONF_VAR_TYPE_INTEGER
enumerator WAP_CONF_VAR_TYPE_FLOAT
enumerator WAP_CONF_VAR_TYPE_BOOLEAN
enumerator WAP_CONF_VAR_TYPE_ARRAY
enumerator WAP_CONF_VAR_TYPE_TABLE
enum wap_t_error_type

Enum for errors.

Values:

enumerator WAP_ERR_VARIABLE_IS_NOT_TABLE
enumerator WAP_ERR_VARIABLE_IS_NOT_ARRAY
enumerator WAP_ERR_CANNOT_FIND
enumerator WAP_ERR_INVALID_VAR_TYPE