[D] Removed redundant hdr functions

This commit is contained in:
seleznevae
2018-03-05 21:18:26 +03:00
parent 8ba3d99565
commit f5e067e7f2
6 changed files with 40 additions and 196 deletions

View File

@@ -150,59 +150,12 @@ clear:
#if defined(FORT_CLANG_COMPILER) || defined(FORT_GCC_COMPILER)
#define FT_PRINTF ft_printf
#define FT_PRINTF_LN ft_printf_ln
#define FT_HDR_PRINTF ft_hdr_printf
#define FT_HDR_PRINTF_LN ft_hdr_printf_ln
#else
#define FT_PRINTF ft_printf_impl
#define FT_PRINTF_LN ft_printf_ln_impl
#define FT_HDR_PRINTF ft_hdr_printf_impl
#define FT_HDR_PRINTF_LN ft_hdr_printf_ln_impl
#endif
int FT_HDR_PRINTF(FTABLE *FORT_RESTRICT table, const char* FORT_RESTRICT fmt, ...)
{
assert(table);
assert(fmt);
va_list va;
va_start(va, fmt);
int result = ft_row_printf_impl(table, table->cur_row, fmt, &va);
va_end(va);
if (result >= 0 && table->rows) {
int sz = vector_size(table->rows);
if (sz != 0) {
// set_row_type(*(fort_row_t**)vector_at(table->rows, sz - 1), Header);
int ignore = ft_set_cell_option(table, sz - 1, FT_ANY_COLUMN, FT_OPT_ROW_TYPE, Header);
(void)ignore;
assert(ignore == F_SUCCESS);
}
}
return result;
}
int FT_HDR_PRINTF_LN(FTABLE *FORT_RESTRICT table, const char* FORT_RESTRICT fmt, ...)
{
assert(table);
assert(fmt);
va_list va;
va_start(va, fmt);
int result = ft_row_printf_impl(table, table->cur_row, fmt, &va);
va_end(va);
if (result >= 0 && table->rows) {
int sz = vector_size(table->rows);
if (sz != 0) {
// set_row_type(*(fort_row_t**)vector_at(table->rows, sz - 1), Header);
int ignore = ft_set_cell_option(table, sz - 1, FT_ANY_COLUMN, FT_OPT_ROW_TYPE, Header);
(void)ignore;
assert(ignore == F_SUCCESS);
}
}
if (result >= 0) {
ft_ln(table);
}
return result;
}
int FT_PRINTF(FTABLE *FORT_RESTRICT table, const char* FORT_RESTRICT fmt, ...)
{

View File

@@ -316,98 +316,5 @@ void destroy_table_options(fort_table_options_t* options)
F_FREE(options);
}
/*
#define FORT_OPTIONS_SET_COLUMN_OPTION(options, column, opt_name, opt_value) \
assert(options);\
\
if (options->col_options == NULL) {\
options->col_options = create_vector(sizeof(fort_column_options_t), DEFAULT_VECTOR_CAPACITY);\
if (options->col_options == NULL) \
return F_MEMORY_ERROR; \
} \
\
while (vector_size(options->col_options) <= column) {\
fort_column_options_t def_option = create_column_options();\
vector_push(options->col_options, &def_option);\
}\
\
fort_column_options_t *col_option = (fort_column_options_t*)vector_at(options->col_options, column);\
col_option->opt_name = opt_value;\
\
return F_SUCCESS;*/
//fort_status_t fort_options_set_column_min_width(fort_table_options_t *options, size_t column, size_t width)
//{
// FORT_OPTIONS_SET_COLUMN_OPTION(options, column, col_min_width, width);
//}
//fort_status_t fort_options_set_column_alignment(fort_table_options_t *options, size_t column, enum TextAlignment al)
//{
// FORT_OPTIONS_SET_COLUMN_OPTION(options, column, align, al);
//}
//int fort_options_column_width(const fort_table_options_t *options, size_t column)
//{
// assert(options);
// if (options->col_options == NULL)
// return -1;
// if (vector_size(options->col_options) <= column)
// return -1;
// return ((fort_column_options_t*)vector_at(options->col_options, column))->col_min_width;
//}
//int fort_options_column_width(const fort_table_options_t *options, size_t column)
//{
// assert(options);
// if (options->cell_options == NULL)
// return -1;
// const fort_cell_options_t* col_opt = cget_cell_opt(options->cell_options, FT_ANY_ROW, column);
// if (col_opt == NULL || ((col_opt->options & FT_OPT_MIN_WIDTH) == 0))
// return -1;
// else {
// return col_opt->col_min_width;
// }
//}
//int fort_options_column_alignment(const fort_table_options_t *options, size_t column)
//{
// assert(options);
// enum TextAlignment align = g_column_options.align;
// if (options->col_options == NULL)
// return align;
// if (vector_size(options->col_options) <= column)
// return align;
// return ((fort_column_options_t*)vector_at(options->col_options, column))->align;
//}
//int fort_options_column_alignment(const fort_table_options_t *options, size_t column)
//{
// assert(options);
// enum TextAlignment defaultAlign = g_column_options.align;
// if (options->cell_options == NULL)
// return defaultAlign;
// const fort_cell_options_t* col_opt = cget_cell_opt(options->cell_options, FT_ANY_ROW, column);
// if (col_opt == NULL || ((col_opt->options & FT_OPT_TEXT_ALIGN) == 0))
// return defaultAlign;
// else {
// return col_opt->align;
// }
//}

View File

@@ -163,10 +163,7 @@ extern fort_table_options_t g_table_options;
fort_table_options_t* create_table_options();
fort_table_options_t* copy_table_options(const fort_table_options_t *option);
void destroy_table_options(fort_table_options_t* options);
//fort_status_t fort_options_set_column_min_width(fort_table_options_t *options, size_t column, size_t width);
//fort_status_t fort_options_set_column_alignment(fort_table_options_t *options, size_t column, enum TextAlignment al);
//int fort_options_column_width(const fort_table_options_t *options, size_t column);
//int fort_options_column_alignment(const fort_table_options_t *options, size_t column);
#endif // OPTIONS_H