From: kayser-herold Date: Thu, 26 Jul 2007 19:07:05 +0000 (+0000) Subject: Replaced several checks for spaces by checks for whitespaces. The X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b37a6d47c73a0ec07b682ed4df8f2ee054830f82;p=dealii-svn.git Replaced several checks for spaces by checks for whitespaces. The motivation were problems under cygwin, where under certain conditions the CR of a CR LF was stuck at the end of an identifier, which made it unrecognisable by the parser. The parsing is hopefully a little more robust now. git-svn-id: https://svn.dealii.org/trunk@14870 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index 6dd3ed457d..2b8ded2088 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef HAVE_STD_NUMERIC_LIMITS # include @@ -315,10 +316,10 @@ namespace Patterns tmp = ""; while ((name.length() != 0) && - (name[0] == ' ')) + (std::isspace (name[0]))) name.erase (0,1); - while (name[name.length()-1] == ' ') + while (std::isspace (name[name.length()-1])) name.erase (name.length()-1, 1); split_list.push_back (name); @@ -402,9 +403,9 @@ namespace Patterns tmp = ""; while ((name.length() != 0) && - (name[0] == ' ')) + (std::isspace (name[0]))) name.erase (0,1); - while (name[name.length()-1] == ' ') + while (std::isspace (name[name.length()-1])) name.erase (name.length()-1, 1); split_list.push_back (name); @@ -1253,11 +1254,11 @@ ParameterHandler::scan_line (std::string line, // now every existing whitespace // should be exactly one ' '; // if at end or beginning: delete - if ((line.length() != 0) && (line[0] == ' ')) line.erase (0, 1); + if ((line.length() != 0) && (std::isspace (line[0]))) line.erase (0, 1); // if line is now empty: leave if (line.length() == 0) return true; - if (line[line.length()-1] == ' ') + if (std::isspace (line[line.length()-1])) line.erase (line.size()-1, 1); // enter subsection @@ -1780,8 +1781,8 @@ void MultipleParameterLoop::Entry::split_different_values () multiple.erase (multiple.size()-1, 1); // erase leading and trailing spaces // in multiple - while (multiple[0] == ' ') multiple.erase (0,1); - while (multiple[multiple.size()-1] == ' ') multiple.erase (multiple.size()-1,1); + while (std::isspace (multiple[0])) multiple.erase (0,1); + while (std::isspace (multiple[multiple.size()-1])) multiple.erase (multiple.size()-1,1); // delete spaces around '|' while (multiple.find(" |") != std::string::npos)