mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#2631 Whitespace
This commit is contained in:
parent
4060e7e5a5
commit
41d92832a7
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -23,7 +23,9 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseDataTableFormatter::RifEclipseDataTableFormatter(QTextStream& out) : m_out(out)
|
||||
RifEclipseDataTableFormatter::RifEclipseDataTableFormatter(QTextStream& out)
|
||||
: m_out(out)
|
||||
, m_colSpacing(5)
|
||||
{
|
||||
}
|
||||
|
||||
@ -49,7 +51,7 @@ void RifEclipseDataTableFormatter::setColumnSpacing(int spacing)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseDataTableFormatter::outputBuffer()
|
||||
{
|
||||
if (m_columns.size() > 0)
|
||||
if (!m_columns.empty())
|
||||
{
|
||||
m_out << "-- ";
|
||||
for (RifEclipseOutputTableColumn& column : m_columns)
|
||||
@ -72,7 +74,8 @@ void RifEclipseDataTableFormatter::outputBuffer()
|
||||
{
|
||||
m_out << formatColumn(line.data[i], m_columns[i]);
|
||||
}
|
||||
m_out << " /" << "\n";
|
||||
m_out << " /"
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
m_columns.clear();
|
||||
@ -211,7 +214,7 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addZeroBasedCellInde
|
||||
void RifEclipseDataTableFormatter::rowCompleted()
|
||||
{
|
||||
RifEclipseOutputTableLine line;
|
||||
line.data = m_lineBuffer;
|
||||
line.data = m_lineBuffer;
|
||||
line.lineType = CONTENTS;
|
||||
m_buffer.push_back(line);
|
||||
m_lineBuffer.clear();
|
||||
@ -256,12 +259,12 @@ QString RifEclipseDataTableFormatter::format(double num, RifEclipseOutputTableDo
|
||||
{
|
||||
switch (doubleFormat.format)
|
||||
{
|
||||
case RifEclipseOutputTableDoubleFormat::RIF_FLOAT:
|
||||
return QString("%1").arg(num, 0, 'f', doubleFormat.width);
|
||||
case RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC:
|
||||
return QString("%1").arg(num, 0, 'E');
|
||||
default:
|
||||
return QString("%1");
|
||||
case RifEclipseOutputTableDoubleFormat::RIF_FLOAT:
|
||||
return QString("%1").arg(num, 0, 'f', doubleFormat.width);
|
||||
case RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC:
|
||||
return QString("%1").arg(num, 0, 'E');
|
||||
default:
|
||||
return QString("%1");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -56,7 +56,7 @@ enum RifEclipseOutputTableDoubleFormat
|
||||
struct RifEclipseOutputTableLine
|
||||
{
|
||||
RifEclipseOutputTableLineType lineType;
|
||||
std::vector< QString > data;
|
||||
std::vector<QString> data;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@ -65,13 +65,13 @@ struct RifEclipseOutputTableLine
|
||||
struct RifEclipseOutputTableDoubleFormatting
|
||||
{
|
||||
RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat format = RIF_FLOAT, int width = 5)
|
||||
: format(format),
|
||||
width(width)
|
||||
{}
|
||||
|
||||
: format(format)
|
||||
, width(width)
|
||||
{
|
||||
}
|
||||
|
||||
RifEclipseOutputTableDoubleFormat format;
|
||||
int width;
|
||||
int width;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@ -79,14 +79,14 @@ struct RifEclipseOutputTableDoubleFormatting
|
||||
//==================================================================================================
|
||||
struct RifEclipseOutputTableColumn
|
||||
{
|
||||
RifEclipseOutputTableColumn(const QString& title,
|
||||
RifEclipseOutputTableColumn(const QString& title,
|
||||
RifEclipseOutputTableDoubleFormatting doubleFormat = RifEclipseOutputTableDoubleFormatting(),
|
||||
RifEclipseOutputTableAlignment alignment = LEFT,
|
||||
int width = -1)
|
||||
: title(title),
|
||||
doubleFormat(doubleFormat),
|
||||
alignment(alignment),
|
||||
width(width)
|
||||
RifEclipseOutputTableAlignment alignment = LEFT,
|
||||
int width = -1)
|
||||
: title(title)
|
||||
, doubleFormat(doubleFormat)
|
||||
, alignment(alignment)
|
||||
, width(width)
|
||||
{
|
||||
}
|
||||
|
||||
@ -96,7 +96,6 @@ struct RifEclipseOutputTableColumn
|
||||
int width;
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
@ -108,35 +107,35 @@ public:
|
||||
|
||||
void setColumnSpacing(int spacing);
|
||||
|
||||
RifEclipseDataTableFormatter& keyword(const QString keyword);
|
||||
RifEclipseDataTableFormatter& header(std::vector<RifEclipseOutputTableColumn> tableHeader);
|
||||
RifEclipseDataTableFormatter& add(const QString str);
|
||||
RifEclipseDataTableFormatter& add(double num);
|
||||
RifEclipseDataTableFormatter& add(int num);
|
||||
RifEclipseDataTableFormatter& add(size_t num);
|
||||
RifEclipseDataTableFormatter& addZeroBasedCellIndex(size_t index);
|
||||
RifEclipseDataTableFormatter& comment(const QString str);
|
||||
void rowCompleted();
|
||||
void tableCompleted();
|
||||
RifEclipseDataTableFormatter& keyword(const QString keyword);
|
||||
RifEclipseDataTableFormatter& header(std::vector<RifEclipseOutputTableColumn> tableHeader);
|
||||
RifEclipseDataTableFormatter& add(const QString str);
|
||||
RifEclipseDataTableFormatter& add(double num);
|
||||
RifEclipseDataTableFormatter& add(int num);
|
||||
RifEclipseDataTableFormatter& add(size_t num);
|
||||
RifEclipseDataTableFormatter& addZeroBasedCellIndex(size_t index);
|
||||
RifEclipseDataTableFormatter& comment(const QString str);
|
||||
void rowCompleted();
|
||||
void tableCompleted();
|
||||
|
||||
private:
|
||||
int measure(const QString str);
|
||||
int measure(double num, RifEclipseOutputTableDoubleFormatting doubleFormat);
|
||||
int measure(int num);
|
||||
int measure(size_t num);
|
||||
int measure(const QString str);
|
||||
int measure(double num, RifEclipseOutputTableDoubleFormatting doubleFormat);
|
||||
int measure(int num);
|
||||
int measure(size_t num);
|
||||
|
||||
QString format(double num, RifEclipseOutputTableDoubleFormatting doubleFormat);
|
||||
QString format(int num);
|
||||
QString format(size_t num);
|
||||
QString formatColumn(const QString str, RifEclipseOutputTableColumn column);
|
||||
QString format(double num, RifEclipseOutputTableDoubleFormatting doubleFormat);
|
||||
QString format(int num);
|
||||
QString format(size_t num);
|
||||
QString formatColumn(const QString str, RifEclipseOutputTableColumn column);
|
||||
|
||||
void outputBuffer();
|
||||
void outputComment(RifEclipseOutputTableLine& comment);
|
||||
void outputBuffer();
|
||||
void outputComment(RifEclipseOutputTableLine& comment);
|
||||
|
||||
private:
|
||||
std::vector<RifEclipseOutputTableColumn> m_columns;
|
||||
std::vector<RifEclipseOutputTableLine> m_buffer;
|
||||
std::vector<QString> m_lineBuffer;
|
||||
QTextStream& m_out;
|
||||
int m_colSpacing = 5;
|
||||
int m_colSpacing;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user