[C] Renames some entities

This commit is contained in:
seleznevae
2018-04-01 13:27:02 +03:00
parent 0fa22238ef
commit edaf106ed1
12 changed files with 154 additions and 122 deletions

View File

@@ -17,14 +17,14 @@ struct fort_cell_options g_default_cell_option = {
| FT_COPT_EMPTY_STR_HEIGHT,
0, /* col_min_width */
RightAligned, /* align */
FT_ALIGNED_RIGHT, /* align */
0, /* cell_padding_top */
0, /* cell_padding_bottom */
1, /* cell_padding_left */
1, /* cell_padding_right */
1, /* cell_empty_string_height */
Common, /* row_type */
FT_ROW_COMMON, /* row_type */
};
static int get_option_value_if_exists_otherwise_default(const struct fort_cell_options *cell_opts, uint32_t option)
@@ -59,7 +59,7 @@ static int get_option_value_if_exists_otherwise_default(const struct fort_cell_o
fort_column_options_t g_column_options = {
0, /* col_min_width*/
RightAligned, /* align */
FT_ALIGNED_RIGHT, /* align */
};
fort_column_options_t create_column_options(void)
@@ -158,7 +158,7 @@ static fort_status_t set_cell_option_impl(fort_cell_options_t *opt, uint32_t opt
if (OPTION_IS_SET(option, FT_COPT_MIN_WIDTH)) {
opt->col_min_width = value;
} else if (OPTION_IS_SET(option, FT_COPT_TEXT_ALIGN)) {
opt->align = (enum TextAlignment)value;
opt->align = (enum ft_text_alignment)value;
} else if (OPTION_IS_SET(option, FT_COPT_TOP_PADDING)) {
opt->cell_padding_top = value;
} else if (OPTION_IS_SET(option, FT_COPT_BOTTOM_PADDING)) {
@@ -170,7 +170,7 @@ static fort_status_t set_cell_option_impl(fort_cell_options_t *opt, uint32_t opt
} else if (OPTION_IS_SET(option, FT_COPT_EMPTY_STR_HEIGHT)) {
opt->cell_empty_string_height = value;
} else if (OPTION_IS_SET(option, FT_COPT_ROW_TYPE)) {
opt->row_type = (enum RowType)value;
opt->row_type = (enum ft_row_type)value;
}
return FT_SUCCESS;

View File

@@ -8,7 +8,7 @@
struct fort_column_options
{
int col_min_width;
enum TextAlignment align;
enum ft_text_alignment align;
};
typedef struct fort_column_options fort_column_options_t;
@@ -30,13 +30,13 @@ struct fort_cell_options
unsigned cell_col;
uint32_t options;
int col_min_width;
enum TextAlignment align;
enum ft_text_alignment align;
int cell_padding_top;
int cell_padding_bottom;
int cell_padding_left;
int cell_padding_right;
int cell_empty_string_height;
enum RowType row_type;
enum ft_row_type row_type;
};
typedef struct fort_cell_options fort_cell_options_t;

View File

@@ -7,7 +7,7 @@
struct fort_row {
vector_t *cells;
/*enum RowType type;*/
/*enum ft_row_type type;*/
};
@@ -25,7 +25,7 @@ fort_row_t *create_row(void)
/*
row->is_header = F_FALSE;
row->type = Common;
row->type = FT_ROW_COMMON;
*/
return row;
}
@@ -127,13 +127,13 @@ int print_row_separator(char *buffer, size_t buffer_sz,
int written = 0;
int tmp = 0;
enum RowType lower_row_type = Common;
enum ft_row_type lower_row_type = FT_ROW_COMMON;
if (lower_row != NULL) {
lower_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
lower_row_type = (enum ft_row_type)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
enum RowType upper_row_type = Common;
enum ft_row_type upper_row_type = FT_ROW_COMMON;
if (upper_row != NULL) {
upper_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row - 1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
upper_row_type = (enum ft_row_type)get_cell_opt_value_hierarcial(context->table_options, context->row - 1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
@@ -149,7 +149,7 @@ int print_row_separator(char *buffer, size_t buffer_sz,
typedef const char (*border_chars_point_t)[BorderItemPosSize];
const char (*border_chars)[BorderItemPosSize] = NULL;
border_chars = (border_chars_point_t)&context->table_options->border_style.border_chars;
if (upper_row_type == Header || lower_row_type == Header) {
if (upper_row_type == FT_ROW_HEADER || lower_row_type == FT_ROW_HEADER) {
border_chars = (border_chars_point_t)&context->table_options->border_style.header_border_chars;
}
@@ -232,13 +232,13 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
int written = 0;
int tmp = 0;
enum RowType lower_row_type = Common;
enum ft_row_type lower_row_type = FT_ROW_COMMON;
if (lower_row != NULL) {
lower_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
lower_row_type = (enum ft_row_type)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
enum RowType upper_row_type = Common;
enum ft_row_type upper_row_type = FT_ROW_COMMON;
if (upper_row != NULL) {
upper_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row - 1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
upper_row_type = (enum ft_row_type)get_cell_opt_value_hierarcial(context->table_options, context->row - 1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
/* Row separator anatomy
@@ -253,7 +253,7 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
typedef const char (*border_chars_point_t)[BorderItemPosSize];
const char (*border_chars)[BorderItemPosSize] = NULL;
border_chars = (border_chars_point_t)&context->table_options->border_style.border_chars;
if (upper_row_type == Header || lower_row_type == Header) {
if (upper_row_type == FT_ROW_HEADER || lower_row_type == FT_ROW_HEADER) {
border_chars = (border_chars_point_t)&context->table_options->border_style.header_border_chars;
}
@@ -473,8 +473,8 @@ int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col
*/
typedef const char (*border_chars_point_t)[BorderItemPosSize];
enum RowType row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
const char (*bord_chars)[BorderItemPosSize] = (row_type == Header)
enum ft_row_type row_type = (enum ft_row_type)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
const char (*bord_chars)[BorderItemPosSize] = (row_type == FT_ROW_HEADER)
? (border_chars_point_t)(&context->table_options->border_style.header_border_chars)
: (border_chars_point_t)(&context->table_options->border_style.border_chars);
const char *L = &(*bord_chars)[LL_bip];
@@ -543,7 +543,7 @@ int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t
*/
typedef const char (*border_chars_point_t)[BorderItemPosSize];
enum RowType row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
enum ft_row_type row_type = (enum ft_row_type)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
const char (*bord_chars)[BorderItemPosSize] = (row_type)
? (border_chars_point_t)(&context->table_options->border_style.header_border_chars)
: (border_chars_point_t)(&context->table_options->border_style.border_chars);

View File

@@ -10,10 +10,10 @@ struct fort_row;
typedef struct fort_row fort_row_t;
/*
enum RowType
enum ft_row_type
{
Common,
Header
FT_ROW_COMMON,
FT_ROW_HEADER
};
*/

View File

@@ -295,15 +295,15 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t
int right = 0;
switch (get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TEXT_ALIGN)) {
case LeftAligned:
case FT_ALIGNED_LEFT:
left = 0;
right = (buf_len - 1) - content_width;
break;
case CenterAligned:
case FT_ALIGNED_CENTER:
left = ((buf_len - 1) - content_width) / 2;
right = ((buf_len - 1) - content_width) - left;
break;
case RightAligned:
case FT_ALIGNED_RIGHT:
left = (buf_len - 1) - content_width;
right = 0;
break;
@@ -377,15 +377,15 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, siz
int right = 0;
switch (get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TEXT_ALIGN)) {
case LeftAligned:
case FT_ALIGNED_LEFT:
left = 0;
right = (buf_len - 1) - content_width;
break;
case CenterAligned:
case FT_ALIGNED_CENTER:
left = ((buf_len - 1) - content_width) / 2;
right = ((buf_len - 1) - content_width) - left;
break;
case RightAligned:
case FT_ALIGNED_RIGHT:
left = (buf_len - 1) - content_width;
right = 0;
break;