[C] Small fixes
This commit is contained in:
parent
68fbe947b4
commit
3118ef3597
@ -2,6 +2,30 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "fort.hpp"
|
#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)
|
void base_example(void)
|
||||||
{
|
{
|
||||||
fort::Table table;
|
fort::Table table;
|
||||||
|
@ -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_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_TOP_PADDING (0x01U << 2) /**< Top padding for cell content */
|
||||||
#define FT_COPT_BOTTOM_PADDING (0x01U << 3) /**< Bottom 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 */
|
#define FT_COPT_LEFT_PADDING (0x01U << 4) /**< Left padding for cell content */
|
||||||
|
31
lib/fort.hpp
31
lib/fort.hpp
@ -563,17 +563,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set default border style for all new formatted tables.
|
* Set current cell position.
|
||||||
*
|
*
|
||||||
* @param style
|
* Current cell - cell that will be edited with all modifiing functions.
|
||||||
* Pointer to border style.
|
*
|
||||||
* @return
|
* @param row
|
||||||
* - True: Success; table border style was changed.
|
* New row number for the current cell.
|
||||||
* - False: Error
|
* @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:
|
private:
|
||||||
ft_table_t *table;
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user