-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/*
* SimpleParser.cpp
using namespace std;
-ParserException::ParserException(string msg) throw()
+ParserException::ParserException(string msg) noexcept
: exception(),
_msg(msg)
{
}
-ParserException::~ParserException() throw()
+ParserException::~ParserException() noexcept
{
}
-const char * ParserException::what() const throw()
+const char * ParserException::what() const noexcept
{
return _msg.c_str();
}
-SimpleParser::SimpleParser() throw()
+SimpleParser::SimpleParser() noexcept
{
}
-SimpleParser::~SimpleParser() throw()
+SimpleParser::~SimpleParser() noexcept
{
}
-std::string SimpleParser::trim(const std::string & str) const throw()
+std::string SimpleParser::trim(const std::string & str) const noexcept
{
size_t beg = str.find_first_not_of(" \t");
if (beg == string::npos) beg = 0;
return str.substr(beg, end-beg+1);
}
-void SimpleParser::parse(const string & filename) throw(ParserException)
+void SimpleParser::parse(const string & filename)
{
ifstream fileStream(filename.c_str());
if (!fileStream) {
fileStream.close();
}
-void SimpleParser::parseTestConfigFile() throw(ParserException)
+void SimpleParser::parseTestConfigFile()
{
char * filename = getenv(TEST_CONFIG_FILE_ENV_VAR);
if (filename == NULL) {
}
}
-const string & SimpleParser::getValue(const string & key) const throw(ParserException)
+const string & SimpleParser::getValue(const string & key) const
{
map<string,string>::const_iterator iter = _configmap.find(key);
if (iter == _configmap.end()) {
return iter->second;
}
-int SimpleParser::getValueAsInt(const string & key) const throw(ParserException)
+const string & SimpleParser::getTestValue(const string & bmType, const string & protocolStr,
+ const string & key) const
+{
+ string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key;
+ try {
+ return getValue(fullkey);
+ } catch (const ParserException &) {}
+ fullkey = string("TEST_") + bmType + "_" + key;
+ try {
+ return getValue(fullkey);
+ } catch (const ParserException &) {}
+ fullkey = string("TEST_") + key;
+ return getValue(fullkey);
+}
+
+int SimpleParser::getValueAsInt(const string & key) const
{
const string & valueStr = getValue(key);
const char * valueCStr = valueStr.c_str();
return res;
}
-ostream & operator <<(ostream & os, const SimpleParser & parser) throw()
+int SimpleParser::getTestValueAsInt(const string & bmType, const string & protocolStr,
+ const string & key) const
+{
+ string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key;
+ try {
+ return getValueAsInt(fullkey);
+ } catch (const ParserException &) {}
+ fullkey = string("TEST_") + bmType + "_" + key;
+ try {
+ return getValueAsInt(fullkey);
+ } catch (const ParserException &) {}
+ fullkey = string("TEST_") + key;
+ return getValueAsInt(fullkey);
+}
+
+ostream & operator <<(ostream & os, const SimpleParser & parser) noexcept
{
if (parser._configmap.empty()) {
os << "Empty map" << endl;