mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: wordIOList: return columnsizes when printing table
This commit is contained in:
@ -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&);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user