add toml_array_type() api
This commit is contained in:
parent
0ce0c0d9d0
commit
c4325a38fb
11
toml.c
11
toml.c
|
@ -1609,6 +1609,17 @@ char toml_array_kind(toml_array_t* arr)
|
|||
return arr->kind;
|
||||
}
|
||||
|
||||
char toml_array_type(toml_array_t* arr)
|
||||
{
|
||||
if (arr->kind != 'v')
|
||||
return 0;
|
||||
|
||||
if (arr->nelem == 0)
|
||||
return 0;
|
||||
|
||||
return arr->type;
|
||||
}
|
||||
|
||||
|
||||
int toml_array_nelem(toml_array_t* arr)
|
||||
{
|
||||
|
|
7
toml.h
7
toml.h
|
@ -68,6 +68,13 @@ TOML_EXTERN toml_table_t* toml_table_in(toml_table_t* tab, const char* key);
|
|||
/* Return the array kind: 't'able, 'a'rray, 'v'alue */
|
||||
TOML_EXTERN char toml_array_kind(toml_array_t* arr);
|
||||
|
||||
/* For array kind 'v'alue, return the type of values
|
||||
i:int, d:double, b:bool, s:string, t:time, D:date, T:timestamp
|
||||
0 if unknown
|
||||
*/
|
||||
TOML_EXTERN char toml_array_type(toml_array_t* arr);
|
||||
|
||||
|
||||
/* Return the number of elements in the array */
|
||||
TOML_EXTERN int toml_array_nelem(toml_array_t* arr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue