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

A storage. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+ Include dependency graph for storage.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void tetengo_property_storage_destroy (const tetengo_property_storage_t *p_storage)
 Destroys a storage.
 
bool tetengo_property_storage_getBool (const tetengo_property_storage_t *p_storage, const char *key, bool *p_value)
 Returns the value in a boolean.
 
void tetengo_property_storage_setBool (tetengo_property_storage_t *p_storage, const char *key, bool value)
 Sets a value in a boolean.
 
bool tetengo_property_storage_getUint32 (const tetengo_property_storage_t *p_storage, const char *key, uint32_t *p_value)
 Returns the value in an unsigned 32-bit integer.
 
void tetengo_property_storage_setUint32 (tetengo_property_storage_t *p_storage, const char *key, uint32_t value)
 Sets a value in an unsigned 32-bit integer.
 
size_t tetengo_property_storage_getString (const tetengo_property_storage_t *p_storage, const char *key, char *p_value, size_t value_capacity)
 Returns the value in a string.
 
void tetengo_property_storage_setString (tetengo_property_storage_t *p_storage, const char *key, const char *value)
 Sets a value in a string.
 
void tetengo_property_storage_save (const tetengo_property_storage_t *p_storage)
 Saves the values.
 
tetengo_property_storageLoader_t * tetengo_property_storageLoader_createMemoryStorageLoader ()
 Creates a memory storage loader.
 
tetengo_property_storageLoader_t * tetengo_property_storageLoader_createFileStorageLoader ()
 Creates a file storage loader.
 
tetengo_property_storageLoader_t * tetengo_property_storageLoader_createWindowsRegistoryStorageLoader ()
 Creates a Windows registry storage loader.
 
tetengo_property_storageLoader_t * tetengo_property_storageLoader_createStorageLoaderProxy (tetengo_property_storageLoader_t *p_real_storage_loader)
 Creates a storage loader proxy.
 
void tetengo_property_storageLoader_destroy (const tetengo_property_storageLoader_t *p_storage_loader)
 Destroys a storage loader.
 
tetengo_property_storage_t * tetengo_property_storageLoader_load (const tetengo_property_storageLoader_t *p_storage_loader, const char *path)
 Loads a storage.
 

Detailed Description

A storage.

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

Function Documentation

◆ tetengo_property_storage_destroy()

void tetengo_property_storage_destroy ( const tetengo_property_storage_t *  p_storage)

Destroys a storage.

Parameters
p_storageA pointer to a storage.

◆ tetengo_property_storage_getBool()

bool tetengo_property_storage_getBool ( const tetengo_property_storage_t *  p_storage,
const char *  key,
bool *  p_value 
)

Returns the value in a boolean.

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

◆ tetengo_property_storage_getString()

size_t tetengo_property_storage_getString ( const tetengo_property_storage_t *  p_storage,
const char *  key,
char *  p_value,
size_t  value_capacity 
)

Returns the value in a string.

Parameters
p_storageA pointer to a storage.
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_storage_getUint32()

bool tetengo_property_storage_getUint32 ( const tetengo_property_storage_t *  p_storage,
const char *  key,
uint32_t *  p_value 
)

Returns the value in an unsigned 32-bit integer.

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

◆ tetengo_property_storage_save()

void tetengo_property_storage_save ( const tetengo_property_storage_t *  p_storage)

Saves the values.

Parameters
p_storageA pointer to a storage.

◆ tetengo_property_storage_setBool()

void tetengo_property_storage_setBool ( tetengo_property_storage_t *  p_storage,
const char *  key,
bool  value 
)

Sets a value in a boolean.

Parameters
p_storageA pointer to a storage.
keyA key.
valueA value.

◆ tetengo_property_storage_setString()

void tetengo_property_storage_setString ( tetengo_property_storage_t *  p_storage,
const char *  key,
const char *  value 
)

Sets a value in a string.

Parameters
p_storageA pointer to a storage.
keyA key.
valueA value.

◆ tetengo_property_storage_setUint32()

void tetengo_property_storage_setUint32 ( tetengo_property_storage_t *  p_storage,
const char *  key,
uint32_t  value 
)

Sets a value in an unsigned 32-bit integer.

Parameters
p_storageA pointer to a storage.
keyA key.
valueA value.

◆ tetengo_property_storageLoader_createFileStorageLoader()

tetengo_property_storageLoader_t * tetengo_property_storageLoader_createFileStorageLoader ( )

Creates a file storage loader.

Returns
A pointer to a storage loader.

◆ tetengo_property_storageLoader_createMemoryStorageLoader()

tetengo_property_storageLoader_t * tetengo_property_storageLoader_createMemoryStorageLoader ( )

Creates a memory storage loader.

Returns
A pointer to a storage loader.

◆ tetengo_property_storageLoader_createStorageLoaderProxy()

tetengo_property_storageLoader_t * tetengo_property_storageLoader_createStorageLoaderProxy ( tetengo_property_storageLoader_t *  p_real_storage_loader)

Creates a storage loader proxy.

The ownership of the real storage loader pointed by p_real_storage_loader is transferred into the storage loader proxy. There is no need to destroy the real storage loader after calling this function.

Parameters
p_real_storage_loaderA pointer to a real storage loader.
Returns
A pointer to a storage loader.

◆ tetengo_property_storageLoader_createWindowsRegistoryStorageLoader()

tetengo_property_storageLoader_t * tetengo_property_storageLoader_createWindowsRegistoryStorageLoader ( )

Creates a Windows registry storage loader.

Returns
A pointer to a storage loader.

◆ tetengo_property_storageLoader_destroy()

void tetengo_property_storageLoader_destroy ( const tetengo_property_storageLoader_t *  p_storage_loader)

Destroys a storage loader.

Parameters
p_storage_loaderA pointer to a storage loader.

◆ tetengo_property_storageLoader_load()

tetengo_property_storage_t * tetengo_property_storageLoader_load ( const tetengo_property_storageLoader_t *  p_storage_loader,
const char *  path 
)

Loads a storage.

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