rename the following methods:

tqfind find
tqreplace replace
tqcontains contains


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdiff3@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 7b4db4f16d
commit 5173e6fcb1

@ -135,7 +135,7 @@ void readTranslationFile()
static tstring getTranslation( const tstring& fallback ) static tstring getTranslation( const tstring& fallback )
{ {
std::map< std::wstring, std::wstring >::iterator i = s_translationMap.tqfind( fallback ); std::map< std::wstring, std::wstring >::iterator i = s_translationMap.find( fallback );
if (i!=s_translationMap.end()) if (i!=s_translationMap.end())
return i->second; return i->second;
return fallback; return fallback;
@ -153,14 +153,14 @@ static tstring getTranslation( const tstring& fallback )
static void replaceArgs( tstring& s, const tstring& r1, const tstring& r2=TEXT(""), const tstring& r3=TEXT("") ) static void replaceArgs( tstring& s, const tstring& r1, const tstring& r2=TEXT(""), const tstring& r3=TEXT("") )
{ {
tstring arg1 = TEXT("%1"); tstring arg1 = TEXT("%1");
size_t pos1 = s.tqfind( arg1 ); size_t pos1 = s.find( arg1 );
tstring arg2 = TEXT("%2"); tstring arg2 = TEXT("%2");
size_t pos2 = s.tqfind( arg2 ); size_t pos2 = s.find( arg2 );
tstring arg3 = TEXT("%3"); tstring arg3 = TEXT("%3");
size_t pos3 = s.tqfind( arg3 ); size_t pos3 = s.find( arg3 );
if ( pos1 != size_t(-1) ) if ( pos1 != size_t(-1) )
{ {
s.tqreplace( pos1, arg1.length(), r1 ); s.replace( pos1, arg1.length(), r1 );
if ( pos2 != size_t(-1) && pos1<pos2 ) if ( pos2 != size_t(-1) && pos1<pos2 )
pos2 += r1.length() - arg1.length(); pos2 += r1.length() - arg1.length();
if ( pos3 != size_t(-1) && pos1<pos3 ) if ( pos3 != size_t(-1) && pos1<pos3 )
@ -168,13 +168,13 @@ static void replaceArgs( tstring& s, const tstring& r1, const tstring& r2=TEXT("
} }
if ( pos2 != size_t(-1) ) if ( pos2 != size_t(-1) )
{ {
s.tqreplace( pos2, arg2.length(), r2 ); s.replace( pos2, arg2.length(), r2 );
if ( pos3 != size_t(-1) && pos2<pos3 ) if ( pos3 != size_t(-1) && pos2<pos3 )
pos3 += r2.length() - arg2.length(); pos3 += r2.length() - arg2.length();
} }
if ( pos3 != size_t(-1) ) if ( pos3 != size_t(-1) )
{ {
s.tqreplace( pos3, arg3.length(), r3 ); s.replace( pos3, arg3.length(), r3 );
} }
} }

@ -108,7 +108,7 @@ class STRING {
return tmp; return tmp;
} }
STRING& tqreplace( size_t pos, size_t num, const STRING& s ) STRING& replace( size_t pos, size_t num, const STRING& s )
{ {
*this = substr( 0, pos ) + s + substr( pos+num ); *this = substr( 0, pos ) + s + substr( pos+num );
return *this; return *this;
@ -118,7 +118,7 @@ class STRING {
return (lstrcmp(_str, s) == 0); return (lstrcmp(_str, s) == 0);
} }
size_t tqfind(const STRING& s) const size_t find(const STRING& s) const
{ {
const TCHAR* p = _tcsstr( _str, s._str ); const TCHAR* p = _tcsstr( _str, s._str );
if (p) if (p)

@ -260,7 +260,7 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
for( ; i!=lineItemList.end(); ++i ) for( ; i!=lineItemList.end(); ++i )
{ {
LineItem& li = *i; LineItem& li = *i;
if ((int)toUpper(li.command).tqfind("KDIFF3")>=0) if ((int)toUpper(li.command).find("KDIFF3")>=0)
{ {
std::list<LineItem>::const_iterator j = lineItemListBak.begin(); std::list<LineItem>::const_iterator j = lineItemListBak.begin();
for (;j!=lineItemListBak.end();++j) for (;j!=lineItemListBak.end();++j)

@ -64,7 +64,7 @@ void ValueMap::load( TQTextStream& ts )
while ( !ts.eof() ) while ( !ts.eof() )
{ // until end of file... { // until end of file...
TQString s = ts.readLine(); // line of text excluding '\n' TQString s = ts.readLine(); // line of text excluding '\n'
int pos = s.tqfind('='); int pos = s.find('=');
if( pos > 0 ) // seems not to have a tag if( pos > 0 ) // seems not to have a tag
{ {
TQString key = s.left(pos); TQString key = s.left(pos);
@ -79,8 +79,8 @@ void ValueMap::load( const TQString& s )
int pos=0; int pos=0;
while ( pos<(int)s.length() ) while ( pos<(int)s.length() )
{ // until end of file... { // until end of file...
int pos2 = s.tqfind('=', pos); int pos2 = s.find('=', pos);
int pos3 = s.tqfind('\n', pos2 ); int pos3 = s.find('\n', pos2 );
if (pos3<0) if (pos3<0)
pos3=s.length(); pos3=s.length();
if( pos2 > 0 ) // seems not to have a tag if( pos2 > 0 ) // seems not to have a tag
@ -115,8 +115,8 @@ TQString safeStringJoin(const TQStringList& sl, char sepChar, char metaChar )
for (i=sl.begin(); i!=sl.end(); ++i) for (i=sl.begin(); i!=sl.end(); ++i)
{ {
TQString s = *i; TQString s = *i;
s.tqreplace(meta, meta+meta); // "\" -> "\\" s.replace(meta, meta+meta); // "\" -> "\\"
s.tqreplace(sep, meta+sep); // "," -> "\," s.replace(sep, meta+sep); // "," -> "\,"
if ( i==sl.begin() ) if ( i==sl.begin() )
safeString = s; safeString = s;
else else
@ -165,14 +165,14 @@ static TQString subSection( const TQString& s, int idx, char sep )
int pos=0; int pos=0;
while( idx>0 ) while( idx>0 )
{ {
pos = s.tqfind( sep, pos ); pos = s.find( sep, pos );
--idx; --idx;
if (pos<0) break; if (pos<0) break;
++pos; ++pos;
} }
if ( pos>=0 ) if ( pos>=0 )
{ {
int pos2 = s.tqfind( sep, pos ); int pos2 = s.find( sep, pos );
if ( pos2>0 ) if ( pos2>0 )
return s.mid(pos, pos2-pos); return s.mid(pos, pos2-pos);
else else

@ -459,7 +459,7 @@ void SourceData::readAndPreprocess( TQTextCodec* pEncoding, bool bAutoDetectUnic
#ifdef _WIN32 #ifdef _WIN32
TQString catCmd = "type"; TQString catCmd = "type";
fileNameIn1.tqreplace( '/', "\\" ); fileNameIn1.replace( '/', "\\" );
#else #else
TQString catCmd = "cat"; TQString catCmd = "cat";
#endif #endif

@ -1250,7 +1250,7 @@ bool DiffTextWindow::findString( const TQString& s, int& d3vLine, int& posInLine
TQString line = d->getString( it ); TQString line = d->getString( it );
if ( !line.isEmpty() ) if ( !line.isEmpty() )
{ {
int pos = line.tqfind( s, startPos, bCaseSensitive ); int pos = line.find( s, startPos, bCaseSensitive );
if ( pos != -1 ) if ( pos != -1 )
{ {
d3vLine = it; d3vLine = it;
@ -1427,7 +1427,7 @@ int wordWrap( const TQString& origLine, int nofColumns, Diff3WrapLine* pDiff3Wra
} }
else else
{ {
int wsPos = max2( origLine.tqfindRev( ' ', wrapPos ), origLine.tqfindRev( '\t', wrapPos ) ); int wsPos = max2( origLine.findRev( ' ', wrapPos ), origLine.findRev( '\t', wrapPos ) );
if ( wsPos > pos ) if ( wsPos > pos )
{ {

@ -1249,7 +1249,7 @@ void DirectoryMergeWindow::prepareListView( ProgressProxy& pp )
// continue; // continue;
// Get dirname from fileName: Search for "/" from end: // Get dirname from fileName: Search for "/" from end:
int pos = fileName.tqfindRev('/'); int pos = fileName.findRev('/');
TQString dirPart; TQString dirPart;
TQString filePart; TQString filePart;
if (pos==-1) if (pos==-1)
@ -2481,7 +2481,7 @@ bool DirectoryMergeWindow::mergeFLD( const TQString& nameA,const TQString& nameB
} }
// Make sure that the dir exists, into which we will save the file later. // Make sure that the dir exists, into which we will save the file later.
int pos=nameDest.tqfindRev('/'); int pos=nameDest.findRev('/');
if ( pos>0 ) if ( pos>0 )
{ {
TQString parentName = nameDest.left(pos); TQString parentName = nameDest.left(pos);
@ -2554,7 +2554,7 @@ bool DirectoryMergeWindow::copyFLD( const TQString& srcName, const TQString& des
return bSuccess; return bSuccess;
} }
int pos=destName.tqfindRev('/'); int pos=destName.findRev('/');
if ( pos>0 ) if ( pos>0 )
{ {
TQString parentName = destName.left(pos); TQString parentName = destName.left(pos);
@ -2628,7 +2628,7 @@ bool DirectoryMergeWindow::makeDir( const TQString& name, bool bQuiet )
} }
} }
int pos=name.tqfindRev('/'); int pos=name.findRev('/');
if ( pos>0 ) if ( pos>0 )
{ {
TQString parentName = name.left(pos); TQString parentName = name.left(pos);

@ -151,7 +151,7 @@ void FileAccess::setFile( const TQString& name, bool bWantToWrite )
m_url.setPath( m_absFilePath ); m_url.setPath( m_absFilePath );
} }
if ( !m_bExists && m_absFilePath.tqcontains("@@") ) if ( !m_bExists && m_absFilePath.contains("@@") )
{ {
// Try reading a clearcase file // Try reading a clearcase file
m_localCopy = FileAccess::tempFileName(); m_localCopy = FileAccess::tempFileName();
@ -294,7 +294,7 @@ void FileAccess::setUdsEntry( const KIO::UDSEntry& e )
m_bSymLink = !m_linkTarget.isEmpty(); m_bSymLink = !m_linkTarget.isEmpty();
if ( m_name.isEmpty() ) if ( m_name.isEmpty() )
{ {
int pos = m_path.tqfindRev('/') + 1; int pos = m_path.findRev('/') + 1;
m_name = m_path.mid( pos ); m_name = m_path.mid( pos );
} }
m_bHidden = m_name[0]=='.'; m_bHidden = m_name[0]=='.';
@ -1048,7 +1048,7 @@ void CvsIgnoreList::addEntriesFromString(const TQString& str)
{ {
int posLast(0); int posLast(0);
int pos; int pos;
while ((pos = str.tqfind(' ', posLast)) >= 0) while ((pos = str.find(' ', posLast)) >= 0)
{ {
if (pos > posLast) if (pos > posLast)
addEntry(str.mid(posLast, pos - posLast)); addEntry(str.mid(posLast, pos - posLast));
@ -1132,7 +1132,7 @@ void CvsIgnoreList::addEntry(const TQString& pattern)
bool CvsIgnoreList::matches(const TQString& text, bool bCaseSensitive ) const bool CvsIgnoreList::matches(const TQString& text, bool bCaseSensitive ) const
{ {
if (m_exactPatterns.tqfind(text) != m_exactPatterns.end()) if (m_exactPatterns.find(text) != m_exactPatterns.end())
{ {
return true; return true;
} }

@ -535,7 +535,7 @@ void GnuDiff::discard_confusing_lines (struct file_data filevec[])
discards[i + j] = 0; discards[i + j] = 0;
/* Scan from beginning of run /* Scan from beginning of run
until we tqfind 3 or more nonprovisionals in a row until we find 3 or more nonprovisionals in a row
or until the first nonprovisional at least 8 lines in. or until the first nonprovisional at least 8 lines in.
Until that point, cancel any provisionals. */ Until that point, cancel any provisionals. */
for (j = 0, consec = 0; j < length; j++) for (j = 0, consec = 0; j < length; j++)

@ -34,7 +34,7 @@
class GnuDiff class GnuDiff
{ {
public: public:
/* What kind of changes a hunk tqcontains. */ /* What kind of changes a hunk contains. */
enum changes enum changes
{ {
/* No changes: lines common to both files. */ /* No changes: lines common to both files. */

@ -114,7 +114,7 @@ static void getNameAndVersion( const TQString& str, const TQString& lineStart, T
--pos2; --pos2;
} }
int vpos = str.tqfindRev("\t", -1); int vpos = str.findRev("\t", -1);
if ( vpos>0 && vpos>(int)pos2 ) if ( vpos>0 && vpos>(int)pos2 )
{ {
version = str.mid( vpos+1 ); version = str.mid( vpos+1 );

@ -708,10 +708,10 @@ KAction* KStdAction::help( TQWidget* tqparent, const char* slot, KActionCollecti
if(p) a->addTo( p->helpMenu ); if(p) a->addTo( p->helpMenu );
return a; return a;
} }
KAction* KStdAction::tqfind( TQWidget* tqparent, const char* slot, KActionCollection* actionCollection) KAction* KStdAction::find( TQWidget* tqparent, const char* slot, KActionCollection* actionCollection)
{ {
KMainWindow* p = actionCollection->m_pMainWindow; KMainWindow* p = actionCollection->m_pMainWindow;
KAction* a = new KAction( i18n("Find"), TQt::CTRL+TQt::Key_F, tqparent, slot, actionCollection, "tqfind", false, false ); KAction* a = new KAction( i18n("Find"), TQt::CTRL+TQt::Key_F, tqparent, slot, actionCollection, "find", false, false );
if(p) a->addTo( p->editMenu ); if(p) a->addTo( p->editMenu );
return a; return a;
} }
@ -1021,7 +1021,7 @@ KApplication::KApplication()
{ {
if ( s_argv[i][0]=='-' ) // An option if ( s_argv[i][0]=='-' ) // An option
{ {
if ( ignorableCmdLineOptions.tqcontains(TQString(s_argv[i])+";") ) if ( ignorableCmdLineOptions.contains(TQString(s_argv[i])+";") )
continue; continue;
// Find the option // Find the option
int j=0; int j=0;

@ -259,7 +259,7 @@ public:
static KAction* about( TQWidget* tqparent, const char* slot, KActionCollection* ); static KAction* about( TQWidget* tqparent, const char* slot, KActionCollection* );
static KAction* aboutTQt( KActionCollection* ); static KAction* aboutTQt( KActionCollection* );
static KAction* help( TQWidget* tqparent, const char* slot, KActionCollection* ); static KAction* help( TQWidget* tqparent, const char* slot, KActionCollection* );
static KAction* tqfind( TQWidget* tqparent, const char* slot, KActionCollection* ); static KAction* find( TQWidget* tqparent, const char* slot, KActionCollection* );
static KAction* findNext( TQWidget* tqparent, const char* slot, KActionCollection* ); static KAction* findNext( TQWidget* tqparent, const char* slot, KActionCollection* );
static KAction* keyBindings( TQWidget* tqparent, const char* slot, KActionCollection* ); static KAction* keyBindings( TQWidget* tqparent, const char* slot, KActionCollection* );
}; };

@ -75,7 +75,7 @@ void initialiseCmdLineArgs(std::vector<KCmdLineOptions>& vOptions, TQStringList&
TQString line = ts.readLine(); TQString line = ts.readLine();
if ( line.startsWith("IgnorableCmdLineOptions=") ) if ( line.startsWith("IgnorableCmdLineOptions=") )
{ {
int pos = line.tqfind('='); int pos = line.find('=');
if (pos>=0) if (pos>=0)
{ {
TQString s = line.mid(pos+1); TQString s = line.mid(pos+1);
@ -201,7 +201,7 @@ int main(int argc, char *argv[])
TQString locale; TQString locale;
locale = app.config()->readEntry("Language", "Auto"); locale = app.config()->readEntry("Language", "Auto");
int spacePos = locale.tqfind(' '); int spacePos = locale.find(' ');
if (spacePos>0) locale = locale.left(spacePos); if (spacePos>0) locale = locale.left(spacePos);
TQTranslator kdiff3Translator( 0 ); TQTranslator kdiff3Translator( 0 );
TQTranslator qtTranslator( 0 ); TQTranslator qtTranslator( 0 );

@ -1090,7 +1090,7 @@ TQString calcHistorySortKey( const TQString& keyOrder, TQRegExp& matchedRegExpr,
} }
TQString groupRegExp = parenthesesGroupList[groupIdx-1]; TQString groupRegExp = parenthesesGroupList[groupIdx-1];
if( groupRegExp.tqfind('|')<0 || groupRegExp.tqfind('(')>=0 ) if( groupRegExp.find('|')<0 || groupRegExp.find('(')>=0 )
{ {
bool bOk = false; bool bOk = false;
int i = s.toInt( &bOk ); int i = s.toInt( &bOk );
@ -1104,7 +1104,7 @@ TQString calcHistorySortKey( const TQString& keyOrder, TQRegExp& matchedRegExpr,
// s is the string that managed to match. // s is the string that managed to match.
// Now we want to know at which position it occurred. e.g. Jan=0, Feb=1, Mar=2, etc. // Now we want to know at which position it occurred. e.g. Jan=0, Feb=1, Mar=2, etc.
TQStringList sl = TQStringList::split( '|', groupRegExp ); TQStringList sl = TQStringList::split( '|', groupRegExp );
int idx = sl.tqfindIndex( s ); int idx = sl.findIndex( s );
if (idx<0) if (idx<0)
{ {
// Didn't match // Didn't match
@ -2337,7 +2337,7 @@ void MergeResultWindow::keyPressEvent( TQKeyEvent* e )
if ( m_bInsertMode ) if ( m_bInsertMode )
s.insert( x, t ); s.insert( x, t );
else else
s.tqreplace( x, t.length(), t ); s.replace( x, t.length(), t );
melIt->setString( s ); melIt->setString( s );
x += t.length(); x += t.length();
@ -2758,7 +2758,7 @@ bool MergeResultWindow::findString( const TQString& s, int& d3vLine, int& posInL
TQString line = getString( it ); TQString line = getString( it );
if ( !line.isEmpty() ) if ( !line.isEmpty() )
{ {
int pos = line.tqfind( s, startPos, bCaseSensitive ); int pos = line.find( s, startPos, bCaseSensitive );
if ( pos != -1 ) if ( pos != -1 )
{ {
d3vLine = it; d3vLine = it;

@ -918,7 +918,7 @@ void OptionDialog::setupMergePage( void )
++line; ++line;
//TQString branch = newHistoryEntry.cap(1); //TQString branch = newHistoryEntry.cap(1);
//int day = newHistoryEntry.cap(2).toInt(); //int day = newHistoryEntry.cap(2).toInt();
//int month = TQString("Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec").tqfind(newHistoryEntry.cap(3))/4 + 1; //int month = TQString("Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec").find(newHistoryEntry.cap(3))/4 + 1;
//int year = newHistoryEntry.cap(4).toInt(); //int year = newHistoryEntry.cap(4).toInt();
//TQString time = newHistoryEntry.cap(5); //TQString time = newHistoryEntry.cap(5);
//TQString name = newHistoryEntry.cap(6); //TQString name = newHistoryEntry.cap(6);
@ -1584,7 +1584,7 @@ void OptionDialog::slotApply( void )
TQString locale = m_language; TQString locale = m_language;
if ( locale == "Auto" || locale.isEmpty() ) if ( locale == "Auto" || locale.isEmpty() )
locale = locale = TQTextCodec::locale(); locale = locale = TQTextCodec::locale();
int spacePos = locale.tqfind(' '); int spacePos = locale.find(' ');
if (spacePos>0) locale = locale.left(spacePos); if (spacePos>0) locale = locale.left(spacePos);
TQSettings settings; TQSettings settings;
settings.setPath("KDiff3", "diff-ext", TQSettings::User ); settings.setPath("KDiff3", "diff-ext", TQSettings::User );
@ -1694,7 +1694,7 @@ TQString OptionDialog::parseOptions( const QCStringList& optionList )
{ {
TQString s = *i; TQString s = *i;
int pos = s.tqfind('='); int pos = s.find('=');
if( pos > 0 ) // seems not to have a tag if( pos > 0 ) // seems not to have a tag
{ {
TQString key = s.left(pos); TQString key = s.left(pos);

@ -465,11 +465,11 @@ void KDiff3App::init( bool bAuto, TotalDifftqStatus* pTotalDifftqStatus, bool bL
TQString a3 = m_sd3.getAliasName(); TQString a3 = m_sd3.getAliasName();
TQString f1, f2, f3; TQString f1, f2, f3;
int p1,p2,p3; int p1,p2,p3;
if ( !a1.isEmpty() && (p1=a1.tqfindRev('/'))>=0 ) if ( !a1.isEmpty() && (p1=a1.findRev('/'))>=0 )
f1 = a1.mid( p1+1 ); f1 = a1.mid( p1+1 );
if ( !a2.isEmpty() && (p2=a2.tqfindRev('/'))>=0 ) if ( !a2.isEmpty() && (p2=a2.findRev('/'))>=0 )
f2 = a2.mid( p2+1 ); f2 = a2.mid( p2+1 );
if ( !a3.isEmpty() && (p3=a3.tqfindRev('/'))>=0 ) if ( !a3.isEmpty() && (p3=a3.findRev('/'))>=0 )
f3 = a3.mid( p3+1 ); f3 = a3.mid( p3+1 );
if ( !f1.isEmpty() ) if ( !f1.isEmpty() )
{ {

@ -256,10 +256,10 @@ static void fixCurrentText( TQComboBox* pCB )
{ {
TQString s = pCB->currentText(); TQString s = pCB->currentText();
int pos = s.tqfind( '\n' ); int pos = s.find( '\n' );
if ( pos>=0 ) if ( pos>=0 )
s=s.left(pos); s=s.left(pos);
pos = s.tqfind( '\r' ); pos = s.find( '\r' );
if ( pos>=0 ) if ( pos>=0 )
s=s.left(pos); s=s.left(pos);

Loading…
Cancel
Save