lemon/lemon_reader.h
changeset 2095 5ed8ef40a483
parent 2016 ecb067198349
child 2100 6fbe90faf02a
equal deleted inserted replaced
21:ca97776d3c1b 22:f9561d317c18
    14  * express or implied, and with no claim as to its suitability for any
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    15  * purpose.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 ///\ingroup io_group
    19 ///\ingroup lemon_io
    20 ///\file
    20 ///\file
    21 ///\brief Lemon Format reader.
    21 ///\brief Lemon Format reader.
    22 
    22 
    23 
    23 
    24 #ifndef LEMON_LEMON_READER_H
    24 #ifndef LEMON_LEMON_READER_H
   454       Reader reader;
   454       Reader reader;
   455     };
   455     };
   456 
   456 
   457   }
   457   }
   458 
   458 
   459   /// \ingroup io_group
   459   /// \ingroup lemon_io
   460   /// \brief Lemon Format reader class.
   460   /// \brief Lemon Format reader class.
   461   /// 
   461   /// 
   462   /// The Lemon Format contains several sections. We do not want to
   462   /// The Lemon Format contains several sections. We do not want to
   463   /// determine what sections are in a lemon file we give only a framework
   463   /// determine what sections are in a lemon file we give only a framework
   464   /// to read a section oriented format.
   464   /// to read a section oriented format.
   521 
   521 
   522       char_type* base() { return _base; }
   522       char_type* base() { return _base; }
   523 
   523 
   524       char_type* eptr() { return _eptr; }
   524       char_type* eptr() { return _eptr; }
   525 
   525 
   526       int blen() { return _eptr - _base; }
   526       int_type blen() { return _eptr - _base; }
   527 
   527 
   528       void setb(char_type* buf, int len) {
   528       void setb(char_type* buf, int_type len) {
   529 	_base = buf;
   529 	_base = buf;
   530 	_eptr = buf + len;
   530 	_eptr = buf + len;
   531       }
   531       }
   532   
   532   
   533       virtual std::streambuf* setbuf(char *buf, std::streamsize len) {
   533       virtual std::streambuf* setbuf(char *buf, std::streamsize len) {
   579 	  }
   579 	  }
   580 	}
   580 	}
   581 	return false;
   581 	return false;
   582       }
   582       }
   583 
   583 
   584       virtual int underflow() {
   584       virtual int_type underflow() {
   585 	char c;
   585 	char c;
   586 	if (_is.read(&c, 1)) {
   586 	if (_is.read(&c, 1)) {
   587 	  _is.putback(c);
   587 	  _is.putback(c);
   588 	  if (c == '@') {
   588 	  if (c == '@') {
   589 	    return EOF;
   589 	    return EOF;
   610 	}
   610 	}
   611 	setg(base(), base(), ptr);
   611 	setg(base(), base(), ptr);
   612 	return *base();
   612 	return *base();
   613       }
   613       }
   614 
   614 
   615       virtual int sync() {
   615       virtual int_type sync() {
   616 	return EOF;
   616 	return EOF;
   617       }
   617       }
   618     };
   618     };
   619 
   619 
   620   public:
   620   public: