summaryrefslogtreecommitdiff
path: root/qmake/tools/qtextstream.cpp
authorllornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
committer llornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
commit155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (side-by-side diff)
treee6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/tools/qtextstream.cpp
parent86703e8a5527ef114facd02c005b6b3a7e62e263 (diff)
downloadopie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2
update qmake to 1.05a
Diffstat (limited to 'qmake/tools/qtextstream.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/tools/qtextstream.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qmake/tools/qtextstream.cpp b/qmake/tools/qtextstream.cpp
index 75c6531..ddca5bd 100644
--- a/qmake/tools/qtextstream.cpp
+++ b/qmake/tools/qtextstream.cpp
@@ -580,1025 +580,1025 @@ QTextStream::QTextStream( QString& str, int filemode )
buf.close();
\endcode
*/
QTextStream::QTextStream( QByteArray a, int mode )
{
init();
dev = new QBuffer( a );
((QBuffer *)dev)->open( mode );
owndev = TRUE;
setEncoding( Latin1 ); //### Locale???
reset();
d->sourceType = QTextStreamPrivate::ByteArray;
}
/*!
Constructs a text stream that operates on an existing file handle
\a fh through an internal QFile device. The \a mode argument is
passed to the device's open() function; see \l{QIODevice::mode()}.
Note that if you create a QTextStream \c cout or another name that
is also used for another variable of a different type, some
linkers may confuse the two variables, which will often cause
crashes.
*/
QTextStream::QTextStream( FILE *fh, int mode )
{
init();
setEncoding( Locale ); //###
dev = new QFile;
((QFile *)dev)->open( mode, fh );
owndev = TRUE;
reset();
d->sourceType = QTextStreamPrivate::File;
}
/*!
Destroys the text stream.
The destructor does not affect the current IO device.
*/
QTextStream::~QTextStream()
{
if ( owndev )
delete dev;
delete d;
}
/*!
Positions the read pointer at the first non-whitespace character.
*/
void QTextStream::skipWhiteSpace()
{
ts_ungetc( eat_ws() );
}
/*!
Tries to read \a len characters from the stream and stores them in
\a buf. Returns the number of characters really read.
\warning There will no QEOF appended if the read reaches the end
of the file. EOF is reached when the return value does not equal
\a len.
*/
uint QTextStream::ts_getbuf( QChar* buf, uint len )
{
if( len < 1 )
return 0;
uint rnum=0; // the number of QChars really read
if ( d && d->ungetcBuf.length() ) {
while( rnum < len && rnum < d->ungetcBuf.length() ) {
*buf = d->ungetcBuf.constref( rnum );
buf++;
rnum++;
}
d->ungetcBuf = d->ungetcBuf.mid( rnum );
if ( rnum >= len )
return rnum;
}
// we use dev->ungetch() for one of the bytes of the unicode
// byte-order mark, but a local unget hack for the other byte:
int ungetHack = EOF;
if ( doUnicodeHeader ) {
doUnicodeHeader = FALSE; // only at the top
int c1 = dev->getch();
if ( c1 == EOF )
return rnum;
int c2 = dev->getch();
if ( c1 == 0xfe && c2 == 0xff ) {
mapper = 0;
latin1 = FALSE;
internalOrder = QChar::networkOrdered();
networkOrder = TRUE;
} else if ( c1 == 0xff && c2 == 0xfe ) {
mapper = 0;
latin1 = FALSE;
internalOrder = !QChar::networkOrdered();
networkOrder = FALSE;
} else {
if ( c2 != EOF ) {
dev->ungetch( c2 );
ungetHack = c1;
} else {
/*
A small bug might hide here. If only the first byte
of a file has made it so far, and that first byte
is half of the byte-order mark, then the utfness
will not be detected.
*/
dev->ungetch( c1 );
}
}
}
#ifndef QT_NO_TEXTCODEC
if ( mapper ) {
bool shortRead = FALSE;
if ( !d->decoder )
d->decoder = mapper->makeDecoder();
while( rnum < len ) {
QString s;
bool readBlock = !( len == 1+rnum );
for (;;) {
// for efficiency: normally read a whole block
if ( readBlock ) {
// guess buffersize; this may be wrong (too small or too
// big). But we can handle this (either iterate reading
// or use ungetcBuf).
// Note that this might cause problems for codecs where
// one byte can result in >1 Unicode Characters if bytes
// are written to the stream in the meantime (loss of
// synchronicity).
uint rlen = len - rnum;
char *cbuf = new char[ rlen ];
if ( ungetHack != EOF ) {
rlen = 1+dev->readBlock( cbuf+1, rlen-1 );
cbuf[0] = (char)ungetHack;
ungetHack = EOF;
} else {
rlen = dev->readBlock( cbuf, rlen );
}
s += d->decoder->toUnicode( cbuf, rlen );
delete[] cbuf;
// use buffered reading only for the first time, because we
// have to get the stream synchronous again (this is easier
// with single character reading)
readBlock = FALSE;
}
// get stream (and codec) in sync
int c;
if ( ungetHack == EOF ) {
c = dev->getch();
} else {
c = ungetHack;
ungetHack = EOF;
}
if ( c == EOF ) {
shortRead = TRUE;
break;
}
char b = c;
uint lengthBefore = s.length();
s += d->decoder->toUnicode( &b, 1 );
if ( s.length() > lengthBefore )
break; // it seems we are in sync now
}
uint i = 0;
uint end = QMIN( len-rnum, s.length() );
while( i < end ) {
*buf = s.constref(i++);
buf++;
}
rnum += end;
if ( s.length() > i )
// could be = but append is clearer
d->ungetcBuf.append( s.mid( i ) );
if ( shortRead )
return rnum;
}
} else
#endif
if ( latin1 ) {
if ( len == 1+rnum ) {
// use this method for one character because it is more efficient
// (arnt doubts whether it makes a difference, but lets it stand)
int c = (ungetHack == EOF) ? dev->getch() : ungetHack;
if ( c != EOF ) {
*buf = (char)c;
buf++;
rnum++;
}
} else {
if ( ungetHack != EOF ) {
*buf = (char)ungetHack;
buf++;
rnum++;
ungetHack = EOF;
}
char *cbuf = new char[len - rnum];
while ( !dev->atEnd() && rnum < len ) {
uint rlen = len - rnum;
rlen = dev->readBlock( cbuf, rlen );
char *it = cbuf;
char *end = cbuf + rlen;
while ( it < end ) {
*buf = *it;
buf++;
it++;
}
rnum += rlen;
}
delete[] cbuf;
}
} else { // UCS-2 or UTF-16
if ( len == 1+rnum ) {
int c1 = (ungetHack == EOF) ? dev->getch() : ungetHack;
if ( c1 == EOF )
return rnum;
int c2 = dev->getch();
if ( c2 == EOF )
return rnum;
if ( networkOrder ) {
*buf = QChar( c2, c1 );
} else {
*buf = QChar( c1, c2 );
}
buf++;
rnum++;
} else {
char *cbuf = new char[ 2*( len - rnum ) ]; // for paranoids: overflow possible
while ( !dev->atEnd() && rnum < len ) {
uint rlen = 2 * ( len-rnum );
if ( ungetHack != EOF ) {
rlen = 1+dev->readBlock( cbuf+1, rlen-1 );
cbuf[0] = (char)ungetHack;
ungetHack = EOF;
} else {
rlen = dev->readBlock( cbuf, rlen );
}
// We can't use an odd number of bytes, so put it back. But
// do it only if we are capable of reading more -- normally
// there should not be an odd number, but the file might be
// truncated or not in UTF-16...
if ( (rlen & 1) == 1 )
if ( !dev->atEnd() )
dev->ungetch( cbuf[--rlen] );
uint i = 0;
if ( networkOrder ) {
while( i < rlen ) {
*buf = QChar( cbuf[i+1], cbuf[i] );
buf++;
i+=2;
}
} else {
while( i < rlen ) {
*buf = QChar( cbuf[i], cbuf[i+1] );
buf++;
i+=2;
}
}
rnum += i/2;
}
delete[] cbuf;
}
}
return rnum;
}
/*!
Tries to read one line, but at most len characters from the stream
and stores them in \a buf.
Returns the number of characters really read. Newlines are not
stripped.
There will be a QEOF appended if the read reaches the end of file;
this is different to ts_getbuf().
This function works only if a newline (as byte) is also a newline
(as resulting character) since it uses QIODevice::readLine(). So
use it only for such codecs where this is true!
This function is (almost) a no-op for UTF 16. Don't use it if
doUnicodeHeader is TRUE!
*/
uint QTextStream::ts_getline( QChar* buf )
{
uint rnum=0; // the number of QChars really read
char cbuf[ getline_buf_size+1 ];
if ( d && d->ungetcBuf.length() ) {
while( rnum < getline_buf_size && rnum < d->ungetcBuf.length() ) {
buf[rnum] = d->ungetcBuf.constref(rnum);
rnum++;
}
d->ungetcBuf = d->ungetcBuf.mid( rnum );
if ( rnum >= getline_buf_size )
return rnum;
}
#ifndef QT_NO_TEXTCODEC
if ( mapper ) {
if ( !d->decoder )
d->decoder = mapper->makeDecoder();
QString s;
bool readBlock = TRUE;
for (;;) {
// for efficiency: try to read a line
if ( readBlock ) {
int rlen = getline_buf_size - rnum;
rlen = dev->readLine( cbuf, rlen+1 );
if ( rlen == -1 )
rlen = 0;
s += d->decoder->toUnicode( cbuf, rlen );
readBlock = FALSE;
}
if ( dev->atEnd()
|| s.at( s.length()-1 ) == '\n'
|| s.at( s.length()-1 ) == '\r'
) {
break;
} else {
// get stream (and codec) in sync
int c;
c = dev->getch();
if ( c == EOF ) {
break;
}
char b = c;
uint lengthBefore = s.length();
s += d->decoder->toUnicode( &b, 1 );
if ( s.length() > lengthBefore )
break; // it seems we are in sync now
}
}
uint i = 0;
while( rnum < getline_buf_size && i < s.length() )
buf[rnum++] = s.constref(i++);
if ( s.length() > i )
// could be = but append is clearer
d->ungetcBuf.append( s.mid( i ) );
if ( rnum < getline_buf_size && dev->atEnd() )
buf[rnum++] = QEOF;
} else
#endif
if ( latin1 ) {
int rlen = getline_buf_size - rnum;
rlen = dev->readLine( cbuf, rlen+1 );
if ( rlen == -1 )
rlen = 0;
char *end = cbuf+rlen;
char *it = cbuf;
buf +=rnum;
while ( it != end ) {
buf->setCell( *(it++) );
buf->setRow( 0 );
buf++;
}
rnum += rlen;
if ( rnum < getline_buf_size && dev->atEnd() )
buf[1] = QEOF;
}
return rnum;
}
/*!
Puts one character into the stream.
*/
void QTextStream::ts_putc( QChar c )
{
#ifndef QT_NO_TEXTCODEC
if ( mapper ) {
if ( !d->encoder )
d->encoder = mapper->makeEncoder();
int len = 1;
QString s = c;
QCString block = d->encoder->fromUnicode( s, len );
dev->writeBlock( block, len );
} else
#endif
if ( latin1 ) {
if ( c.row() )
dev->putch( '?' ); // unknown character
else
dev->putch( c.cell() );
} else {
if ( doUnicodeHeader ) {
doUnicodeHeader = FALSE;
ts_putc( QChar::byteOrderMark );
}
if ( internalOrder ) {
// this case is needed by QStringBuffer
dev->writeBlock( (char*)&c, sizeof(QChar) );
} else if ( networkOrder ) {
dev->putch( c.row() );
dev->putch( c.cell() );
} else {
dev->putch( c.cell() );
dev->putch( c.row() );
}
}
}
/*!
Puts one character into the stream.
*/
void QTextStream::ts_putc( int ch )
{
ts_putc( QChar((ushort)ch) );
}
bool QTextStream::ts_isdigit( QChar c )
{
return c.isDigit();
}
bool QTextStream::ts_isspace( QChar c )
{
return c.isSpace();
}
void QTextStream::ts_ungetc( QChar c )
{
if ( c.unicode() == 0xffff )
return;
d->ungetcBuf.prepend( c );
}
/*!
Reads \a len bytes from the stream into \a s and returns a
reference to the stream.
The buffer \a s must be preallocated.
Note that no encoding is done by this function.
\warning The behavior of this function is undefined unless the
stream's encoding is set to Unicode or Latin1.
\sa QIODevice::readBlock()
*/
QTextStream &QTextStream::readRawBytes( char *s, uint len )
{
dev->readBlock( s, len );
return *this;
}
/*!
Writes the \a len bytes from \a s to the stream and returns a
reference to the stream.
Note that no encoding is done by this function.
\sa QIODevice::writeBlock()
*/
QTextStream &QTextStream::writeRawBytes( const char* s, uint len )
{
dev->writeBlock( s, len );
return *this;
}
QTextStream &QTextStream::writeBlock( const char* p, uint len )
{
if ( doUnicodeHeader ) {
doUnicodeHeader = FALSE;
if ( !mapper && !latin1 )
ts_putc( QChar::byteOrderMark );
}
// QCString and const char * are treated as Latin-1
if ( !mapper && latin1 ) {
dev->writeBlock( p, len );
} else if ( !mapper && internalOrder ) {
QChar *u = new QChar[len];
for ( uint i = 0; i < len; i++ )
u[i] = p[i];
dev->writeBlock( (char*)u, len * sizeof(QChar) );
delete [] u;
} else {
for ( uint i = 0; i < len; i++ )
ts_putc( (uchar)p[i] );
}
return *this;
}
QTextStream &QTextStream::writeBlock( const QChar* p, uint len )
{
#ifndef QT_NO_TEXTCODEC
if ( mapper ) {
if ( !d->encoder )
d->encoder = mapper->makeEncoder();
QConstString s( p, len );
int l = len;
QCString block = d->encoder->fromUnicode( s.string(), l );
dev->writeBlock( block, l );
} else
#endif
if ( latin1 ) {
- char *str = QString::unicodeToAscii( p, len );
+ char *str = QString::unicodeToLatin1( p, len );
dev->writeBlock( str, len );
delete [] str;
} else if ( internalOrder ) {
if ( doUnicodeHeader ) {
doUnicodeHeader = FALSE;
ts_putc( QChar::byteOrderMark );
}
dev->writeBlock( (char*)p, sizeof(QChar)*len );
} else {
for (uint i=0; i<len; i++)
ts_putc( p[i] );
}
return *this;
}
/*!
Resets the text stream.
\list
\i All flags are set to 0.
\i The field width is set to 0.
\i The fill character is set to ' ' (Space).
\i The precision is set to 6.
\endlist
\sa setf(), width(), fill(), precision()
*/
void QTextStream::reset()
{
fflags = 0;
fwidth = 0;
fillchar = ' ';
fprec = 6;
}
/*!
\fn QIODevice *QTextStream::device() const
Returns the IO device currently set.
\sa setDevice(), unsetDevice()
*/
/*!
Sets the IO device to \a iod.
\sa device(), unsetDevice()
*/
void QTextStream::setDevice( QIODevice *iod )
{
if ( owndev ) {
delete dev;
owndev = FALSE;
}
dev = iod;
d->sourceType = QTextStreamPrivate::IODevice;
}
/*!
Unsets the IO device. Equivalent to setDevice( 0 ).
\sa device(), setDevice()
*/
void QTextStream::unsetDevice()
{
setDevice( 0 );
d->sourceType = QTextStreamPrivate::NotSet;
}
/*!
\fn bool QTextStream::atEnd() const
Returns TRUE if the IO device has reached the end position (end of
the stream or file) or if there is no IO device set; otherwise
returns FALSE.
\sa QIODevice::atEnd()
*/
/*!\fn bool QTextStream::eof() const
\obsolete
This function has been renamed to atEnd().
\sa QIODevice::atEnd()
*/
/*****************************************************************************
QTextStream read functions
*****************************************************************************/
/*!
\overload
Reads a char \a c from the stream and returns a reference to the
stream. Note that whitespace is skipped.
*/
QTextStream &QTextStream::operator>>( char &c )
{
CHECK_STREAM_PRECOND
c = eat_ws();
return *this;
}
/*!
Reads a char \a c from the stream and returns a reference to the
stream. Note that whitespace is \e not skipped.
*/
QTextStream &QTextStream::operator>>( QChar &c )
{
CHECK_STREAM_PRECOND
c = ts_getc();
return *this;
}
ulong QTextStream::input_bin()
{
ulong val = 0;
QChar ch = eat_ws();
int dv = ch.digitValue();
while ( dv == 0 || dv == 1 ) {
val = ( val << 1 ) + dv;
ch = ts_getc();
dv = ch.digitValue();
}
if ( ch != QEOF )
ts_ungetc( ch );
return val;
}
ulong QTextStream::input_oct()
{
ulong val = 0;
QChar ch = eat_ws();
int dv = ch.digitValue();
while ( dv >= 0 && dv <= 7 ) {
val = ( val << 3 ) + dv;
ch = ts_getc();
dv = ch.digitValue();
}
if ( dv == 8 || dv == 9 ) {
while ( ts_isdigit(ch) )
ch = ts_getc();
}
if ( ch != QEOF )
ts_ungetc( ch );
return val;
}
ulong QTextStream::input_dec()
{
ulong val = 0;
QChar ch = eat_ws();
int dv = ch.digitValue();
while ( ts_isdigit(ch) ) {
val = val * 10 + dv;
ch = ts_getc();
dv = ch.digitValue();
}
if ( ch != QEOF )
ts_ungetc( ch );
return val;
}
ulong QTextStream::input_hex()
{
ulong val = 0;
QChar ch = eat_ws();
char c = ch;
while ( isxdigit((uchar) c) ) {
val <<= 4;
if ( ts_isdigit(c) )
val += c - '0';
else
val += 10 + tolower( (uchar) c ) - 'a';
c = ch = ts_getc();
}
if ( ch != QEOF )
ts_ungetc( ch );
return val;
}
long QTextStream::input_int()
{
long val;
QChar ch;
char c;
switch ( flags() & basefield ) {
case bin:
val = (long)input_bin();
break;
case oct:
val = (long)input_oct();
break;
case dec:
c = ch = eat_ws();
if ( ch == QEOF ) {
val = 0;
} else {
if ( !(c == '-' || c == '+') )
ts_ungetc( ch );
if ( c == '-' ) {
ulong v = input_dec();
if ( v ) { // ensure that LONG_MIN can be read
v--;
val = -((long)v) - 1;
} else {
val = 0;
}
} else {
val = (long)input_dec();
}
}
break;
case hex:
val = (long)input_hex();
break;
default:
val = 0;
c = ch = eat_ws();
if ( c == '0' ) { // bin, oct or hex
c = ch = ts_getc();
if ( tolower((uchar) c) == 'x' )
val = (long)input_hex();
else if ( tolower((uchar) c) == 'b' )
val = (long)input_bin();
else { // octal
ts_ungetc( ch );
if ( c >= '0' && c <= '7' ) {
val = (long)input_oct();
} else {
val = 0;
}
}
} else if ( ts_isdigit(ch) ) {
ts_ungetc( ch );
val = (long)input_dec();
} else if ( c == '-' || c == '+' ) {
ulong v = input_dec();
if ( c == '-' ) {
if ( v ) { // ensure that LONG_MIN can be read
v--;
val = -((long)v) - 1;
} else {
val = 0;
}
} else {
val = (long)v;
}
}
}
return val;
}
//
// We use a table-driven FSM to parse floating point numbers
// strtod() cannot be used directly since we're reading from a QIODevice
//
double QTextStream::input_double()
{
const int Init = 0; // states
const int Sign = 1;
const int Mantissa = 2;
const int Dot = 3;
const int Abscissa = 4;
const int ExpMark = 5;
const int ExpSign = 6;
const int Exponent = 7;
const int Done = 8;
const int InputSign = 1; // input tokens
const int InputDigit = 2;
const int InputDot = 3;
const int InputExp = 4;
static const uchar table[8][5] = {
/* None InputSign InputDigit InputDot InputExp */
{ 0, Sign, Mantissa, Dot, 0, }, // Init
{ 0, 0, Mantissa, Dot, 0, }, // Sign
{ Done, Done, Mantissa, Dot, ExpMark,}, // Mantissa
{ 0, 0, Abscissa, 0, 0, }, // Dot
{ Done, Done, Abscissa, Done, ExpMark,}, // Abscissa
{ 0, ExpSign, Exponent, 0, 0, }, // ExpMark
{ 0, 0, Exponent, 0, 0, }, // ExpSign
{ Done, Done, Exponent, Done, Done } // Exponent
};
int state = Init; // parse state
int input; // input token
char buf[256];
int i = 0;
QChar c = eat_ws();
for (;;) {
switch ( c ) {
case '+':
case '-':
input = InputSign;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
input = InputDigit;
break;
case '.':
input = InputDot;
break;
case 'e':
case 'E':
input = InputExp;
break;
default:
input = 0;
break;
}
state = table[state][input];
if ( state == 0 || state == Done || i > 250 ) {
if ( i > 250 ) { // ignore rest of digits
do { c = ts_getc(); } while ( c != QEOF && ts_isdigit(c) );
}
if ( c != QEOF )
ts_ungetc( c );
buf[i] = '\0';
char *end;
return strtod( buf, &end );
}
buf[i++] = c;
c = ts_getc();
}
#if !defined(Q_CC_EDG)
return 0.0;
#endif
}
/*!
\overload
Reads a signed \c short integer \a i from the stream and returns a
reference to the stream. See flags() for an explanation of the
expected input format.
*/
QTextStream &QTextStream::operator>>( signed short &i )
{
CHECK_STREAM_PRECOND
i = (signed short)input_int();
return *this;
}
/*!
\overload
Reads an unsigned \c short integer \a i from the stream and
returns a reference to the stream. See flags() for an explanation
of the expected input format.
*/
QTextStream &QTextStream::operator>>( unsigned short &i )
{
CHECK_STREAM_PRECOND
i = (unsigned short)input_int();
return *this;
}
/*!
\overload
Reads a signed \c int \a i from the stream and returns a reference
to the stream. See flags() for an explanation of the expected
input format.
*/
QTextStream &QTextStream::operator>>( signed int &i )
{
CHECK_STREAM_PRECOND
i = (signed int)input_int();
return *this;
}
/*!
\overload
Reads an unsigned \c int \a i from the stream and returns a
reference to the stream. See flags() for an explanation of the
expected input format.
*/
QTextStream &QTextStream::operator>>( unsigned int &i )
{
CHECK_STREAM_PRECOND
i = (unsigned int)input_int();
return *this;
}
/*!
\overload
Reads a signed \c long int \a i from the stream and returns a
reference to the stream. See flags() for an explanation of the
expected input format.
*/
QTextStream &QTextStream::operator>>( signed long &i )
{
CHECK_STREAM_PRECOND
i = (signed long)input_int();
return *this;
}
/*!
\overload
Reads an unsigned \c long int \a i from the stream and returns a
reference to the stream. See flags() for an explanation of the
expected input format.
*/
QTextStream &QTextStream::operator>>( unsigned long &i )
{
CHECK_STREAM_PRECOND
i = (unsigned long)input_int();
return *this;
}
/*!
\overload
Reads a \c float \a f from the stream and returns a reference to
the stream. See flags() for an explanation of the expected input
format.
*/
QTextStream &QTextStream::operator>>( float &f )
{
CHECK_STREAM_PRECOND
f = (float)input_double();
return *this;
}
/*!
\overload
Reads a \c double \a f from the stream and returns a reference to
the stream. See flags() for an explanation of the expected input
format.
*/
QTextStream &QTextStream::operator>>( double &f )
{
CHECK_STREAM_PRECOND
f = input_double();
return *this;
}
/*!
\overload
Reads a "word" from the stream into \a s and returns a reference
to the stream.
A word consists of characters for which isspace() returns FALSE.
*/
QTextStream &QTextStream::operator>>( char *s )
{
CHECK_STREAM_PRECOND
int maxlen = width( 0 );
QChar c = eat_ws();
if ( !maxlen )
maxlen = -1;
while ( c != QEOF ) {
if ( ts_isspace(c) || maxlen-- == 0 ) {
ts_ungetc( c );
break;
}
*s++ = c;
c = ts_getc();
}
*s = '\0';
return *this;
}
/*!
\overload
Reads a "word" from the stream into \a str and returns a reference
to the stream.