Renamed newRawKeyword to createRawKeyword. Minor refactoring

This commit is contained in:
Kristian Flikka 2013-08-21 08:44:46 +02:00
parent b5dac4b5bd
commit 89daeea561
3 changed files with 10 additions and 18 deletions

View File

@ -111,7 +111,7 @@ namespace Opm {
RawKeywordPtr Parser::newRawKeyword(const DeckConstPtr deck , const std::string& keywordString) {
RawKeywordPtr Parser::createRawKeyword(const DeckConstPtr deck , const std::string& keywordString) {
if (hasKeyword(keywordString)) {
ParserKeywordConstPtr parserKeyword = m_parserKeywords.find(keywordString)->second;
if (parserKeyword->getSizeType() == UNDEFINED)
@ -147,11 +147,14 @@ namespace Opm {
std::string keywordString;
if (rawKeyword == NULL) {
if (RawKeyword::tryParseKeyword(line, keywordString))
rawKeyword = newRawKeyword( deck , keywordString );
} else {
if (RawKeyword::useLine(line))
if (RawKeyword::tryParseKeyword(line, keywordString)) {
rawKeyword = createRawKeyword( deck , keywordString );
}
}
else {
if (RawKeyword::useLine(line)) {
rawKeyword->addRawRecordString(line);
}
}
if (rawKeyword != NULL && rawKeyword->isFinished())

View File

@ -58,7 +58,7 @@ namespace Opm {
void parseFile(DeckPtr deck , const std::string &file) ;
boost::filesystem::path verifyValidInputPath(const std::string& inputPath) const;
void populateDefaultKeywords();
RawKeywordPtr newRawKeyword(const DeckConstPtr deck , const std::string& keywordString);
RawKeywordPtr createRawKeyword(const DeckConstPtr deck , const std::string& keywordString);
};

View File

@ -137,18 +137,7 @@ BOOST_AUTO_TEST_CASE(inititalizeFromFile_missing_keywords_throw) {
BOOST_CHECK_THROW( parser->initializeFromJsonFile( jsonFile ) , std::invalid_argument );
}
/*
BOOST_AUTO_TEST_CASE(createWithValidJsonFileArgument) {
boost::filesystem::path jsonFile("testdata/json/example1.json");
BOOST_CHECK_NO_THROW( Parser(jsonFile) );
}
*/
/***************** Testing non-recognized keywords ********************/
/***************** Simple Int parsing ********************************/