Fixed up a couple of issues with the stringstream block. That block

works for reading transport databases with comments in them. The
other block seems to get hung up.
This commit is contained in:
Harry Moffat 2003-08-04 23:10:57 +00:00
parent f36305a288
commit 7aca56da5e
2 changed files with 32 additions and 15 deletions

View file

@ -11,6 +11,9 @@
#include <iostream>
#include <string>
#ifdef USE_STRINGSTREAM
#include <sstream>
#endif
using namespace std;
#include "CKReader.h"
@ -48,6 +51,12 @@ namespace pip {
*/
string rest;
while (! s.eof()) {
/*
* HKM Note: the USE_STRINGSTREAM block works for files
* with comments in them. The other block gets hung up
* somehow. Should probably default to the USE_STRINGSTREAM
* option.
*/
#ifdef USE_STRINGSTREAM
/*
* Read a line from the file
@ -75,25 +84,25 @@ namespace pip {
* copy of it, and index it by the species name.
*/
if (nm != "") {
_trmap[nm] = t; // t.name] = t;
_trmap[nm] = t; // t.name] = t;
}
}
#else
trdata t;
string nm;
s >> nm;
if (nm[0] != '!' && !s.eof()) {
s >> t.geom >> t.welldepth >> t.diam
>> t.dipole >> t.polar >> t.rot;
trdata t;
string nm;
s >> nm;
if (nm[0] != '!' && !s.eof()) {
s >> t.geom >> t.welldepth >> t.diam
>> t.dipole >> t.polar >> t.rot;
// get the rest of the line, in case there are comments
getline(s, rest);
if (nm != "") {
_trmap[nm] = t; // t.name] = t;
}
}
}
// get the rest of the line, in case there are comments
getline(s, rest);
if (nm != "") {
_trmap[nm] = t; // t.name] = t;
}
}
#endif
}
}

View file

@ -11,7 +11,9 @@
#include <iostream>
#include <string>
//#include <sstream>
#ifdef USE_STRINGSTREAM
#include <sstream>
#endif
using namespace std;
#include "CKReader.h"
@ -378,6 +380,12 @@ namespace ctml {
map<string, trdata> indx;
string rest;
while (! s.eof()) {
/*
* HKM Note: the USE_STRINGSTREAM block works for files
* with comments in them. The other block gets hung up
* somehow. Should probably default to the USE_STRINGSTREAM
* option.
*/
#ifdef USE_STRINGSTREAM
/*
* Read a line from the file