[A] Added cpp wrappers

This commit is contained in:
seleznevae
2018-04-01 11:36:52 +03:00
parent 9169cb8a71
commit 0fa22238ef
7 changed files with 210 additions and 76 deletions

View File

@@ -7,7 +7,6 @@
* CELL
* ***************************************************************************/
struct fort_cell {
string_buffer_t *str_buffer;
fort_table_options_t *options;

View File

@@ -105,6 +105,17 @@ void ft_ln(FTABLE *table)
table->cur_row++;
}
size_t ft_cur_row(FTABLE *table)
{
assert(table);
return table->cur_row;
}
size_t ft_cur_col(FTABLE *table)
{
assert(table);
return table->cur_col;
}
static int ft_row_printf_impl(FTABLE *table, size_t row, const char *fmt, va_list *va)
{
@@ -829,6 +840,12 @@ int ft_set_cell_option(FTABLE *table, unsigned row, unsigned col, uint32_t optio
return FT_ERROR;
}
}
if (row == FT_CUR_ROW)
row = table->cur_row;
if (row == FT_CUR_COLUMN)
col = table->cur_col;
return set_cell_option(table->options->cell_options, row, col, option, value);
}

View File

@@ -5,20 +5,6 @@
#include <stdint.h>
#include <limits.h>
//enum TextAlignment
//{
// LeftAligned,
// CenterAligned,
// RightAligned
//};
//enum RowType
//{
// Common,
// Header
//};
struct fort_column_options
{
int col_min_width;
@@ -34,21 +20,6 @@ fort_column_options_t create_column_options(void);
struct vector;
typedef struct vector vector_t;
#define FT_ANY_COLUMN (UINT_MAX)
#define FT_ANY_ROW (UINT_MAX)
#define FT_ROW_UNSPEC (UINT_MAX-1)
#define FT_COLUMN_UNSPEC (UINT_MAX-1)
#define FT_COPT_MIN_WIDTH ((uint32_t)(0x01U << (0)))
#define FT_COPT_TEXT_ALIGN ((uint32_t)(0x01U << (1)))
#define FT_COPT_TOP_PADDING ((uint32_t)(0x01U << (2)))
#define FT_COPT_BOTTOM_PADDING ((uint32_t)(0x01U << (3)))
#define FT_COPT_LEFT_PADDING ((uint32_t)(0x01U << (4)))
#define FT_COPT_RIGHT_PADDING ((uint32_t)(0x01U << (5)))
#define FT_COPT_EMPTY_STR_HEIGHT ((uint32_t)(0x01U << (6)))
#define FT_COPT_ROW_TYPE ((uint32_t)(0x01U << (7)))
#define OPTION_IS_SET(ft_opts, option) ((ft_opts) & (option))
#define OPTION_SET(ft_opts, option) ((ft_opts) |=(option))
#define OPTION_UNSET(ft_opts, option) ((ft_opts) &= ~((uint32_t)option))