[A] Add functions to check if table is empty to the API

This commit is contained in:
seleznevae
2019-12-13 23:30:30 +03:00
parent f17f150e43
commit 71188fd0fb
9 changed files with 115 additions and 14 deletions

View File

@@ -145,13 +145,13 @@ void ft_ln(ft_table_t *table)
table->cur_row++;
}
size_t ft_cur_row(ft_table_t *table)
size_t ft_cur_row(const ft_table_t *table)
{
assert(table);
return table->cur_row;
}
size_t ft_cur_col(ft_table_t *table)
size_t ft_cur_col(const ft_table_t *table)
{
assert(table);
return table->cur_col;
@@ -164,6 +164,15 @@ void ft_set_cur_cell(ft_table_t *table, size_t row, size_t col)
table->cur_col = col;
}
int ft_is_empty(const ft_table_t *table)
{
assert(table);
if (table->rows == NULL || (vector_size(table->rows) == 0))
return 1;
else
return 0;
}
static int ft_row_printf_impl_(ft_table_t *table, size_t row, const struct f_string_view *fmt, va_list *va)
{
size_t i = 0;