Merge remote-tracking branch 'upstream/master' into norne-keywords
This commit is contained in:
@@ -147,14 +147,22 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
bool ParserKeyword::wildCardName(const std::string& name) {
|
||||
bool ParserKeyword::validNameStart(const std::string& name) {
|
||||
if (name.length() > ParserConst::maxKeywordLength)
|
||||
return false;
|
||||
|
||||
if (!isupper(name[0]))
|
||||
return false;
|
||||
|
||||
for (unsigned int i = 1; i < name.length(); i++) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ParserKeyword::wildCardName(const std::string& name) {
|
||||
if (!validNameStart(name))
|
||||
return false;
|
||||
|
||||
for (size_t i = 1; i < name.length(); i++) {
|
||||
char c = name[i];
|
||||
if (!(isupper(c) || isdigit(c))) {
|
||||
if ((i == (name.length() - 1)) && (c == '*'))
|
||||
@@ -168,13 +176,10 @@ namespace Opm {
|
||||
|
||||
|
||||
bool ParserKeyword::validName(const std::string& name) {
|
||||
if (name.length() > ParserConst::maxKeywordLength)
|
||||
if (!validNameStart(name))
|
||||
return false;
|
||||
|
||||
if (!isupper(name[0]))
|
||||
return false;
|
||||
|
||||
for (unsigned int i = 1; i < name.length(); i++) {
|
||||
for (size_t i = 1; i < name.length(); i++) {
|
||||
char c = name[i];
|
||||
if (!(isupper(c) || isdigit(c)))
|
||||
return wildCardName(name);
|
||||
@@ -182,6 +187,7 @@ namespace Opm {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ParserKeyword::addItem(ParserItemConstPtr item) {
|
||||
if (m_isDataKeyword)
|
||||
throw std::invalid_argument("Keyword:" + getName() + " is already configured as data keyword - can not add more items.");
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace Opm {
|
||||
bool m_isTableCollection;
|
||||
ParserKeywordActionEnum m_action;
|
||||
|
||||
static bool validNameStart(const std::string& name);
|
||||
void initData( const Json::JsonObject& jsonConfig );
|
||||
void initSize( const Json::JsonObject& jsonConfig );
|
||||
void initSizeKeyword( const std::string& sizeKeyword, const std::string& sizeItem);
|
||||
|
||||
Reference in New Issue
Block a user