summaryrefslogtreecommitdiffstats
path: root/src/tools/tqtextstream.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-12-22 12:05:18 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-12-22 12:13:05 +0900
commita4ebd73f48610ed351c9c53f3646d0597f8ea7bc (patch)
tree2edd219eef4cb8f35bb3844d06902ae8b2fcb565 /src/tools/tqtextstream.cpp
parent7d612f7c91d55501276a385a30dbadb121e7bd9f (diff)
downloadtqt-rename/true-false-9.tar.gz
tqt-rename/true-false-9.zip
Replace TRUE/FALSE with boolean values true/false - part 9rename/true-false-9
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/tools/tqtextstream.cpp')
-rw-r--r--src/tools/tqtextstream.cpp140
1 files changed, 70 insertions, 70 deletions
diff --git a/src/tools/tqtextstream.cpp b/src/tools/tqtextstream.cpp
index 20f6301e9..5fe14e28b 100644
--- a/src/tools/tqtextstream.cpp
+++ b/src/tools/tqtextstream.cpp
@@ -105,7 +105,7 @@
The TQIODevice is set in the constructor, or later using
setDevice(). If the end of the input is reached atEnd() returns
- TRUE. Data can be read into variables of the appropriate type
+ true. Data can be read into variables of the appropriate type
using the operator>>() overloads, or read in its entirety into a
single string using read(), or read a line at a time using
readLine(). Whitespace can be skipped over using skipWhiteSpace().
@@ -254,13 +254,13 @@ void TQTextStream::init()
{
// ### ungetcBuf = TQEOF;
dev = 0;
- owndev = FALSE;
+ owndev = false;
mapper = 0;
d = new TQTextStreamPrivate;
- doUnicodeHeader = TRUE; // autodetect
- latin1 = TRUE; // should use locale?
+ doUnicodeHeader = true; // autodetect
+ latin1 = true; // should use locale?
internalOrder = TQChar::networkOrdered();
- networkOrder = TRUE;
+ networkOrder = true;
}
/*!
@@ -330,13 +330,13 @@ bool TQStringBuffer::open( int m )
#if defined(QT_CHECK_STATE)
tqWarning( "TQStringBuffer::open: No string" );
#endif
- return FALSE;
+ return false;
}
if ( isOpen() ) {
#if defined(QT_CHECK_STATE)
tqWarning( "TQStringBuffer::open: Buffer already open" );
#endif
- return FALSE;
+ return false;
}
setMode( m );
if ( m & IO_Truncate )
@@ -349,7 +349,7 @@ bool TQStringBuffer::open( int m )
}
setState( IO_Open );
resetStatus();
- return TRUE;
+ return true;
}
void TQStringBuffer::close()
@@ -379,17 +379,17 @@ bool TQStringBuffer::at( Offset pos )
#if defined(QT_CHECK_STATE)
if ( !isOpen() ) {
tqWarning( "TQStringBuffer::at: Buffer is not open" );
- return FALSE;
+ return false;
}
#endif
if ( pos >= s->length()*2 ) {
#if defined(QT_CHECK_RANGE)
tqWarning( "TQStringBuffer::at: Index %lu out of range", pos );
#endif
- return FALSE;
+ return false;
}
ioIndex = pos;
- return TRUE;
+ return true;
}
@@ -534,7 +534,7 @@ TQTextStream::TQTextStream( TQString* str, int filemode )
init();
dev = new TQStringBuffer( str );
((TQStringBuffer *)dev)->open( filemode );
- owndev = TRUE;
+ owndev = true;
setEncoding(RawUnicode);
reset();
d->sourceType = TQTextStreamPrivate::String;
@@ -551,7 +551,7 @@ TQTextStream::TQTextStream( TQString& str, int filemode )
init();
dev = new TQStringBuffer( &str );
((TQStringBuffer *)dev)->open( filemode );
- owndev = TRUE;
+ owndev = true;
setEncoding(RawUnicode);
reset();
d->sourceType = TQTextStreamPrivate::String;
@@ -589,7 +589,7 @@ TQTextStream::TQTextStream( TQByteArray a, int mode )
init();
dev = new TQBuffer( a );
((TQBuffer *)dev)->open( mode );
- owndev = TRUE;
+ owndev = true;
setEncoding( Latin1 ); //### Locale???
reset();
d->sourceType = TQTextStreamPrivate::ByteArray;
@@ -612,7 +612,7 @@ TQTextStream::TQTextStream( FILE *fh, int mode )
setEncoding( Locale ); //###
dev = new TQFile;
((TQFile *)dev)->open( mode, fh );
- owndev = TRUE;
+ owndev = true;
reset();
d->sourceType = TQTextStreamPrivate::File;
}
@@ -670,21 +670,21 @@ uint TQTextStream::ts_getbuf( TQChar* buf, uint len )
int ungetHack = EOF;
if ( doUnicodeHeader ) {
- doUnicodeHeader = FALSE; // only at the top
+ 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;
+ latin1 = false;
internalOrder = TQChar::networkOrdered();
- networkOrder = TRUE;
+ networkOrder = true;
} else if ( c1 == 0xff && c2 == 0xfe ) {
mapper = 0;
- latin1 = FALSE;
+ latin1 = false;
internalOrder = !TQChar::networkOrdered();
- networkOrder = FALSE;
+ networkOrder = false;
} else {
if ( c2 != EOF ) {
dev->ungetch( c2 );
@@ -703,7 +703,7 @@ uint TQTextStream::ts_getbuf( TQChar* buf, uint len )
#ifndef TQT_NO_TEXTCODEC
if ( mapper ) {
- bool shortRead = FALSE;
+ bool shortRead = false;
if ( !d->decoder )
d->decoder = mapper->makeDecoder();
while( rnum < len ) {
@@ -733,7 +733,7 @@ uint TQTextStream::ts_getbuf( TQChar* buf, uint len )
// 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;
+ readBlock = false;
}
// get stream (and codec) in sync
int c;
@@ -744,7 +744,7 @@ uint TQTextStream::ts_getbuf( TQChar* buf, uint len )
ungetHack = EOF;
}
if ( c == EOF ) {
- shortRead = TRUE;
+ shortRead = true;
break;
}
char b = c;
@@ -872,7 +872,7 @@ uint TQTextStream::ts_getbuf( TQChar* buf, uint len )
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!
+ doUnicodeHeader is true!
*/
uint TQTextStream::ts_getline( TQChar* buf )
{
@@ -894,7 +894,7 @@ uint TQTextStream::ts_getline( TQChar* buf )
if ( !d->decoder )
d->decoder = mapper->makeDecoder();
TQString s;
- bool readBlock = TRUE;
+ bool readBlock = true;
for (;;) {
// for efficiency: try to read a line
if ( readBlock ) {
@@ -903,7 +903,7 @@ uint TQTextStream::ts_getline( TQChar* buf )
if ( rlen == -1 )
rlen = 0;
s += d->decoder->toUnicode( cbuf, rlen );
- readBlock = FALSE;
+ readBlock = false;
}
if ( dev->atEnd()
|| s.at( s.length()-1 ) == '\n'
@@ -977,7 +977,7 @@ void TQTextStream::ts_putc( TQChar c )
dev->putch( c.cell() );
} else {
if ( doUnicodeHeader ) {
- doUnicodeHeader = FALSE;
+ doUnicodeHeader = false;
ts_putc( TQChar::byteOrderMark );
}
if ( internalOrder ) {
@@ -1060,7 +1060,7 @@ TQTextStream &TQTextStream::writeRawBytes( const char* s, uint len )
TQTextStream &TQTextStream::writeBlock( const char* p, uint len )
{
if ( doUnicodeHeader ) {
- doUnicodeHeader = FALSE;
+ doUnicodeHeader = false;
if ( !mapper && !latin1 )
ts_putc( TQChar::byteOrderMark );
}
@@ -1109,7 +1109,7 @@ TQTextStream &TQTextStream::writeBlock( const TQChar* p, uint len )
delete [] str;
} else if ( internalOrder ) {
if ( doUnicodeHeader ) {
- doUnicodeHeader = FALSE;
+ doUnicodeHeader = false;
ts_putc( TQChar::byteOrderMark );
}
dev->writeBlock( (char*)p, sizeof(TQChar)*len );
@@ -1159,7 +1159,7 @@ void TQTextStream::setDevice( TQIODevice *iod )
{
if ( owndev ) {
delete dev;
- owndev = FALSE;
+ owndev = false;
}
dev = iod;
d->sourceType = TQTextStreamPrivate::IODevice;
@@ -1180,9 +1180,9 @@ void TQTextStream::unsetDevice()
/*!
\fn bool TQTextStream::atEnd() const
- Returns TRUE if the IO device has reached the end position (end of
+ 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.
+ returns false.
\sa TQIODevice::atEnd()
*/
@@ -1588,7 +1588,7 @@ TQTextStream &TQTextStream::operator>>( double &f )
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.
+ A word consists of characters for which isspace() returns false.
*/
TQTextStream &TQTextStream::operator>>( char *s )
@@ -1617,7 +1617,7 @@ TQTextStream &TQTextStream::operator>>( char *s )
Reads a "word" from the stream into \a str and returns a reference
to the stream.
- A word consists of characters for which isspace() returns FALSE.
+ A word consists of characters for which isspace() returns false.
*/
TQTextStream &TQTextStream::operator>>( TQString &str )
@@ -1643,7 +1643,7 @@ TQTextStream &TQTextStream::operator>>( TQString &str )
Reads a "word" from the stream into \a str and returns a reference
to the stream.
- A word consists of characters for which isspace() returns FALSE.
+ A word consists of characters for which isspace() returns false.
*/
TQTextStream &TQTextStream::operator>>( TQCString &str )
@@ -1703,24 +1703,24 @@ TQString TQTextStream::readLine()
return TQString::null;
}
#endif
- bool readCharByChar = TRUE;
+ bool readCharByChar = true;
TQString result;
#if 0
if ( !doUnicodeHeader && (
(latin1) ||
(mapper != 0 && mapper->mibEnum() == 106 ) // UTF 8
) ) {
- readCharByChar = FALSE;
+ readCharByChar = false;
// use optimized read line
TQChar c[getline_buf_size];
int pos = 0;
- bool eof = FALSE;
+ bool eof = false;
for (;;) {
pos = ts_getline( c );
if ( pos == 0 ) {
// something went wrong; try fallback
- readCharByChar = TRUE;
+ readCharByChar = true;
//dev->resetStatus();
break;
}
@@ -1731,7 +1731,7 @@ TQString TQTextStream::readLine()
result += TQString( c, pos-1 );
}
if ( pos == 1 && c[pos-1] == TQEOF )
- eof = TRUE;
+ eof = true;
break;
} else {
result += TQString( c, pos );
@@ -1790,7 +1790,7 @@ TQString TQTextStream::read()
const uint bufsize = 512;
TQChar buf[bufsize];
uint i, num, start;
- bool skipped_cr = FALSE;
+ bool skipped_cr = false;
for (;;) {
num = ts_getbuf(buf,bufsize);
@@ -1805,7 +1805,7 @@ TQString TQTextStream::read()
} else {
result += TQString( &buf[start], i-start );
start = i+1;
- skipped_cr = TRUE;
+ skipped_cr = true;
}
} else {
if ( skipped_cr ) {
@@ -1813,7 +1813,7 @@ TQString TQTextStream::read()
// Should not have skipped it
result += '\n';
}
- skipped_cr = FALSE;
+ skipped_cr = false;
}
}
}
@@ -1984,7 +1984,7 @@ TQTextStream &TQTextStream::operator<<( signed short i )
TQTextStream &TQTextStream::operator<<( unsigned short i )
{
- return output_int( I_SHORT | I_UNSIGNED, i, FALSE );
+ return output_int( I_SHORT | I_UNSIGNED, i, false );
}
@@ -2010,7 +2010,7 @@ TQTextStream &TQTextStream::operator<<( signed int i )
TQTextStream &TQTextStream::operator<<( unsigned int i )
{
- return output_int( I_INT | I_UNSIGNED, i, FALSE );
+ return output_int( I_INT | I_UNSIGNED, i, false );
}
@@ -2036,7 +2036,7 @@ TQTextStream &TQTextStream::operator<<( signed long i )
TQTextStream &TQTextStream::operator<<( unsigned long i )
{
- return output_int( I_LONG | I_UNSIGNED, i, FALSE );
+ return output_int( I_LONG | I_UNSIGNED, i, false );
}
/*!
@@ -2061,7 +2061,7 @@ TQTextStream &TQTextStream::operator<<( signed long long i )
TQTextStream &TQTextStream::operator<<( unsigned long long i )
{
- return output_int( I_LONGLONG | I_UNSIGNED, i, FALSE );
+ return output_int( I_LONGLONG | I_UNSIGNED, i, false );
}
@@ -2217,7 +2217,7 @@ TQTextStream &TQTextStream::operator<<( void *ptr )
setf( hex, basefield );
setf( showbase );
unsetf( uppercase );
- output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE );
+ output_int( I_LONG | I_UNSIGNED, (ulong)ptr, false );
flags( f );
return *this;
}
@@ -2523,47 +2523,47 @@ void TQTextStream::setEncoding( Encoding e )
switch ( e ) {
case Unicode:
mapper = 0;
- latin1 = FALSE;
- doUnicodeHeader = TRUE;
- internalOrder = TRUE;
+ latin1 = false;
+ doUnicodeHeader = true;
+ internalOrder = true;
networkOrder = TQChar::networkOrdered();
break;
case UnicodeUTF8:
#ifndef TQT_NO_TEXTCODEC
mapper = TQTextCodec::codecForMib( 106 );
- latin1 = FALSE;
- doUnicodeHeader = TRUE;
- internalOrder = TRUE;
+ latin1 = false;
+ doUnicodeHeader = true;
+ internalOrder = true;
networkOrder = TQChar::networkOrdered();
#else
mapper = 0;
- latin1 = TRUE;
- doUnicodeHeader = TRUE;
+ latin1 = true;
+ doUnicodeHeader = true;
#endif
break;
case UnicodeNetworkOrder:
mapper = 0;
- latin1 = FALSE;
- doUnicodeHeader = TRUE;
+ latin1 = false;
+ doUnicodeHeader = true;
internalOrder = TQChar::networkOrdered();
- networkOrder = TRUE;
+ networkOrder = true;
break;
case UnicodeReverse:
mapper = 0;
- latin1 = FALSE;
- doUnicodeHeader = TRUE;
+ latin1 = false;
+ doUnicodeHeader = true;
internalOrder = !TQChar::networkOrdered();
- networkOrder = FALSE;
+ networkOrder = false;
break;
case RawUnicode:
mapper = 0;
- latin1 = FALSE;
- doUnicodeHeader = FALSE;
- internalOrder = TRUE;
+ latin1 = false;
+ doUnicodeHeader = false;
+ internalOrder = true;
networkOrder = TQChar::networkOrdered();
break;
case Locale:
- latin1 = TRUE; // fallback to Latin-1
+ latin1 = true; // fallback to Latin-1
#ifndef TQT_NO_TEXTCODEC
mapper = TQTextCodec::codecForLocale();
// optimized Latin-1 processing
@@ -2575,12 +2575,12 @@ void TQTextStream::setEncoding( Encoding e )
#endif
mapper = 0;
- doUnicodeHeader = TRUE; // If it reads as Unicode, accept it
+ doUnicodeHeader = true; // If it reads as Unicode, accept it
break;
case Latin1:
mapper = 0;
- doUnicodeHeader = FALSE;
- latin1 = TRUE;
+ doUnicodeHeader = false;
+ latin1 = true;
break;
}
}
@@ -2605,7 +2605,7 @@ void TQTextStream::setCodec( TQTextCodec *codec )
latin1 = ( codec->mibEnum() == 4 );
if ( latin1 )
mapper = 0;
- doUnicodeHeader = FALSE;
+ doUnicodeHeader = false;
}
/*!