Add helper function for arrays
New function for read only access to the internal nelem member of toml_array_t structs
This commit is contained in:
parent
88eacb3fe0
commit
b53c016877
2 changed files with 8 additions and 0 deletions
5
toml.c
5
toml.c
|
@ -1610,6 +1610,11 @@ char toml_array_kind(toml_array_t* arr)
|
|||
}
|
||||
|
||||
|
||||
int toml_array_nelem(toml_array_t* arr)
|
||||
{
|
||||
return arr->nelem;
|
||||
}
|
||||
|
||||
int toml_table_nkval(toml_table_t* tab)
|
||||
{
|
||||
return tab->nkval;
|
||||
|
|
3
toml.h
3
toml.h
|
@ -63,6 +63,9 @@ 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);
|
||||
|
||||
/* Return the number of elements in the array */
|
||||
TOML_EXTERN int toml_array_nelem(toml_array_t* arr);
|
||||
|
||||
/* Return the number of key-values in a table */
|
||||
TOML_EXTERN int toml_table_nkval(toml_table_t* tab);
|
||||
|
||||
|
|
Loading…
Reference in a new issue