A property set.
More...
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tetengo/property/storage.h>
Go to the source code of this file.
|
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.
|
|
A property set.
Copyright (C) 2019-2023 kaoru https://www.tetengo.org/
◆ 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_set | A 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_loader | A pointer to a storage loader. |
path | A 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_set | A 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_set | A pointer to a property set. |
key | A key. |
p_value | The storage for a value. |
- Return values
-
true | When the value is set to p_value. |
false | Otherwise. |
◆ 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_set | A pointer to a property set. |
key | A key. |
p_value | The storage for a value. Can be NULL. |
value_capacity | A 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_set | A pointer to a property set. |
key | A key. |
p_value | The storage for a value. |
- Return values
-
true | When the value is set to p_value. |
false | Otherwise. |
◆ 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_set | A pointer to a property set. |
key | A key. |
value | A 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_set | A pointer to a property set. |
key | A key. |
value | A 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_set | A pointer to a property set. |
key | A key. |
value | A 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_set | A pointer to a property set. |