From 8009617b23ec4d96c5cc8652d73bef48a2ad9a66 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 14 May 2013 20:44:40 +0100 Subject: [PATCH] ENH: wordIOList: return columnsizes when printing table --- .../primitives/strings/word/wordIOList.C | 18 +++++++++++++++--- .../primitives/strings/word/wordIOList.H | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/primitives/strings/word/wordIOList.C b/src/OpenFOAM/primitives/strings/word/wordIOList.C index ede987af53..58456cb0ac 100644 --- a/src/OpenFOAM/primitives/strings/word/wordIOList.C +++ b/src/OpenFOAM/primitives/strings/word/wordIOList.C @@ -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& wll, Ostream& os) +void Foam::printTable +( + const List& wll, + List& columnWidth, + Ostream& os +) { if (!wll.size()) return; // Find the maximum word length for each column - List 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& wll, Ostream& os) } +void Foam::printTable(const List& wll, Ostream& os) +{ + List columnWidth; + printTable(wll, columnWidth, os); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/word/wordIOList.H b/src/OpenFOAM/primitives/strings/word/wordIOList.H index c560a33a95..da9d5aa426 100644 --- a/src/OpenFOAM/primitives/strings/word/wordIOList.H +++ b/src/OpenFOAM/primitives/strings/word/wordIOList.H @@ -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 wordListIOList; // Print word list list as a table + void printTable(const List&, List&, Ostream&); void printTable(const List&, Ostream&); }