tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
propertySet.h File Reference

A property set. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tetengo/property/storage.h>
+ Include dependency graph for propertySet.h:

Go to the source code of this file.

Functions

tetengo_property_propertySet_t * tetengo_property_propertySet_create (tetengo_property_storageLoader_t *p_storage_loader, const char *path)
 Creates a property set.
 
void tetengo_property_propertySet_destroy (const tetengo_property_propertySet_t *p_property_set)
 Destroys a property set.
 
bool tetengo_property_propertySet_getBool (const tetengo_property_propertySet_t *p_property_set, const char *key, bool *p_value)
 Returns the value in a boolean.
 
void tetengo_property_propertySet_setBool (tetengo_property_propertySet_t *p_property_set, const char *key, bool value)
 Sets a value in a boolean.
 
bool tetengo_property_propertySet_getUint32 (const tetengo_property_propertySet_t *p_property_set, const char *key, uint32_t *p_value)
 Returns the value in an unsigned 32-bit integer.
 
void tetengo_property_propertySet_setUint32 (tetengo_property_propertySet_t *p_property_set, const char *key, uint32_t value)
 Sets a value in an unsigned 32-bit integer.
 
size_t tetengo_property_propertySet_getString (const tetengo_property_propertySet_t *p_property_set, const char *key, char *p_value, size_t value_capacity)
 Returns the value in a string.
 
void tetengo_property_propertySet_setString (tetengo_property_propertySet_t *p_property_set, const char *key, const char *value)
 Sets a value in a string.
 
void tetengo_property_propertySet_update (tetengo_property_propertySet_t *p_property_set)
 Updates the property values to the latest state in the storage.
 
void tetengo_property_propertySet_commit (const tetengo_property_propertySet_t *p_property_set)
 Commits the property value changes to the storage.
 

Detailed Description

A property set.

Copyright (C) 2019-2023 kaoru https://www.tetengo.org/

Function Documentation

◆ tetengo_property_propertySet_commit()

void tetengo_property_propertySet_commit ( const tetengo_property_propertySet_t *  p_property_set)

Commits the property value changes to the storage.

Parameters
p_property_setA pointer to a property set.

◆ tetengo_property_propertySet_create()

tetengo_property_propertySet_t * tetengo_property_propertySet_create ( tetengo_property_storageLoader_t *  p_storage_loader,
const char *  path 
)

Creates a property set.

The ownership of the storage loader pointed by p_storage_loader is transferred into the property set. There is no need to destroy the storage loader after calling this function.

Parameters
p_storage_loaderA pointer to a storage loader.
pathA path.
Returns
A pointer to a property set. Or NULL on error.

◆ tetengo_property_propertySet_destroy()

void tetengo_property_propertySet_destroy ( const tetengo_property_propertySet_t *  p_property_set)

Destroys a property set.

Parameters
p_property_setA pointer to a property set.

◆ tetengo_property_propertySet_getBool()

bool tetengo_property_propertySet_getBool ( const tetengo_property_propertySet_t *  p_property_set,
const char *  key,
bool *  p_value 
)

Returns the value in a boolean.

Parameters
p_property_setA pointer to a property set.
keyA key.
p_valueThe storage for a value.
Return values
trueWhen the value is set to p_value.
falseOtherwise.

◆ tetengo_property_propertySet_getString()

size_t tetengo_property_propertySet_getString ( const tetengo_property_propertySet_t *  p_property_set,
const char *  key,
char *  p_value,
size_t  value_capacity 
)

Returns the value in a string.

Parameters
p_property_setA pointer to a property set.
keyA key.
p_valueThe storage for a value. Can be NULL.
value_capacityA value capacity.
Returns
The value length. Or (size_t)-1 when no value for key is found.

◆ tetengo_property_propertySet_getUint32()

bool tetengo_property_propertySet_getUint32 ( const tetengo_property_propertySet_t *  p_property_set,
const char *  key,
uint32_t *  p_value 
)

Returns the value in an unsigned 32-bit integer.

Parameters
p_property_setA pointer to a property set.
keyA key.
p_valueThe storage for a value.
Return values
trueWhen the value is set to p_value.
falseOtherwise.

◆ tetengo_property_propertySet_setBool()

void tetengo_property_propertySet_setBool ( tetengo_property_propertySet_t *  p_property_set,
const char *  key,
bool  value 
)

Sets a value in a boolean.

Parameters
p_property_setA pointer to a property set.
keyA key.
valueA value.

◆ tetengo_property_propertySet_setString()

void tetengo_property_propertySet_setString ( tetengo_property_propertySet_t *  p_property_set,
const char *  key,
const char *  value 
)

Sets a value in a string.

Parameters
p_property_setA pointer to a property set.
keyA key.
valueA value.

◆ tetengo_property_propertySet_setUint32()

void tetengo_property_propertySet_setUint32 ( tetengo_property_propertySet_t *  p_property_set,
const char *  key,
uint32_t  value 
)

Sets a value in an unsigned 32-bit integer.

Parameters
p_property_setA pointer to a property set.
keyA key.
valueA value.

◆ tetengo_property_propertySet_update()

void tetengo_property_propertySet_update ( tetengo_property_propertySet_t *  p_property_set)

Updates the property values to the latest state in the storage.

Parameters
p_property_setA pointer to a property set.