diff options
Diffstat (limited to 'src/tools/tqcstring.cpp')
| -rw-r--r-- | src/tools/tqcstring.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/src/tools/tqcstring.cpp b/src/tools/tqcstring.cpp index 8c09d227c..be32595df 100644 --- a/src/tools/tqcstring.cpp +++ b/src/tools/tqcstring.cpp @@ -269,7 +269,7 @@ int tqstrnicmp( const char *str1, const char *str2, uint len ) static TQ_UINT16 crc_tbl[16]; -static bool crc_tbl_init = FALSE; +static bool crc_tbl_init = false; static void createCRC16Table() // build CRC16 lookup table { @@ -319,7 +319,7 @@ TQ_UINT16 tqChecksum( const char *data, uint len ) if ( !crc_tbl_init ) { createCRC16Table(); - crc_tbl_init = TRUE; + crc_tbl_init = true; } } TQ_UINT16 crc = 0xffff; @@ -762,17 +762,17 @@ TQCString::~TQCString() /*! \fn bool TQCString::isNull() const - Returns TRUE if the string is null, i.e. if data() == 0; otherwise - returns FALSE. A null string is also an empty string. + Returns true if the string is null, i.e. if data() == 0; otherwise + returns false. A null string is also an empty string. Example: \code TQCString a; // a.data() == 0, a.size() == 0, a.length() == 0 TQCString b == ""; // b.data() == "", b.size() == 1, b.length() == 0 - a.isNull(); // TRUE because a.data() == 0 - a.isEmpty(); // TRUE because a.length() == 0 - b.isNull(); // FALSE because b.data() == "" - b.isEmpty(); // TRUE because b.length() == 0 + a.isNull(); // true because a.data() == 0 + a.isEmpty(); // true because a.length() == 0 + b.isNull(); // false because b.data() == "" + b.isEmpty(); // true because b.length() == 0 \endcode \sa isEmpty(), length(), size() @@ -781,8 +781,8 @@ TQCString::~TQCString() /*! \fn bool TQCString::isEmpty() const - Returns TRUE if the string is empty, i.e. if length() == 0; - otherwise returns FALSE. An empty string is not always a null + Returns true if the string is empty, i.e. if length() == 0; + otherwise returns false. An empty string is not always a null string. See example in isNull(). @@ -838,12 +838,12 @@ bool TQCString::resize( uint len ) detach(); uint wasNull = isNull(); if ( !TQByteArray::resize(len) ) - return FALSE; + return false; if ( len ) data()[len - 1] = '\0'; if ( len > 0 && wasNull ) data()[0] = '\0'; - return TRUE; + return true; } @@ -899,8 +899,8 @@ TQCString &TQCString::sprintf( const char *format, ... ) If \a len is negative, then the current string length is used. - Returns FALSE is \a len is nonnegative and there is not enough - memory to resize the string; otherwise returns TRUE. + Returns false is \a len is nonnegative and there is not enough + memory to resize the string; otherwise returns true. */ bool TQCString::fill( char c, int len ) @@ -909,9 +909,9 @@ bool TQCString::fill( char c, int len ) if ( len < 0 ) len = length(); if ( !TQByteArray::fill(c,len+1) ) - return FALSE; + return false; *(data()+len) = '\0'; - return TRUE; + return true; } @@ -928,8 +928,8 @@ bool TQCString::fill( char c, int len ) Finds the first occurrence of the character \a c, starting at position \a index. - The search is case sensitive if \a cs is TRUE, or case insensitive - if \a cs is FALSE. + The search is case sensitive if \a cs is true, or case insensitive + if \a cs is false. Returns the position of \a c, or -1 if \a c could not be found. @@ -965,8 +965,8 @@ int TQCString::find( char c, int index, bool cs ) const Finds the first occurrence of the string \a str, starting at position \a index. - The search is case sensitive if \a cs is TRUE, or case insensitive - if \a cs is FALSE. + The search is case sensitive if \a cs is true, or case insensitive + if \a cs is false. Returns the position of \a str, or -1 if \a str could not be found. @@ -1046,8 +1046,8 @@ int TQCString::find( const char *str, int index, bool cs, uint l ) const Finds the first occurrence of the character \a c, starting at position \a index and searching backwards. - The search is case sensitive if \a cs is TRUE, or case insensitive - if \a cs is FALSE. + The search is case sensitive if \a cs is true, or case insensitive + if \a cs is false. Returns the position of \a c, or -1 if \a c could not be found. @@ -1080,8 +1080,8 @@ int TQCString::findRev( char c, int index, bool cs ) const Finds the first occurrence of the string \a str, starting at position \a index and searching backwards. - The search is case sensitive if \a cs is TRUE, or case insensitive - if \a cs is FALSE. + The search is case sensitive if \a cs is true, or case insensitive + if \a cs is false. Returns the position of \a str, or -1 if \a str could not be found. @@ -1150,8 +1150,8 @@ int TQCString::findRev( const char *str, int index, bool cs ) const Returns the number of times the character \a c occurs in the string. - The match is case sensitive if \a cs is TRUE, or case insensitive - if \a cs if FALSE. + The match is case sensitive if \a cs is true, or case insensitive + if \a cs if false. \sa \link #asciinotion Note on character comparisons \endlink */ @@ -1182,8 +1182,8 @@ int TQCString::contains( char c, bool cs ) const Returns the number of times \a str occurs in the string. - The match is case sensitive if \a cs is TRUE, or case insensitive - if \a cs if FALSE. + The match is case sensitive if \a cs is true, or case insensitive + if \a cs if false. This function counts overlapping substrings, for example, "banana" contains two occurrences of "ana". @@ -1303,9 +1303,9 @@ TQCString TQCString::mid( uint index, uint len ) const '\0') that contains this string padded with the \a fill character. If the length of the string exceeds \a width and \a truncate is - FALSE (the default), then the returned string is a copy of the + false (the default), then the returned string is a copy of the string. If the length of the string exceeds \a width and \a - truncate is TRUE, then the returned string is a left(\a width). + truncate is true, then the returned string is a left(\a width). Example: \code @@ -1341,9 +1341,9 @@ TQCString TQCString::leftJustify( uint width, char fill, bool truncate ) const by this string. If the length of the string exceeds \a width and \a truncate is - FALSE (the default), then the returned string is a copy of the + false (the default), then the returned string is a copy of the string. If the length of the string exceeds \a width and \a - truncate is TRUE, then the returned string is a left(\a width). + truncate is true, then the returned string is a left(\a width). Example: \code @@ -1693,7 +1693,7 @@ TQCString &TQCString::replace( const char *before, const char *after ) if ( bl == al ) { if ( bl ) { - while( (index = find( before, index, TRUE, len ) ) != -1 ) { + while( (index = find( before, index, true, len ) ) != -1 ) { memcpy( d+index, after, al ); index += bl; } @@ -1702,7 +1702,7 @@ TQCString &TQCString::replace( const char *before, const char *after ) uint to = 0; uint movestart = 0; uint num = 0; - while( (index = find( before, index, TRUE, len ) ) != -1 ) { + while( (index = find( before, index, true, len ) ) != -1 ) { if ( num ) { int msize = index - movestart; if ( msize > 0 ) { @@ -1733,7 +1733,7 @@ TQCString &TQCString::replace( const char *before, const char *after ) uint indices[4096]; uint pos = 0; while( pos < 4095 ) { - index = find(before, index, TRUE, len); + index = find(before, index, true, len); if ( index == -1 ) break; indices[pos++] = index; @@ -1842,7 +1842,7 @@ int TQCString::findRev( const TQRegExp& rx, int index ) const Example: \code TQString s = "banana and panama"; - TQRegExp r = TQRegExp( "a[nm]a", TRUE, FALSE ); + TQRegExp r = TQRegExp( "a[nm]a", true, false ); s.contains( r ); // 4 matches \endcode @@ -1896,9 +1896,9 @@ TQCString &TQCString::replace( const TQRegExp &rx, const char *str ) /*! Returns the string converted to a \c long value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, or if it has trailing garbage; otherwise \a *ok is set to - TRUE. + true. */ long TQCString::toLong( bool *ok ) const @@ -1906,7 +1906,7 @@ long TQCString::toLong( bool *ok ) const char *p = data(); long val=0; const long max_mult = LONG_MAX / 10; - bool is_ok = FALSE; + bool is_ok = false; int neg = 0; if ( !p ) goto bye; @@ -1930,7 +1930,7 @@ long TQCString::toLong( bool *ok ) const while ( isspace((uchar) *p) ) // skip trailing space p++; if ( *p == '\0' ) - is_ok = TRUE; + is_ok = true; bye: if ( ok ) *ok = is_ok; @@ -1940,9 +1940,9 @@ bye: /*! Returns the string converted to an \c{unsigned long} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, or if it has trailing garbage; otherwise \a *ok is set to - TRUE. + true. */ ulong TQCString::toULong( bool *ok ) const @@ -1950,7 +1950,7 @@ ulong TQCString::toULong( bool *ok ) const char *p = data(); ulong val=0; const ulong max_mult = ULONG_MAX / 10; - bool is_ok = FALSE; + bool is_ok = false; if ( !p ) goto bye; while ( isspace((uchar) *p) ) // skip leading space @@ -1967,7 +1967,7 @@ ulong TQCString::toULong( bool *ok ) const while ( isspace((uchar) *p) ) // skip trailing space p++; if ( *p == '\0' ) - is_ok = TRUE; + is_ok = true; bye: if ( ok ) *ok = is_ok; @@ -1977,9 +1977,9 @@ bye: /*! Returns the string converted to a \c{short} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, is out of range, or if it has trailing garbage; otherwise - \a *ok is set to TRUE. + \a *ok is set to true. */ short TQCString::toShort( bool *ok ) const @@ -1987,7 +1987,7 @@ short TQCString::toShort( bool *ok ) const long v = toLong( ok ); if ( v < SHRT_MIN || v > SHRT_MAX ) { if ( ok ) - *ok = FALSE; + *ok = false; v = 0; } return (short)v; @@ -1996,9 +1996,9 @@ short TQCString::toShort( bool *ok ) const /*! Returns the string converted to an \c{unsigned short} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, is out of range, or if it has trailing garbage; otherwise - \a *ok is set to TRUE. + \a *ok is set to true. */ ushort TQCString::toUShort( bool *ok ) const @@ -2006,7 +2006,7 @@ ushort TQCString::toUShort( bool *ok ) const ulong v = toULong( ok ); if ( v > USHRT_MAX ) { if ( ok ) - *ok = FALSE; + *ok = false; v = 0; } return (ushort)v; @@ -2016,9 +2016,9 @@ ushort TQCString::toUShort( bool *ok ) const /*! Returns the string converted to a \c{int} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, or if it has trailing garbage; otherwise \a *ok is set to - TRUE. + true. */ int TQCString::toInt( bool *ok ) const @@ -2026,7 +2026,7 @@ int TQCString::toInt( bool *ok ) const long v = toLong( ok ); if ( v < INT_MIN || v > INT_MAX ) { if ( ok ) - *ok = FALSE; + *ok = false; v = 0; } return (int)v; @@ -2035,9 +2035,9 @@ int TQCString::toInt( bool *ok ) const /*! Returns the string converted to an \c{unsigned int} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, or if it has trailing garbage; otherwise \a *ok is set to - TRUE. + true. */ uint TQCString::toUInt( bool *ok ) const @@ -2045,7 +2045,7 @@ uint TQCString::toUInt( bool *ok ) const ulong v = toULong( ok ); if ( v > UINT_MAX ) { if ( ok ) - *ok = FALSE; + *ok = false; v = 0; } return (uint)v; @@ -2054,9 +2054,9 @@ uint TQCString::toUInt( bool *ok ) const /*! Returns the string converted to a \c{double} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, or if it has trailing garbage; otherwise \a *ok is set to - TRUE. + true. */ double TQCString::toDouble( bool *ok ) const @@ -2071,9 +2071,9 @@ double TQCString::toDouble( bool *ok ) const /*! Returns the string converted to a \c{float} value. - If \a ok is not 0: \a *ok is set to FALSE if the string is not a + If \a ok is not 0: \a *ok is set to false if the string is not a number, or if it has trailing garbage; otherwise \a *ok is set to - TRUE. + true. */ float TQCString::toFloat( bool *ok ) const @@ -2110,10 +2110,10 @@ TQCString &TQCString::setNum( long n ) char *p = &buf[19]; bool neg; if ( n < 0 ) { - neg = TRUE; + neg = true; n = -n; } else { - neg = FALSE; + neg = false; } *p = '\0'; do { @@ -2219,8 +2219,8 @@ TQCString &TQCString::setNum( double n, char f, int prec ) Sets the character at position \a index to \a c and expands the string if necessary, padding with spaces. - Returns FALSE if \a index was out of range and the string could - not be expanded; otherwise returns TRUE. + Returns false if \a index was out of range and the string could + not be expanded; otherwise returns true. */ bool TQCString::setExpand( uint index, char c ) @@ -2229,13 +2229,13 @@ bool TQCString::setExpand( uint index, char c ) uint oldlen = length(); if ( index >= oldlen ) { if ( !TQByteArray::resize( index+2 ) ) // no memory - return FALSE; + return false; if ( index > oldlen ) memset( data() + oldlen, ' ', index - oldlen ); *(data() + index+1) = '\0'; // terminate padded string } *(data() + index) = c; - return TRUE; + return true; } @@ -2342,7 +2342,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 and \a s2 are equal; otherwise returns FALSE. + Returns true if \a s1 and \a s2 are equal; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) == 0. */ @@ -2352,7 +2352,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 and \a s2 are equal; otherwise returns FALSE. + Returns true if \a s1 and \a s2 are equal; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) == 0. */ @@ -2362,7 +2362,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 and \a s2 are equal; otherwise returns FALSE. + Returns true if \a s1 and \a s2 are equal; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) == 0. */ @@ -2372,7 +2372,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 and \a s2 are different; otherwise returns FALSE. + Returns true if \a s1 and \a s2 are different; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) != 0. */ @@ -2382,7 +2382,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 and \a s2 are different; otherwise returns FALSE. + Returns true if \a s1 and \a s2 are different; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) != 0. */ @@ -2392,7 +2392,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 and \a s2 are different; otherwise returns FALSE. + Returns true if \a s1 and \a s2 are different; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) != 0. */ @@ -2402,7 +2402,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is less than \a s2; otherwise returns FALSE. + Returns true if \a s1 is less than \a s2; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) \< 0. @@ -2414,7 +2414,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is less than \a s2; otherwise returns FALSE. + Returns true if \a s1 is less than \a s2; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) \< 0. @@ -2426,8 +2426,8 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is less than or equal to \a s2; otherwise - returns FALSE. + Returns true if \a s1 is less than or equal to \a s2; otherwise + returns false. Equivalent to qstrcmp(\a s1, \a s2) \<= 0. @@ -2439,8 +2439,8 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is less than or equal to \a s2; otherwise - returns FALSE. + Returns true if \a s1 is less than or equal to \a s2; otherwise + returns false. Equivalent to qstrcmp(\a s1, \a s2) \<= 0. @@ -2452,7 +2452,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is greater than \a s2; otherwise returns FALSE. + Returns true if \a s1 is greater than \a s2; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) \> 0. @@ -2464,7 +2464,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is greater than \a s2; otherwise returns FALSE. + Returns true if \a s1 is greater than \a s2; otherwise returns false. Equivalent to qstrcmp(\a s1, \a s2) \> 0. @@ -2476,8 +2476,8 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is greater than or equal to \a s2; otherwise - returns FALSE. + Returns true if \a s1 is greater than or equal to \a s2; otherwise + returns false. Equivalent to qstrcmp(\a s1, \a s2) \>= 0. @@ -2489,8 +2489,8 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \relates TQCString - Returns TRUE if \a s1 is greater than or equal to \a s2; otherwise - returns FALSE. + Returns true if \a s1 is greater than or equal to \a s2; otherwise + returns false. Equivalent to qstrcmp(\a s1, \a s2) \>= 0. |
