Beamlib  3.0.1
This is the Beam C++ class library.
BTable.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BTable.h Simple table of data with CSV output
3  * T.Barnaby, BEAM Ltd, 2009-02-10
4  * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5  * For license see LICENSE.txt at the root of the beamlib source tree.
6  *******************************************************************************
7  */
8 #ifndef BTable_H
9 #define BTable_H
10 
11 #include <BArray.h>
12 #include <BString.h>
13 
15 class BTable {
16 public:
17  BTable();
18  ~BTable();
19 
20  void clear();
21  void setTitle(BArray<BString> title);
23 
25  void print(FILE* file = stdout);
26 
27 private:
28  void calculateWidths();
29  BString lineString(BArray<BString> line, int comment = 0);
30 
31  BArray<BString> otitle;
32  BList<BArray<BString> > odata;
33  BArray<int> ocolumnWidths;
34 };
35 
36 #endif
char data[8]
Definition: BoapMc1.h:2
Template based list class.
Definition: BList.h:31
This class stores and manipulates ASCII strings.
Definition: BString.h:20
A simple string based table structure.
Definition: BTable.h:15
void print(FILE *file=stdout)
Definition: BTable.cpp:63
void clear()
Definition: BTable.cpp:16
~BTable()
Definition: BTable.cpp:13
void addRow(BArray< BString > data)
Definition: BTable.cpp:24
BTable()
Definition: BTable.cpp:10
BString getString()
Definition: BTable.cpp:48
void setTitle(BArray< BString > title)
Definition: BTable.cpp:20