Debian Codegraph @

yo/classtemplates/examples/table/table.cc

raw
1 /*
2 table.cc
3 */
4
5 #include <fstream>
6 #include <iostream>
7 #include <string>
8 #include <iterator>
9 #include <sstream>
10
11 #include "tablesupport/tablesupport.h"
12 #include "table/table.h"
13
14 using namespace std;
15 using namespace FBB;
16
17 int main(int argc, char **argv)
18 {
19 size_t nCols = 5;
20 if (argc > 1)
21 {
22 istringstream iss(argv[1]);
23 iss >> nCols;
24 }
25
26 istream_iterator<string> iter(cin); // first iterator isn't const
27
28 Table<istream_iterator<string> >
29 table(iter, istream_iterator<string>(), nCols,
30 argc == 2 ? TableType::VERTICAL : TableType::HORIZONTAL);
31
32 cout << table << '\n';
33 }
34 /*
35 Example of generated output:
36 After: echo a b c d e f g h i j | demo 3
37 a e i
38 b f j
39 c g
40 d h
41 After: echo a b c d e f g h i j | demo 3 h
42 a b c
43 d e f
44 g h i
45 j
46 */