]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGConfigFile.cpp
Updates from JSBSim, including new turbine engine model from David Culp
[flightgear.git] / src / FDM / JSBSim / FGConfigFile.cpp
index 77d0628de2fc51b9e3254c45d1932c031423b4c0..c6c3832880ed5177a293b2c88347e706587179c9 100644 (file)
@@ -21,6 +21,8 @@ INCLUDES
 #include <stdlib.h>
 #include <math.h>
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_CONFIGFILE;
 
@@ -221,6 +223,12 @@ string FGConfigFile::GetLine(void)
       }
     }
   }
+
+  int index = scratch.find_last_not_of(" ");
+  if (index != string::npos && index < (scratch.size()-1)) {
+    scratch = scratch.substr(0,index+1);
+  }
+
   if (cfgfile.eof() && scratch.empty()) return string("EOF");
   return scratch;
 }
@@ -271,28 +279,6 @@ FGConfigFile& FGConfigFile::operator>>(int& val)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGConfigFile& FGConfigFile::operator>>(eParam& val)
-{
-  string::size_type pos, end;
-
-  pos = CurrentLine.find_first_not_of(", ",CurrentIndex);
-  if (pos == CurrentLine.npos) pos = CurrentLine.length();
-  end = CurrentLine.find_first_of(", ",pos+1);
-  if (end == CurrentLine.npos) end = CurrentLine.length();
-  string str = CurrentLine.substr(pos, end - pos);
-  val = (eParam)atoi(str.c_str());
-  CurrentIndex = end+1;
-  if (end == pos) {
-    GetNextConfigLine();
-    *this >> val;
-  } else {
-    if (CurrentIndex >= CurrentLine.length()) GetNextConfigLine();
-  }
-  return *this;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 FGConfigFile& FGConfigFile::operator>>(string& str)
 {
   string::size_type pos, end;
@@ -361,4 +347,4 @@ void FGConfigFile::Debug(int from)
     }
   }
 }
-
+}