[C] Refactoring of setting row type

This commit is contained in:
seleznevae
2018-03-05 21:08:14 +03:00
parent ff3ba95d85
commit 8ba3d99565
15 changed files with 1058 additions and 163 deletions

View File

@@ -1,10 +1,41 @@
#include <stdio.h>
#include "fort.h"
#include <wchar.h>
#include <locale.h>
int main()
{
FTABLE *table = ft_create_table();
FTABLE *table = NULL;
#ifdef FORT_HAVE_WCHAR
setlocale(LC_CTYPE, "");
table = ft_create_table();
ft_set_cell_option(table, FT_ANY_ROW, 0, FT_OPT_TEXT_ALIGN, CenterAligned);
ft_set_cell_option(table, FT_ANY_ROW, 1, FT_OPT_TEXT_ALIGN, LeftAligned);
FT_NWWRITE_LN(table, L"1", L"Побег из Шоушенка", L"1994", L"9.5");
FT_NWWRITE_LN(table, L"2", L"12 разгневанных мужчин", L"1957", L"8.8");
FT_NWWRITE_LN(table, L"3", L"Космическая одиссея 2001 года", L"1968", L"8.5");
FT_NWWRITE_LN(table, L"4", L"Бегущий по лезвию", L"1982", L"8.1");
fwprintf(stderr, L"Table:\n");
fwprintf(stderr, L"%ls\n", ft_to_wstring(table));
ft_destroy_table(table);
#endif
/*-------------------------------------------------------------*/
table = ft_create_table();
ft_set_cell_option(table, FT_ANY_ROW, 0, FT_OPT_TEXT_ALIGN, CenterAligned);
ft_set_cell_option(table, FT_ANY_ROW, 1, FT_OPT_TEXT_ALIGN, LeftAligned);
@@ -83,5 +114,11 @@ int main()
printf("Table:\n");
printf("%s\n", ft_to_string(table));
ft_destroy_table(table);
/*-------------------------------------------------------------*/
table = NULL;
}