New function: cw_ktv_getbstr16
FossilOrigin-Name: 0380dcb61dcb0799d19286b4edbbd6744ae56bee986fa6515fe653768a1caccf
This commit is contained in:
parent
1f630cfe3d
commit
c7d778a958
@ -106,6 +106,7 @@ KTVSRC=\
|
|||||||
cw_ktv_replace.c\
|
cw_ktv_replace.c\
|
||||||
cw_ktv_add_from_str.c\
|
cw_ktv_add_from_str.c\
|
||||||
cw_ktv_get_byte.c\
|
cw_ktv_get_byte.c\
|
||||||
|
cw_ktv_get_bstr16.c\
|
||||||
cw_ktv_set_byte.c\
|
cw_ktv_set_byte.c\
|
||||||
cw_ktv_get.c\
|
cw_ktv_get.c\
|
||||||
cw_ktv_get_word.c\
|
cw_ktv_get_word.c\
|
||||||
|
13
src/cw/cw_ktv_get_bstr16.c
Normal file
13
src/cw/cw_ktv_get_bstr16.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "ktv.h"
|
||||||
|
#include "bstr.h"
|
||||||
|
|
||||||
|
bstr16_t cw_ktv_get_bstr16(mavl_t ktv,const char *key, bstr16_t def)
|
||||||
|
{
|
||||||
|
cw_KTV_t * k;
|
||||||
|
k = cw_ktv_get(ktv,key,CW_TYPE_STR);
|
||||||
|
if (k != NULL){
|
||||||
|
return bstr16_create(k->type->data(k),k->type->len(k));
|
||||||
|
}
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "mavl.h"
|
#include "mavl.h"
|
||||||
|
#include "bstr.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup ALGOS
|
* @addtogroup ALGOS
|
||||||
@ -143,6 +143,7 @@ int cw_ktv_read_file(FILE * file, mavl_t ktv, mavl_t types);
|
|||||||
cw_KTV_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type);
|
cw_KTV_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type);
|
||||||
uint8_t cw_ktv_get_byte(mavl_t ktv,const char *key, uint8_t def);
|
uint8_t cw_ktv_get_byte(mavl_t ktv,const char *key, uint8_t def);
|
||||||
cw_KTV_t * cw_ktv_set_byte(mavl_t ktv,const char * key, uint8_t byte);
|
cw_KTV_t * cw_ktv_set_byte(mavl_t ktv,const char * key, uint8_t byte);
|
||||||
|
bstr16_t cw_ktv_get_bstr16(mavl_t ktv,const char *key, bstr16_t def);
|
||||||
|
|
||||||
uint16_t cw_ktv_get_word(mavl_t ktv,const char *key, uint16_t def);
|
uint16_t cw_ktv_get_word(mavl_t ktv,const char *key, uint16_t def);
|
||||||
uint32_t cw_ktv_get_dword(mavl_t ktv,const char *key, uint32_t def);
|
uint32_t cw_ktv_get_dword(mavl_t ktv,const char *key, uint32_t def);
|
||||||
|
Loading…
Reference in New Issue
Block a user