Changed readFrom, which is no longer line based
This commit is contained in:
parent
7303d62c1a
commit
7fe8f333e7
1 changed files with 7 additions and 13 deletions
|
|
@ -110,25 +110,19 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent {
|
||||||
* @param _is A istream.
|
* @param _is A istream.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual void readFrom(istream& _is) {
|
virtual void readFrom(istream& _is)
|
||||||
while( _is ) { // reads line by line, and creates an object per
|
{
|
||||||
// line
|
while( _is )
|
||||||
char line[MAXLINELENGTH];
|
{
|
||||||
_is.getline( line, MAXLINELENGTH-1 );
|
|
||||||
if (strlen( line ) ) {
|
|
||||||
istrstream s( line );
|
|
||||||
EOT thisEOT;
|
EOT thisEOT;
|
||||||
thisEOT.readFrom( s );
|
thisEOT.readFrom( _is );
|
||||||
push_back( thisEOT );
|
push_back( thisEOT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write object. It's called printOn since it prints the object _on_ a stream.
|
* Write object. It's called printOn since it prints the object _on_ a stream.
|
||||||
* @param _os A ostream. In this case, prints the population to
|
* @param _os A ostream.
|
||||||
standard output. The EOT class must hav standard output with cout,
|
|
||||||
but since it should be an eoObject anyways, it's no big deal.
|
|
||||||
*/
|
*/
|
||||||
virtual void printOn(ostream& _os) const {
|
virtual void printOn(ostream& _os) const {
|
||||||
copy( begin(), end(), ostream_iterator<EOT>( _os, "\n") );
|
copy( begin(), end(), ostream_iterator<EOT>( _os, "\n") );
|
||||||
|
|
|
||||||
Reference in a new issue