]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove code duplication.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 25 Aug 2013 05:06:53 +0000 (05:06 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 25 Aug 2013 05:06:53 +0000 (05:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@30475 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/base/parameter_handler.cc

index 18c168f742250e45b9bd4968722212401eb2a952..21a47df92dff2569e8dc6f5fba4c494b78aeee9c 100644 (file)
@@ -1367,33 +1367,10 @@ bool ParameterHandler::read_input (const std::string &filename,
 
 bool ParameterHandler::read_input_from_string (const char *s)
 {
-  // if empty std::string then exit
-  // with success
-  if ((s == 0) || ((*s) == 0)) return true;
-
-  std::string line;
-  std::string input (s);
-  int    lineno=0;
-
-  // if necessary append a newline char
-  // to make all lines equal
-  if (input[input.length()-1] != '\n')
-    input += '\n';
-
-  bool status = true;
-  while (input.size() != 0)
-    {
-      // get one line from Input (=s)
-      line.assign (input, 0, input.find('\n'));
-      // delete this part including
-      // the backspace
-      input.erase (0, input.find('\n')+1);
-      ++lineno;
-
-      status &= scan_line (line, lineno);
-    }
-
-  return status;
+  // create an istringstream representation and pass it off
+  // to the other functions doing this work
+  std::istringstream in (s);
+  return read_input (in);
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.