T-Box Basic dev
Loading...
Searching...
No Matches
property.h
Go to the documentation of this file.
1
11
12#ifndef __TBOX_PROPERTY_H__
13#define __TBOX_PROPERTY_H__
14
15#include <stdbool.h>
16#include <stdint.h>
17#include <stdio.h>
18
19#ifdef __cplusplus
20extern "C"
21{
22#endif
23
29
30#define TBOX_PROP_NAME_MAX 32
31#define TBOX_PROP_VALUE_MAX 256
32#define TBOX_PROP_BLOB_MAX 4096
33
40typedef void (*property_callback_t)(const char* key, const char* value, void* arg);
41
47
54
61int tbox_prop_set_bool(const char* key, bool value);
62
70int tbox_prop_get_bool(const char* key, bool* value, bool defaultValue);
71
78int tbox_prop_set_int(const char* key, int value);
79
87int tbox_prop_get_int(const char* key, int* value, int defaultValue);
88
95int tbox_prop_set_int64(const char* key, int64_t value);
96
104int tbox_prop_get_int64(const char* key, int64_t* value, int64_t defaultValue);
105
112int tbox_prop_set_string(const char* key, const char* value);
113
122int tbox_prop_get_string(const char* key, char* value, size_t* valueLen, const char* defaultValue);
123
131int tbox_prop_set_bytes(const char* key, const uint8_t* value, size_t valueLen);
132
140int tbox_prop_get_bytes(const char* key, uint8_t* value, size_t* valueLen);
141
149int tbox_prop_set_blob(const char* key, const uint8_t* value, size_t valueLen);
150
158int tbox_prop_get_blob(const char* key, uint8_t* value, size_t* valueLen);
159
169int tbox_prop_get_int_range(const char* key, int* value, int min, int max, int defaultValue);
170
178
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif /* __TBOX_PROPERTY_H__ */
int tbox_prop_get_int64(const char *key, int64_t *value, int64_t defaultValue)
获取64位整数属性
int tbox_prop_get_string(const char *key, char *value, size_t *valueLen, const char *defaultValue)
获取字符串属性
int tbox_prop_set_bytes(const char *key, const uint8_t *value, size_t valueLen)
设置字节数组属性
int tbox_prop_get_int_range(const char *key, int *value, int min, int max, int defaultValue)
获取整数范围属性
int tbox_prop_set_string(const char *key, const char *value)
设置字符串属性
int tbox_prop_set_int64(const char *key, int64_t value)
设置64位整数属性
int tbox_prop_get_bool(const char *key, bool *value, bool defaultValue)
获取布尔属性
int tbox_prop_get_bytes(const char *key, uint8_t *value, size_t *valueLen)
获取字节数组属性
int tbox_prop_init(void)
初始化属性
int tbox_prop_get_lists(property_callback_t callback, void *arg)
获取属性列表
int tbox_prop_set_blob(const char *key, const uint8_t *value, size_t valueLen)
设置 blob 属性(分片存入多个 property)
void(* property_callback_t)(const char *key, const char *value, void *arg)
属性回调函数类型
Definition property.h:40
int tbox_prop_get_blob(const char *key, uint8_t *value, size_t *valueLen)
获取 blob 属性
int tbox_prop_clear(void)
清空属性内存
int tbox_prop_set_int(const char *key, int value)
设置整数属性
int tbox_prop_set_bool(const char *key, bool value)
设置布尔属性
int tbox_prop_get_int(const char *key, int *value, int defaultValue)
获取整数属性