-
Notifications
You must be signed in to change notification settings - Fork 0
/
TablePrinter.cc
52 lines (47 loc) · 1.77 KB
/
TablePrinter.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
* Copyright (c) 2020 CEA
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
* Contributors: Francois Letierce
*******************************************************************************/
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#include "TablePrinter.h"
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <regex>
#include <locale>
/*---------------------------------------------------------------------------*/
/*!
* \brief
* Ctor
*
* \param precision: number of digits to dispay for floating point numbers. Default is 8
* \param output: Stream to use as output. Default is std::cout
* \param separator: Pattern to use to separate columns. Default is " | ".
*
*/
/*---------------------------------------------------------------------------*/
TablePrinter::TablePrinter(const std::string& table_title, const size_t& precision,
std::ostream& output, const std::string& separator)
: m_title_width(0), m_table_width(0), m_i(0), m_j(0), m_precision(precision),
m_ostream(output), m_separator(separator), m_CORNER("+"), m_HORIZONTAL_BORDER("-"),
m_LEFT_VERTICAL_BORDER("| "), m_RIGHT_VERTICAL_BORDER(" |")
{
setTitle(table_title);
}
/*---------------------------------------------------------------------------*/
/*!
* \brief
* Dtor
*
*/
/*---------------------------------------------------------------------------*/
TablePrinter::~TablePrinter()
{
// Nothing
}