#2003 Observed Data : Add basic support for fixed width in parser

This commit is contained in:
Magne Sjaastad
2017-11-03 16:08:23 +01:00
parent 50b2717ed2
commit f50760bb35
4 changed files with 43 additions and 42 deletions

View File

@@ -66,14 +66,28 @@ const ColumnInfo* RifColumnBasedUserDataParser::columnInfo(size_t tableIndex, si
//--------------------------------------------------------------------------------------------------
void RifColumnBasedUserDataParser::parseTableData(const QString& data)
{
std::string stdData = data.toStdString();
bool isFixedWidth = RifEclipseUserDataParserTools::isFixedWidthHeader(stdData);
std::stringstream streamData;
streamData.str(data.toStdString());
streamData.str(stdData);
do
{
std::vector<std::string> errorStrings;
auto table = RifEclipseUserDataParserTools::tableDataFromText(streamData, &errorStrings);
TableData table;
if (isFixedWidth)
{
auto columnInfos = RifEclipseUserDataParserTools::columnInfoForFixedColumnWidth(streamData);
table = TableData("", "", "", columnInfos);
}
else
{
table = RifEclipseUserDataParserTools::tableDataFromText(streamData, &errorStrings);
}
if (m_errorText)
{
for (auto s : errorStrings)