1
0
Fork 0

[C] Small fixes

This commit is contained in:
seleznevae 2018-11-03 20:24:50 +03:00
parent 68fbe947b4
commit 3118ef3597
3 changed files with 47 additions and 10 deletions

View File

@ -2,6 +2,30 @@
#include <vector>
#include "fort.hpp"
fort::Table create_basic_table(void)
{
fort::Table table;
/* Set table border style */
table.set_border_style(FT_BASIC_STYLE);
// Fill table with data
table << fort::header
<< "Rank" << "Title" << "Year" << "Rating" << fort::endr
<< "1" << "The Shawshank Redemption" << "1994" << "9.5" << fort::endr
<< "2" << "12 Angry Men" << "1957" << "8.8" << fort::endr
<< "3" << "It's a Wonderful Life" << "1946" << "8.6" << fort::endr
<< fort::separator
<< "4" << "2001: A Space Odyssey" << "1968" << "8.5" << fort::endr
<< "5" << "Blade Runner" << "1982" << "8.1" << fort::endr
<< fort::endr;
table.set_cell_text_align(FT_ANY_ROW, 0, fort::TextAlign::Center);
table.set_cell_text_align(FT_ANY_ROW, 1, fort::TextAlign::Left);
std::cout << table.to_string() << std::endl;
return table;
}
void base_example(void)
{
fort::Table table;

View File

@ -676,7 +676,7 @@ int ft_set_border_style(ft_table_t *table, const struct ft_border_style *style);
* @{
*/
#define FT_COPT_MIN_WIDTH (0x01U << 0) /**< Minimum width */
#define FT_COPT_TEXT_ALIGN (0x01U << 1) /**< Text alignmemnt */
#define FT_COPT_TEXT_ALIGN (0x01U << 1) /**< Text alignment */
#define FT_COPT_TOP_PADDING (0x01U << 2) /**< Top padding for cell content */
#define FT_COPT_BOTTOM_PADDING (0x01U << 3) /**< Bottom padding for cell content */
#define FT_COPT_LEFT_PADDING (0x01U << 4) /**< Left padding for cell content */

View File

@ -563,17 +563,18 @@ public:
}
/**
* Set default border style for all new formatted tables.
* Set current cell position.
*
* @param style
* Pointer to border style.
* @return
* - True: Success; table border style was changed.
* - False: Error
* Current cell - cell that will be edited with all modifiing functions.
*
* @param row
* New row number for the current cell.
* @param col
* New row number for the current cell.
*/
bool set_default_border_style(struct ft_border_style *style)
void set_cur_cell(size_t row, size_t col)
{
return FT_IS_SUCCESS(ft_set_default_border_style(style));
ft_set_cur_cell(table, row, col);
}
private:
ft_table_t *table;
@ -628,7 +629,19 @@ public:
};
/**
* Set default border style for all new formatted tables.
*
* @param style
* Pointer to border style.
* @return
* - True: Success; table border style was changed.
* - False: Error
*/
bool set_default_border_style(struct ft_border_style *style)
{
return FT_IS_SUCCESS(ft_set_default_border_style(style));
}