diff options
Diffstat (limited to 'tqtinterface/qt4/src/tools/tqcstring.cpp')
-rw-r--r-- | tqtinterface/qt4/src/tools/tqcstring.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/tqtinterface/qt4/src/tools/tqcstring.cpp b/tqtinterface/qt4/src/tools/tqcstring.cpp index f81348f..4227c82 100644 --- a/tqtinterface/qt4/src/tools/tqcstring.cpp +++ b/tqtinterface/qt4/src/tools/tqcstring.cpp @@ -663,7 +663,7 @@ TQCString::TQCString( const char *str ) TQCString str( "helloworld", 6 ); // assigns "hello" to str \endcode - If \a str tqcontains a 0 byte within the first \a maxsize bytes, the + If \a str contains a 0 byte within the first \a maxsize bytes, the resulting TQCString will be terminated by this 0. If \a str is 0 a null string is created. @@ -736,7 +736,7 @@ TQCString &TQCString::operator=(const QByteArray &ba) { \note However, if you ask for the data pointer of a null TQCString by calling data(), then because the internal representation of the - null TQCString is shared, it will be detached and tqreplaced with a + null TQCString is shared, it will be detached and replaced with a non-shared, empty representation, a non-null data pointer will be returned, and subsequent calls to isNull() will return false. But if you ask for the data pointer of a null TQCString by calling @@ -755,12 +755,12 @@ TQCString &TQCString::operator=(const QByteArray &ba) { or right padded with characters using leftJustify() and rightJustify(). Characters, strings and regular expressions can be searched for using find() and findRev(), and counted using - tqcontains(). + contains(). Strings and characters can be inserted with insert() and appended with append(). A string can be prepended with prepend(). Characters can be removed from the string with remove() and - tqreplaced with tqreplace(). + replaced with replace(). Portions of a string can be extracted using left(), right() and mid(). Whitespace can be removed using stripWhiteSpace() and @@ -784,7 +784,7 @@ TQCString &TQCString::operator=(const QByteArray &ba) { Case insensitive operations and comparisons will be accurate if both strings contain only ASCII characters. (If \c $LC_CTYPE is set, most Unix systems do "the right thing".) Functions that this - affects include tqcontains(), find(), findRev(), \l operator<(), \l + affects include contains(), find(), findRev(), \l operator<(), \l operator<=(), \l operator>(), \l operator>=(), lower() and upper(). @@ -867,37 +867,37 @@ TQCString &TQCString::operator=(const QByteArray &ba) { */ /*! - \fn TQCString& TQCString::tqreplace(uint index, uint len, const char *c) + \fn TQCString& TQCString::replace(uint index, uint len, const char *c) \internal */ /*! - \fn TQCString& TQCString::tqreplace(char c, const TQCString &after) + \fn TQCString& TQCString::replace(char c, const TQCString &after) \internal */ /*! - \fn TQCString& TQCString::tqreplace(char c, const char *after) + \fn TQCString& TQCString::replace(char c, const char *after) \internal */ /*! - \fn TQCString& TQCString::tqreplace(const TQCString &b, const TQCString &a) + \fn TQCString& TQCString::replace(const TQCString &b, const TQCString &a) \internal */ /*! - \fn TQCString& TQCString::tqreplace(const char *b, const char *a) + \fn TQCString& TQCString::replace(const char *b, const char *a) \internal */ /*! - \fn TQCString& TQCString::tqreplace(char b, char a) + \fn TQCString& TQCString::replace(char b, char a) \internal */ @@ -949,7 +949,7 @@ TQCString &TQCString::operator=(const QByteArray &ba) { Example: \snippet doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp 0 - If \a str tqcontains a 0 byte within the first \a maxsize bytes, the + If \a str contains a 0 byte within the first \a maxsize bytes, the resulting TQCString will be terminated by this 0. If \a str is 0 a null string is created. @@ -989,7 +989,7 @@ TQCString &TQCString::operator=(const QByteArray &ba) { \note If you ask for the data pointer of a null TQCString by calling data(), then because the internal representation of the - null TQCString is shared, it will be detached and tqreplaced with a + null TQCString is shared, it will be detached and replaced with a non-shared, empty representation, a non-null data pointer will be returned, and subsequent calls to isNull() will return false. But if you ask for the data pointer of a null TQCString by calling @@ -1093,7 +1093,7 @@ TQCString &TQCString::sprintf(const char *format, ...) /*! Returns a string of length \a width (plus one for the terminating - '\0') that tqcontains this string padded with the \a fill character. + '\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 @@ -1126,7 +1126,7 @@ TQCString TQCString::leftJustify(uint width, char fill, bool truncate) const /*! Returns a string of length \a width (plus one for the terminating - '\0') that tqcontains zero or more of the \a fill character followed + '\0') that contains zero or more of the \a fill character followed by this string. If the length of the string exceeds \a width and \a truncate is @@ -1829,7 +1829,7 @@ TQDataStream &operator>>( TQDataStream &s, TQCString &str ) \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqcontains( char c, bool cs ) const +int TQCString::contains( char c, bool cs ) const { int count = 0; const char *d = data(); @@ -1859,20 +1859,20 @@ int TQCString::tqcontains( char c, bool cs ) const \code TQString s = "banana and panama"; TQRegExp r = TQRegExp( "a[nm]a", TRUE, FALSE ); - s.tqcontains( r ); // 4 matches + s.contains( r ); // 4 matches \endcode - \sa tqfind(), tqfindRev() + \sa find(), findRev() \warning If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a TQString and apply the function to that. */ -int TQCString::tqcontains( const QRegExp &rx ) const +int TQCString::contains( const QRegExp &rx ) const { TQString d = TQString::fromAscii( data() ); - return d.tqcontains( rx ); + return d.contains( rx ); } /*! @@ -1884,19 +1884,19 @@ int TQCString::tqcontains( const QRegExp &rx ) const if \a cs if FALSE. This function counts overlapping substrings, for example, "banana" - tqcontains two occurrences of "ana". + contains two occurrences of "ana". - \sa tqfindRev() + \sa findRev() \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqcontains( const char *str, bool cs ) const +int TQCString::contains( const char *str, bool cs ) const { int count = 0; int i = -1; uint l = length(); - // use tqfind for the faster hashing algorithm - while ( ( i = tqfind ( str, i+1, cs, l ) ) != -1 ) + // use find for the faster hashing algorithm + while ( ( i = find ( str, i+1, cs, l ) ) != -1 ) count++; return count; } @@ -1918,7 +1918,7 @@ int TQCString::tqcontains( const char *str, bool cs ) const \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqfind( char c, int index, bool cs ) const +int TQCString::find( char c, int index, bool cs ) const { if ( (uint)index >= size() ) // index outside string return -1; @@ -1951,9 +1951,9 @@ int TQCString::tqfind( char c, int index, bool cs ) const \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqfind( const char *str, int index, bool cs ) const +int TQCString::find( const char *str, int index, bool cs ) const { - return tqfind( str, index, cs, length() ); + return find( str, index, cs, length() ); } #ifndef TQT_NO_REGEXP_CAPTURE @@ -1971,14 +1971,14 @@ int TQCString::tqfind( const char *str, int index, bool cs ) const apply the function to that. */ -int TQCString::tqfind( const QRegExp& rx, int index ) const +int TQCString::find( const QRegExp& rx, int index ) const { TQString d = TQString::fromAscii( data() ); - return d.tqfind( rx, index ); + return d.find( rx, index ); } #endif // TQT_NO_REGEXP_CAPTURE -int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const +int TQCString::find( const char *str, int index, bool cs, uint l ) const { if ( (uint)index >= size() ) return -1; @@ -1991,10 +1991,10 @@ int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const return -1; if ( sl == 1 ) - return tqfind( *str, index, cs ); + return find( *str, index, cs ); /* - See TQString::tqfind() for details. + See TQString::find() for details. */ const char* needle = str; const char* haystack = data() + index; @@ -2050,13 +2050,13 @@ int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const Example: \code TQString s = "banana"; - s.tqreplace( TQRegExp("a.*a"), "" ); // becomes "b" + s.replace( TQRegExp("a.*a"), "" ); // becomes "b" s = "banana"; - s.tqreplace( TQRegExp("^[bn]a"), "X" ); // becomes "Xnana" + s.replace( TQRegExp("^[bn]a"), "X" ); // becomes "Xnana" s = "banana"; - s.tqreplace( TQRegExp("^[bn]a"), "" ); // becomes "nana" + s.replace( TQRegExp("^[bn]a"), "" ); // becomes "nana" \endcode \warning If you want to apply this function repeatedly to the same @@ -2064,11 +2064,11 @@ int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const apply the function to that. */ -TQCString &TQCString::tqreplace( const QRegExp &rx, const char *str ) +TQCString &TQCString::replace( const QRegExp &rx, const char *str ) { TQString d = TQString::fromAscii( data() ); TQString r = TQString::fromAscii( str ); - d.tqreplace( rx, r ); + d.replace( rx, r ); setStr( d.ascii() ); return *this; } @@ -2181,13 +2181,13 @@ QT_END_NAMESPACE can be filled with a character using fill(). Strings can be left or right padded with characters using leftJustify() and rightJustify(). Characters, strings and regular expressions can be - searched for using tqfind() and tqfindRev(), and counted using - tqcontains(). + searched for using find() and findRev(), and counted using + contains(). Strings and characters can be inserted with insert() and appended with append(). A string can be prepended with prepend(). Characters can be removed from the string with remove() and - tqreplaced with tqreplace(). + replaced with replace(). Portions of a string can be extracted using left(), right() and mid(). Whitespace can be removed using stripWhiteSpace() and @@ -2212,7 +2212,7 @@ QT_END_NAMESPACE Case insensitive operations and comparisons will be accurate if both strings contain only ASCII characters. (If \c $LC_CTYPE is set, most Unix systems do "the right thing".) Functions that this - affects include tqcontains(), tqfind(), tqfindRev(), \l operator<(), \l + affects include contains(), find(), findRev(), \l operator<(), \l operator<=(), \l operator>(), \l operator>=(), lower() and upper(). @@ -2286,7 +2286,7 @@ TQCString::TQCString( const char *str ) TQCString str( "helloworld", 6 ); // assigns "hello" to str \endcode - If \a str tqcontains a 0 byte within the first \a maxsize bytes, the + If \a str contains a 0 byte within the first \a maxsize bytes, the resulting TQCString will be terminated by this 0. If \a str is 0 a null string is created. @@ -2515,7 +2515,7 @@ bool TQCString::fill( char c, int len ) \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqfind( char c, int index, bool cs ) const +int TQCString::find( char c, int index, bool cs ) const { if ( (uint)index >= size() ) // index outside string return -1; @@ -2553,12 +2553,12 @@ int TQCString::tqfind( char c, int index, bool cs ) const \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqfind( const char *str, int index, bool cs ) const +int TQCString::find( const char *str, int index, bool cs ) const { - return tqfind( str, index, cs, length() ); + return find( str, index, cs, length() ); } -int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const +int TQCString::find( const char *str, int index, bool cs, uint l ) const { if ( (uint)index >= size() ) return -1; @@ -2571,10 +2571,10 @@ int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const return -1; if ( sl == 1 ) - return tqfind( *str, index, cs ); + return find( *str, index, cs ); /* - See TQString::tqfind() for details. + See TQString::find() for details. */ const char* needle = str; const char* haystack = data() + index; @@ -2633,7 +2633,7 @@ int TQCString::tqfind( const char *str, int index, bool cs, uint l ) const \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqfindRev( char c, int index, bool cs ) const +int TQCString::findRev( char c, int index, bool cs ) const { register const char *b = data(); register const char *d; @@ -2668,10 +2668,10 @@ int TQCString::tqfindRev( char c, int index, bool cs ) const \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqfindRev( const char *str, int index, bool cs ) const +int TQCString::findRev( const char *str, int index, bool cs ) const { /* - See TQString::tqfind() for explanations. + See TQString::find() for explanations. */ const uint sl = tqstrlen( str ); const uint l = length(); @@ -2684,7 +2684,7 @@ int TQCString::tqfindRev( const char *str, int index, bool cs ) const index = delta; if ( sl == 1 ) - return tqfindRev( *str, index, cs ); + return findRev( *str, index, cs ); const char* needle = str; const char* haystack = data() + index; @@ -2735,7 +2735,7 @@ int TQCString::tqfindRev( const char *str, int index, bool cs ) const \sa \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqcontains( char c, bool cs ) const +int TQCString::contains( char c, bool cs ) const { int count = 0; const char *d = data(); @@ -2765,25 +2765,25 @@ int TQCString::tqcontains( char c, bool cs ) const if \a cs if FALSE. This function counts overlapping substrings, for example, "banana" - tqcontains two occurrences of "ana". + contains two occurrences of "ana". - \sa tqfindRev() + \sa findRev() \link #asciinotion Note on character comparisons \endlink */ -int TQCString::tqcontains( const char *str, bool cs ) const +int TQCString::contains( const char *str, bool cs ) const { int count = 0; int i = -1; uint l = length(); - // use tqfind for the faster hashing algorithm - while ( ( i = tqfind ( str, i+1, cs, l ) ) != -1 ) + // use find for the faster hashing algorithm + while ( ( i = find ( str, i+1, cs, l ) ) != -1 ) count++; return count; } /*! - Returns a substring that tqcontains the \a len leftmost characters + Returns a substring that contains the \a len leftmost characters of the string. The whole string is returned if \a len exceeds the length of the @@ -2814,7 +2814,7 @@ TQCString TQCString::left( uint len ) const } /*! - Returns a substring that tqcontains the \a len rightmost characters + Returns a substring that contains the \a len rightmost characters of the string. The whole string is returned if \a len exceeds the length of the @@ -2844,7 +2844,7 @@ TQCString TQCString::right( uint len ) const } /*! - Returns a substring that tqcontains at most \a len characters from + Returns a substring that contains at most \a len characters from this string, starting at position \a index. Returns a null string if the string is empty or if \a index is out @@ -2879,7 +2879,7 @@ TQCString TQCString::mid( uint index, uint len ) const /*! Returns a string of length \a width (plus one for the terminating - '\0') that tqcontains this string padded with the \a fill character. + '\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 @@ -2916,7 +2916,7 @@ TQCString TQCString::leftJustify( uint width, char fill, bool truncate ) const /*! Returns a string of length \a width (plus one for the terminating - '\0') that tqcontains zero or more of the \a fill character followed + '\0') that contains zero or more of the \a fill character followed by this string. If the length of the string exceeds \a width and \a truncate is @@ -3053,7 +3053,7 @@ TQCString TQCString::stripWhiteSpace() const /*! Returns a new string that has white space removed from the start - and the end, plus any sequence of internal white space tqreplaced + and the end, plus any sequence of internal white space replaced with a single space (ASCII 32). White space means the decimal ASCII codes 9, 10, 11, 12, 13 and @@ -3148,7 +3148,7 @@ TQCString &TQCString::insert( uint index, const char *s ) s.insert( 3, '!'); // s == "Yes!" \endcode - \sa remove(), tqreplace() + \sa remove(), replace() */ TQCString &TQCString::insert( uint index, char c ) // insert char @@ -3180,7 +3180,7 @@ TQCString &TQCString::insert( uint index, char c ) // insert char s.remove( 1, 4 ); // s == "Meal" \endcode - \sa insert(), tqreplace() + \sa insert(), replace() */ TQCString &TQCString::remove( uint index, uint len ) @@ -3206,17 +3206,17 @@ TQCString &TQCString::remove( uint index, uint len ) If \a index is out of range, nothing is removed and \a str is appended at the end of the string. If \a index is valid, but \a index + \a len is larger than the length of the string, \a str - tqreplaces the rest of the string from position \a index. + replaces the rest of the string from position \a index. \code TQCString s = "Say yes!"; - s.tqreplace( 4, 3, "NO" ); // s == "Say NO!" + s.replace( 4, 3, "NO" ); // s == "Say NO!" \endcode \sa insert(), remove() */ -TQCString &TQCString::tqreplace( uint index, uint len, const char *str ) +TQCString &TQCString::replace( uint index, uint len, const char *str ) { remove( index, len ); insert( index, str ); @@ -3232,16 +3232,16 @@ TQCString &TQCString::tqreplace( uint index, uint len, const char *str ) Example: \code TQCString s = "a,b,c"; - s.tqreplace( ',', " or " ); + s.replace( ',', " or " ); // s == "a or b or c" \endcode */ -TQCString &TQCString::tqreplace( char c, const char *after ) +TQCString &TQCString::replace( char c, const char *after ) { char str[2]; str[0] = c; str[1] = '\0'; - return tqreplace( str, after ); + return replace( str, after ); } /*! \overload @@ -3252,12 +3252,12 @@ TQCString &TQCString::tqreplace( char c, const char *after ) Example: \code TQCString s = "Greek is Greek"; - s.tqreplace( "Greek", "English" ); + s.replace( "Greek", "English" ); // s == "English is English" \endcode */ -TQCString &TQCString::tqreplace( const char *before, const char *after ) +TQCString &TQCString::replace( const char *before, const char *after ) { if ( before == after || isNull() ) return *this; @@ -3272,7 +3272,7 @@ TQCString &TQCString::tqreplace( const char *before, const char *after ) if ( bl == al ) { if ( bl ) { - while( (index = tqfind( before, index, TRUE, len ) ) != -1 ) { + while( (index = find( before, index, TRUE, len ) ) != -1 ) { memcpy( d+index, after, al ); index += bl; } @@ -3281,7 +3281,7 @@ TQCString &TQCString::tqreplace( const char *before, const char *after ) uint to = 0; uint movestart = 0; uint num = 0; - while( (index = tqfind( before, index, TRUE, len ) ) != -1 ) { + while( (index = find( before, index, TRUE, len ) ) != -1 ) { if ( num ) { int msize = index - movestart; if ( msize > 0 ) { @@ -3312,7 +3312,7 @@ TQCString &TQCString::tqreplace( const char *before, const char *after ) uint indices[4096]; uint pos = 0; while( pos < 4095 ) { - index = tqfind(before, index, TRUE, len); + index = find(before, index, TRUE, len); if ( index == -1 ) break; indices[pos++] = index; @@ -3324,7 +3324,7 @@ TQCString &TQCString::tqreplace( const char *before, const char *after ) if ( !pos ) break; - // we have a table of tqreplacement positions, use them for fast replacing + // we have a table of replacement positions, use them for fast replacing int adjust = pos*(al-bl); // index has to be adjusted in case we get back into the loop above. if ( index != -1 ) @@ -3357,7 +3357,7 @@ TQCString &TQCString::tqreplace( const char *before, const char *after ) Replaces every occurrence of \a c1 with the char \a c2. Returns a reference to the string. */ -TQCString &TQCString::tqreplace( char c1, char c2 ) +TQCString &TQCString::replace( char c1, char c2 ) { detach(); uint i = 0; @@ -3387,10 +3387,10 @@ TQCString &TQCString::tqreplace( char c1, char c2 ) apply the function to that. */ -int TQCString::tqfind( const TQRegExp& rx, int index ) const +int TQCString::find( const TQRegExp& rx, int index ) const { TQString d = TQString::fromAscii( data() ); - return d.tqfind( rx, index ); + return d.find( rx, index ); } /*! @@ -3407,10 +3407,10 @@ int TQCString::tqfind( const TQRegExp& rx, int index ) const apply the function to that. */ -int TQCString::tqfindRev( const TQRegExp& rx, int index ) const +int TQCString::findRev( const TQRegExp& rx, int index ) const { TQString d = TQString::fromAscii( data() ); - return d.tqfindRev( rx, index ); + return d.findRev( rx, index ); } /*! @@ -3422,20 +3422,20 @@ int TQCString::tqfindRev( const TQRegExp& rx, int index ) const \code TQString s = "banana and panama"; TQRegExp r = TQRegExp( "a[nm]a", TRUE, FALSE ); - s.tqcontains( r ); // 4 matches + s.contains( r ); // 4 matches \endcode - \sa tqfind(), tqfindRev() + \sa find(), findRev() \warning If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a TQString and apply the function to that. */ -int TQCString::tqcontains( const TQRegExp &rx ) const +int TQCString::contains( const TQRegExp &rx ) const { TQString d = TQString::fromAscii( data() ); - return d.tqcontains( rx ); + return d.contains( rx ); } @@ -3448,13 +3448,13 @@ int TQCString::tqcontains( const TQRegExp &rx ) const Example: \code TQString s = "banana"; - s.tqreplace( TQRegExp("a.*a"), "" ); // becomes "b" + s.replace( TQRegExp("a.*a"), "" ); // becomes "b" s = "banana"; - s.tqreplace( TQRegExp("^[bn]a"), "X" ); // becomes "Xnana" + s.replace( TQRegExp("^[bn]a"), "X" ); // becomes "Xnana" s = "banana"; - s.tqreplace( TQRegExp("^[bn]a"), "" ); // becomes "nana" + s.replace( TQRegExp("^[bn]a"), "" ); // becomes "nana" \endcode \warning If you want to apply this function repeatedly to the same @@ -3462,11 +3462,11 @@ int TQCString::tqcontains( const TQRegExp &rx ) const apply the function to that. */ -TQCString &TQCString::tqreplace( const TQRegExp &rx, const char *str ) +TQCString &TQCString::replace( const TQRegExp &rx, const char *str ) { TQString d = TQString::fromAscii( data() ); TQString r = TQString::fromAscii( str ); - d.tqreplace( rx, r ); + d.replace( rx, r ); setStr( d.ascii() ); return *this; } |