Moved readKeyword() and upcase() to EclipseGridParser.cpp.

This commit is contained in:
Atgeirr Flø Rasmussen
2012-03-23 13:17:02 +01:00
parent 355eb053e8
commit 2244158f81
2 changed files with 26 additions and 26 deletions

View File

@@ -170,6 +170,32 @@ namespace {
}
}
inline std::string upcase(const std::string& s)
{
std::string us(s);
// Getting the character type facet for toupper().
// We use the classic (i.e. C) locale.
const std::ctype<char>& ct = std::use_facet< std::ctype<char> >(std::locale::classic());
for (int i = 0; i < int(s.size()); ++i) {
us[i] = ct.toupper(s[i]);
}
return us;
}
inline std::string readKeyword(std::istream& is)
{
std::string keyword_candidate;
while (!is.eof()) {
is >> keyword_candidate;
if(keyword_candidate.find("--") == 0) {
is >> ignoreLine; // This line is a comment
} else {
return upcase(keyword_candidate);
}
}
return "CONTINUE"; // Last line in included file is a comment
}
} // anon namespace