preCICE
v3.2.0
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
h
i
m
n
p
r
s
t
Typedefs
b
d
e
g
l
m
p
r
s
t
u
v
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Variables
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
i
k
m
n
o
p
r
s
t
v
w
Enumerations
Enumerator
c
d
e
i
l
m
n
o
r
s
u
v
w
Related Symbols
Files
File List
File Members
All
_
a
b
c
d
e
g
i
j
m
n
o
p
r
s
t
v
Functions
a
b
c
g
m
p
r
s
t
v
Variables
Typedefs
Macros
b
d
m
n
p
t
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
src
utils
TableWriter.cpp
Go to the documentation of this file.
1
#include "
TableWriter.hpp
"
2
3
#include <
algorithm
>
4
#include <
iomanip
>
5
#include <
iostream
>
6
#include <
numeric
>
7
#include <
string
>
8
#include <
vector
>
9
10
Column::Column
(
std::string
const
&
name
)
11
:
name
(
name
),
12
width(
name
.size())
13
{
14
}
10
Column::Column
(
std::string
const
&
name
) {
…
}
15
16
Column::Column
(
std::string
const
&
name
,
int
width)
17
:
name
(
name
),
18
width(
std
::max(width, static_cast<int>(
name
.size())))
19
{
20
precision
=
std::min
(this->
precision
, this->width - 1);
21
}
16
Column::Column
(
std::string
const
&
name
,
int
width) {
…
}
22
23
Column::Column
(
std::string
const
&
name
,
int
width,
int
precision)
24
:
name
(
name
),
25
width(
std
::max(width, static_cast<int>(
name
.size())))
26
{
27
this->precision =
std::min
(
precision
, this->width - 1);
28
}
23
Column::Column
(
std::string
const
&
name
,
int
width,
int
precision) {
…
}
29
30
Table::Table
()
31
:
out
(
std
::cout)
32
{
33
}
30
Table::Table
() {
…
}
34
35
Table::Table
(
std::ostream
&
out
)
36
:
out
(
out
)
37
{
38
}
35
Table::Table
(
std::ostream
&
out
) {
…
}
39
40
void
Table::printHeader
()
41
{
42
using namespace
std
;
43
44
for
(
auto
&h :
cols
) {
45
out
<<
padding
<< setw(h.width) << h.name <<
padding
<<
sepChar
;
46
}
47
48
out
<<
'\n'
;
49
int
headerLength =
std::accumulate
(
cols
.
begin
(),
cols
.
end
(), 0, [
this
](
int
count,
const
Column
&col) {
50
return count + col.width + sepChar.size() + 2;
51
});
52
std::string
sepLine(headerLength,
'-'
);
53
out
<< sepLine <<
'\n'
;
54
}
40
void
Table::printHeader
() {
…
}
out
std::ostream & out
Definition
EventUtils.cpp:204
name
std::string name
Definition
SocketCommunication.cpp:725
TableWriter.hpp
std::accumulate
T accumulate(T... args)
algorithm
std::ostream
std::string
std::vector::begin
T begin(T... args)
Table::Table
Table()
Definition
TableWriter.cpp:30
Table::cols
std::vector< Column > cols
Definition
TableWriter.hpp:28
Table::out
std::ostream & out
Definition
TableWriter.hpp:31
Table::sepChar
std::string sepChar
Definition
TableWriter.hpp:29
Table::padding
char padding
Definition
TableWriter.hpp:30
Table::printHeader
void printHeader()
Prints the formatted header.
Definition
TableWriter.cpp:40
std::vector::end
T end(T... args)
iomanip
iostream
std::min
T min(T... args)
std
STL namespace.
numeric
string
Column
Definition
TableWriter.hpp:14
Column::precision
int precision
Definition
TableWriter.hpp:17
Column::Column
Column(std::string const &name)
Definition
TableWriter.cpp:10
vector