-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
//
// 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.
+// 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
const char MEDLoaderBase::WHITE_SPACES[]=" \n";
-int MEDLoaderBase::getStatusOfFile(const char *fileName)
+int MEDLoaderBase::getStatusOfFile(const std::string& fileName)
{
std::ifstream ifs;
- ifs.open(fileName);
+ ifs.open(fileName.c_str());
if((ifs.rdstate() & std::ifstream::failbit)!=0)
{
ifs.close();
return NOT_EXIST;
}
- std::ofstream ofs(fileName,std::ios_base::app);
+ std::ofstream ofs(fileName.c_str(),std::ios_base::app);
if((ofs.rdstate() & std::ofstream::failbit)!=0)
{
return EXIST_RDONLY;
return ret;
}
-void MEDLoaderBase::getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName) throw(INTERP_KERNEL::Exception)
+void MEDLoaderBase::getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName)
{
std::size_t pos=fullName.find_last_of(getPathSep());
if(pos!=std::string::npos)
}
}
-std::string MEDLoaderBase::joinPath(const std::string& dirName, const std::string& baseName) throw(INTERP_KERNEL::Exception)
+std::string MEDLoaderBase::joinPath(const std::string& dirName, const std::string& baseName)
{
if(!dirName.empty())
return dirName+getPathSep()+baseName;
return baseName;
}
-std::string MEDLoaderBase::getPathSep() throw(INTERP_KERNEL::Exception)
+std::string MEDLoaderBase::getPathSep()
{
#ifndef WIN32
return std::string("/");
{
std::string ret(buildStringFromFortran(name,nameLgth));
std::string unitCpp(buildStringFromFortran(unit,unitLgth));
- if(unitCpp[0]=='\0')
+ if(unitCpp.empty() || unitCpp[0]=='\0')
return ret;
ret+=" [";
ret+=unitCpp;
* If 'behaviour' equals 0 an exception is thrown. If 'behaviour' equals 1 an attempt of zipping of string will be done
* ( see zipString to have more details).
*/
-void MEDLoaderBase::safeStrCpy(const char *src, int maxLgth, char *dest, int behaviour) throw(INTERP_KERNEL::Exception)
+void MEDLoaderBase::safeStrCpy(const char *src, int maxLgth, char *dest, int behaviour)
{
if((int)strlen(src)>maxLgth)
{
* This method is equivalent to MEDLoaderBase::safeStrCpy except that here no '\0' car is put.
* This method should be used for multi string in one string.
*/
-void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour) throw(INTERP_KERNEL::Exception)
+void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour)
{
if((int)strlen(src)>maxLgth)
{
* This method given the target size to respect 'sizeToRespect' tries to reduce size of 'src' string.
* This method uses several soft methods to do its job. But if it fails a simple cut of string will be performed.
*/
-std::string MEDLoaderBase::zipString(const char *src, int sizeToRespect)
+std::string MEDLoaderBase::zipString(const std::string& src, int sizeToRespect)
{
std::string s(src);
strip(s);