Skip to content
Snippets Groups Projects
Commit 8009617b authored by mattijs's avatar mattijs
Browse files

ENH: wordIOList: return columnsizes when printing table

parent 6d3cfe98
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -38,12 +38,17 @@ namespace Foam
}
void Foam::printTable(const List<wordList>& wll, Ostream& os)
void Foam::printTable
(
const List<wordList>& wll,
List<string::size_type>& columnWidth,
Ostream& os
)
{
if (!wll.size()) return;
// Find the maximum word length for each column
List<string::size_type> columnWidth(wll[0].size(), string::size_type(0));
columnWidth.setSize(wll[0].size(), string::size_type(0));
forAll(columnWidth, j)
{
forAll(wll, i)
......@@ -75,4 +80,11 @@ void Foam::printTable(const List<wordList>& wll, Ostream& os)
}
void Foam::printTable(const List<wordList>& wll, Ostream& os)
{
List<string::size_type> columnWidth;
printTable(wll, columnWidth, os);
}
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,6 +43,7 @@ namespace Foam
typedef IOList<wordList> wordListIOList;
// Print word list list as a table
void printTable(const List<wordList>&, List<string::size_type>&, Ostream&);
void printTable(const List<wordList>&, Ostream&);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment