diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 23a5fcb7bcfc9b701a351706d3ea99b274c3127d (patch) | |
tree | fdb7d4348d1f6245491f345d5ac08da9f2697927 /krename/batchrenamer.cpp | |
parent | fb6f03ff757a26f9e161777d9867217bc3f76245 (diff) | |
download | krename-23a5fcb7bcfc9b701a351706d3ea99b274c3127d.tar.gz krename-23a5fcb7bcfc9b701a351706d3ea99b274c3127d.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/krename@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krename/batchrenamer.cpp')
-rw-r--r-- | krename/batchrenamer.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/krename/batchrenamer.cpp b/krename/batchrenamer.cpp index cf2941e..5eed8d3 100644 --- a/krename/batchrenamer.cpp +++ b/krename/batchrenamer.cpp @@ -118,7 +118,7 @@ void BatchRenamer::processFiles( ProgressDialog* p, TQObject* object ) if( m_files[c].src.directory.left( m_files[i].src.name.length() + 1 ) == ( m_files[i].src.name + "/" ) ) { - m_files[c].src.directory.tqreplace( 0, m_files[i].src.name.length(), m_files[i].dst.name ); + m_files[c].src.directory.replace( 0, m_files[i].src.name.length(), m_files[i].dst.name ); m_files[c].src.url.setPath( BatchRenamer::buildFilename( &m_files[c].src, true ) ); } } @@ -358,7 +358,7 @@ void BatchRenamer::work( ProgressDialog* p ) void BatchRenamer::escape( TQString & text, const TQString & token, const TQString & sequence ) { - text.tqreplace( token, sequence ); + text.replace( token, sequence ); } TQString & BatchRenamer::doEscape( TQString text, bool filename ) @@ -419,14 +419,14 @@ int BatchRenamer::getCharacters( int n ) return s.length(); } -TQString BatchRenamer::findAndProcess( const TQString & token, TQString text, const TQString & tqreplace ) +TQString BatchRenamer::findAndProcess( const TQString & token, TQString text, const TQString & replace ) { /* * pos can here be -1 because - * tqfindRev is called with it as a + * findRev is called with it as a * value ! */ - text.tqreplace( token, tqreplace ); + text.replace( token, replace ); return text; } @@ -440,10 +440,10 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i ) countervalues.start = m_index; countervalues.step = m_step; - if( text.tqcontains( "#", FALSE ) <= 0 ) + if( text.contains( "#", FALSE ) <= 0 ) return text; - pos = text.tqfind("#", pos); + pos = text.find("#", pos); pos++; while( text[pos] == '#' ) { text.remove(pos, 1); @@ -452,7 +452,7 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i ) findNumberAppendix( text, pos, &countervalues.start, &countervalues.step ); - pos = text.tqfind("#", 0); + pos = text.find("#", 0); if( (signed int)m_counters.count() <= m_counter_index ) { @@ -464,7 +464,7 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i ) do { m_counters[m_counter_index].value += m_counters[m_counter_index].step; - } while( m_skip.tqcontains( m_counters[m_counter_index].value ) ); + } while( m_skip.contains( m_counters[m_counter_index].value ) ); /* int v = start + (i*step) + m_skip_add[m_counter_index]; @@ -478,7 +478,7 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i ) TQString temp; temp.sprintf("%0*i", counter, m_counters[m_counter_index].value ); - text.tqreplace( pos, 1, temp); + text.replace( pos, 1, temp); ++m_counter_index; return findNumbers( text, count, i ); @@ -491,7 +491,7 @@ void BatchRenamer::findNumberAppendix( TQString & text, int pos, int* start, int int end = 0; bool ok = false; - if( text[pos] == '{' && (end = text.tqfind( "}", pos )) > -1) + if( text[pos] == '{' && (end = text.find( "}", pos )) > -1) { //qDebug("Found an appendix:" + appendix ); appendix = text.mid( pos + 1, end - pos - 1); @@ -511,7 +511,7 @@ TQString BatchRenamer::findStar( const TQString & oldname, TQString text ) { int pos = -1; do { - pos = text.tqfindRev("*", pos); + pos = text.findRev("*", pos); if( pos >= 0 ) { TQString tmp = oldname.lower(); if( tmp[0].isLetter() ) @@ -522,7 +522,7 @@ TQString BatchRenamer::findStar( const TQString & oldname, TQString text ) tmp[i] != '\'' && tmp[i] != '?' && tmp[i] != '`' ) tmp[i+1] = tmp[i+1].upper(); - text.tqreplace( pos, 1, tmp); + text.replace( pos, 1, tmp); } } while( pos >= 0 ); return text; @@ -538,15 +538,15 @@ TQString BatchRenamer::findBrackets( TQString oldname, TQString text, int i ) int num, pos = -1, a; TQString token; - if( text.tqcontains("]", FALSE) <= 0 || text.isEmpty() ) + if( text.contains("]", FALSE) <= 0 || text.isEmpty() ) return text; - num = text.tqcontains("[", FALSE); + num = text.contains("[", FALSE); if(num <= 0 ) return text; - pos = text.tqfindRev("[", pos); - a = text.tqfind("]", pos ); + pos = text.findRev("[", pos); + a = text.find("]", pos ); if( a < 0 && pos >= 0 ) return text; @@ -646,7 +646,7 @@ TQString BatchRenamer::findToken( TQString oldname, TQString token, int i ) break; case MIXED: token = token.lower(); - token.tqreplace( 0, 1, token[0].upper()); + token.replace( 0, 1, token[0].upper()); break; case STAR: token = findStar( token, "*" ); @@ -676,14 +676,14 @@ TQString BatchRenamer::findPartStrings( TQString oldname, TQString token ) int pos = -1; // parse things like [2;4{[dirname]}] - if( token.tqcontains( "{" ) >= 1 && token.tqcontains( "}" ) >= 1 ) { - int pos = token.tqfind( "{" ); - oldname = token.mid( pos + 1, token.tqfindRev( "}" ) - pos - 1 ); + if( token.contains( "{" ) >= 1 && token.contains( "}" ) >= 1 ) { + int pos = token.find( "{" ); + oldname = token.mid( pos + 1, token.findRev( "}" ) - pos - 1 ); token = token.left( pos ); } - if( token.tqcontains("-") ) { - pos = token.tqfind( "-", 0 ); + if( token.contains("-") ) { + pos = token.find( "-", 0 ); first = token.left( pos ); // ------- Code OK ^ ! @@ -717,8 +717,8 @@ TQString BatchRenamer::findPartStrings( TQString oldname, TQString token ) x++; return oldname.mid( first.toInt()-1, x ); - } else if( token.tqcontains(";") ) { - pos = token.tqfind( ";", 0 ); + } else if( token.contains(";") ) { + pos = token.find( ";", 0 ); first = token.left( pos ); second = token.mid( pos+1, token.length() ); @@ -744,7 +744,7 @@ TQString BatchRenamer::findDirName( TQString token, TQString path ) int recursion = 1; if( token.length() > 7 ) { token = token.right( token.length() - 7 ); - recursion = token.tqcontains( "." ); + recursion = token.contains( "." ); if( recursion != (signed int)token.length() ) return TQString(); @@ -777,27 +777,27 @@ TQString BatchRenamer::findLength( const TQString & token, const TQString & name TQString BatchRenamer::findReplace( TQString text ) { // Call for each element in replace strings doReplace with correct values - for( unsigned int i = 0; i < m_tqreplace.count(); i++ ) { - replacestrings s = m_tqreplace[i]; - text = doReplace( text, unEscape( s.tqfind ), s.tqreplace, s.reg ); + for( unsigned int i = 0; i < m_replace.count(); i++ ) { + replacestrings s = m_replace[i]; + text = doReplace( text, unEscape( s.find ), s.replace, s.reg ); } return text; } -TQString BatchRenamer::doReplace( TQString text, TQString tqfind, TQString tqreplace, bool reg ) +TQString BatchRenamer::doReplace( TQString text, TQString find, TQString replace, bool reg ) { if( !reg ) { // we use the escaped text here because the user might want // to find a "&" and replace it - text.tqreplace( doEscape( tqfind ), tqreplace ); + text.replace( doEscape( find ), replace ); } else { // no doEscape() here for the regexp, because it would destroy our regular expression // other wise we will not find stuff like $, [ in the text - text = doEscape( unEscape( text ).tqreplace( TQRegExp( tqfind ), tqreplace ) ); + text = doEscape( unEscape( text ).replace( TQRegExp( find ), replace ) ); } return text; } @@ -832,7 +832,7 @@ void BatchRenamer::writeUndoScript( TQTextStream* t ) void BatchRenamer::parseSubdirs( data* f ) { int pos = 0; - if( (pos = f->dst.name.tqfindRev( "/", -1 ) ) > 0 ) { + if( (pos = f->dst.name.findRev( "/", -1 ) ) > 0 ) { TQString dirs = f->dst.name.left( pos ); f->dst.name = f->dst.name.right( f->dst.name.length() - pos - 1 ); f->dst.directory += ( f->dst.directory.right( 1 ) == "/" ) ? "" : "/"; |