Clingo
Loading...
Searching...
No Matches
clingo_config_entry Struct Reference

Callback interface for custom configuration entries. More...

#include <config.h>

Public Attributes

bool(* get )(size_t const *index, void *data, clingo_string_t *value, bool *has_value)
 Get the value of this entry as a string.
 
bool(* set )(size_t const *index, char const *value, size_t size, void *data)
 Set the value of this entry from a string.
 
bool(* size )(void *data, size_t *size, bool *has_size)
 Get the size of this entry if it is an array.
 
void(* free )(void *data)
 Free the user data associated with this entry.
 

Detailed Description

Callback interface for custom configuration entries.

This struct allows users to define custom configuration entries by providing function pointers for querying and manipulating the entry. The data pointer is passed to each callback and can be used to store user-defined state.

On each configuration path, there can be at most one array entry. If present, the array index is passed to all entries following an array entry in the path. It is up to the entry implementation to interpret an absent index (i.e., when index is NULL).

All callbacks are optional; if a callback is NULL, the corresponding operation is not supported for this entry.

Member Data Documentation

◆ free

void(* clingo_config_entry::free) (void *data)

Free the user data associated with this entry.

Parameters
[in]datauser data pointer

◆ get

bool(* clingo_config_entry::get) (size_t const *index, void *data, clingo_string_t *value, bool *has_value)

Get the value of this entry as a string.

Parameters
[in]indexan optional array index (can be NULL)
[in]datauser data pointer
[out]valueoutput string value
[out]has_valueset to true if a value is available, false otherwise
Returns
true on success, false on error

◆ set

bool(* clingo_config_entry::set) (size_t const *index, char const *value, size_t size, void *data)

Set the value of this entry from a string.

Parameters
[in]indexan optional array index (can be NULL)
[in]valueinput string value
[in]sizelength of the value string
[in]datauser data pointer
Returns
true on success, false on error

◆ size

bool(* clingo_config_entry::size) (void *data, size_t *size, bool *has_size)

Get the size of this entry if it is an array.

Parameters
[in]datauser data pointer
[out]sizenumber of elements in the array (or zero)
[out]has_sizetrue if the entry is an array, false otherwise
Returns
true on success, false on error

The documentation for this struct was generated from the following file: