mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2576 Command File : Add support for comments
This commit is contained in:
@@ -79,3 +79,12 @@ QChar RicfMessages::peekNextChar(QTextStream& inputStream)
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfMessages::skipLineWithLineNumberCount(QTextStream& inputStream)
|
||||
{
|
||||
inputStream.readLine();
|
||||
m_currentLineNumber++;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ public:
|
||||
void addError(const QString& message);
|
||||
|
||||
void skipWhiteSpaceWithLineNumberCount(QTextStream& inputStream);
|
||||
void skipLineWithLineNumberCount(QTextStream& inputStream);
|
||||
|
||||
QChar readCharWithLineNumberCount(QTextStream& inputStream);
|
||||
QChar peekNextChar(QTextStream& inputStream);
|
||||
|
||||
|
||||
@@ -45,9 +45,15 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands(QTextStream&
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
QChar currentChar;
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( currentChar.isSpace() )
|
||||
QChar currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
|
||||
if (currentChar == QChar('#'))
|
||||
{
|
||||
errorMessageContainer->skipLineWithLineNumberCount(inputStream);
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
currentChar = QChar();
|
||||
}
|
||||
else if ( currentChar.isSpace() )
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QChar isBracket('a');
|
||||
@@ -65,7 +71,11 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands(QTextStream&
|
||||
{
|
||||
break;
|
||||
}
|
||||
commandName += currentChar;
|
||||
|
||||
if (!currentChar.isNull())
|
||||
{
|
||||
commandName += currentChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user