diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
commit | 4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch) | |
tree | b0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbabel/common/diff.cpp | |
parent | 1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff) | |
download | tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbabel/common/diff.cpp')
-rw-r--r-- | kbabel/common/diff.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/kbabel/common/diff.cpp b/kbabel/common/diff.cpp index 7a54e4d3..455a26f1 100644 --- a/kbabel/common/diff.cpp +++ b/kbabel/common/diff.cpp @@ -37,7 +37,7 @@ #include <kdebug.h> -LCSprinter::LCSprinter(const QStringList &s_1, const QStringList &s_2, QValueVector<LCSMarker> *b_, const uint nT_, uint index):s1(s_1),s2(s_2),b(b_),nT(nT_) +LCSprinter::LCSprinter(const TQStringList &s_1, const TQStringList &s_2, TQValueVector<LCSMarker> *b_, const uint nT_, uint index):s1(s_1),s2(s_2),b(b_),nT(nT_) { it1=s1.begin(); it2=s2.begin(); @@ -93,24 +93,24 @@ void LCSprinter::printLCS(uint index) -QString wordDiff(const QString& str1, const QString& str2) +TQString wordDiff(const TQString& str1, const TQString& str2) { //separate punctuation marks etc from words as _only_ they may have changed - QStringList s1, s2; + TQStringList s1, s2; uint i=0; uint j=0; uint l1=str1.length(); uint l2=str2.length(); - QString temp; + TQString temp; temp.reserve(16); /* while ( i<l1 ) { - if (str1[i]==QChar(0x003C) && (str1[i+1]==QChar(0x002F) || str1[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" + if (str1[i]==TQChar(0x003C) && (str1[i+1]==TQChar(0x002F) || str1[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" {// skip tag - while(i<l1 && str1[i]!=QChar(0x003E)) temp += str1[i++]; - if (i++ <l1) temp += QChar(0x003E); + while(i<l1 && str1[i]!=TQChar(0x003E)) temp += str1[i++]; + if (i++ <l1) temp += TQChar(0x003E); s1.append(temp); temp.truncate(0); } @@ -125,15 +125,15 @@ QString wordDiff(const QString& str1, const QString& str2) temp.truncate(0); }; - if (str1[i]==QChar(0x003C) && (str1[i+1]==QChar(0x002F) || str1[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" + if (str1[i]==TQChar(0x003C) && (str1[i+1]==TQChar(0x002F) || str1[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" {// skip tag - while(i<l1 && str1[i]!=QChar(0x003E)) temp += str1[i++]; - if (i++ <l1) temp += QChar(0x003E); + while(i<l1 && str1[i]!=TQChar(0x003E)) temp += str1[i++]; + if (i++ <l1) temp += TQChar(0x003E); s1.append(temp); temp.truncate(0); } - while ( i<l1 && !(str1[i].isLetter() || str1[i]==QChar(0x003C)) ) + while ( i<l1 && !(str1[i].isLetter() || str1[i]==TQChar(0x003C)) ) { temp += str1[i++]; } @@ -147,10 +147,10 @@ QString wordDiff(const QString& str1, const QString& str2) i=0; while ( i<l2 ) { - if (str2[i]==QChar(0x003C) && (str2[i+1]==QChar(0x002F) || str2[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" + if (str2[i]==TQChar(0x003C) && (str2[i+1]==TQChar(0x002F) || str2[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" {// skip tag - while(i<l2 && str2[i]!=QChar(0x003E)) temp += str2[i++]; - if (i++ <l2) temp += QChar(0x003E); + while(i<l2 && str2[i]!=TQChar(0x003E)) temp += str2[i++]; + if (i++ <l2) temp += TQChar(0x003E); s2.append(temp); temp.truncate(0); } @@ -165,15 +165,15 @@ QString wordDiff(const QString& str1, const QString& str2) temp.truncate(0); }; //FIXME bounds - if (str2[i]==QChar(0x003C) && (str2[i+1]==QChar(0x002F) || str2[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" + if (str2[i]==TQChar(0x003C) && (str2[i+1]==TQChar(0x002F) || str2[i+1].isLetter()) ) // 0x003C="<", 0x002F="/" {// skip tag - while(i<l2 && str2[i]!=QChar(0x003E)) temp += str2[i++]; - if (i++ <l2) temp += QChar(0x003E); + while(i<l2 && str2[i]!=TQChar(0x003E)) temp += str2[i++]; + if (i++ <l2) temp += TQChar(0x003E); s2.append(temp); temp.truncate(0); } - while ( i<l2 && !(str2[i].isLetter() || str2[i]==QChar(0x003C)) ) + while ( i<l2 && !(str2[i].isLetter() || str2[i]==TQChar(0x003C)) ) { temp += str2[i++]; } @@ -199,7 +199,7 @@ QString wordDiff(const QString& str1, const QString& str2) while ( i<l1 && !str1[i].isLetter() ) { - s1.append(QString(str1[i++])); + s1.append(TQString(str1[i++])); } } @@ -218,7 +218,7 @@ QString wordDiff(const QString& str1, const QString& str2) while ( i<l2 && !str2[i].isLetter() ) { - s2.append(QString(str2[i++])); + s2.append(TQString(str2[i++])); } } @@ -228,14 +228,14 @@ QString wordDiff(const QString& str1, const QString& str2) uint mT = mX+1; uint nT = nY+1; - QValueVector<LCSMarker> b(mT*nT, NOTHING); - QValueVector<uint> c(mT*nT, 0); + TQValueVector<LCSMarker> b(mT*nT, NOTHING); + TQValueVector<uint> c(mT*nT, 0); // calculate the LCS b[0] = FINAL; uint index_cache; - QStringList::iterator it1, it2; + TQStringList::iterator it1, it2; for (i=1, it1 = s1.begin(); i<mT; ++i, ++it1) { @@ -295,7 +295,7 @@ QString wordDiff(const QString& str1, const QString& str2) /* // old algorithm by Wolfram Diestel <wolfram@steloj.de> -QString Diff::charDiff(QString s1, QString s2) +TQString Diff::charDiff(TQString s1, TQString s2) { int n = 3; s1+="xxx"; @@ -305,7 +305,7 @@ QString Diff::charDiff(QString s1, QString s2) int pos2=0; int len1 = s1.length(); int len2 = s2.length(); - QString resultstr; + TQString resultstr; bool found = true; bool swap = false; while (found && pos1+n < len1 && pos2+n < len2) @@ -346,7 +346,7 @@ QString Diff::charDiff(QString s1, QString s2) pos1 = pos2; pos2 = pos; - QString s = s1; + TQString s = s1; s1 = s2; s2 = s; @@ -375,7 +375,7 @@ QString Diff::charDiff(QString s1, QString s2) pos1 = pos2; pos2 = pos; - QString s = s1; + TQString s = s1; s1 = s2; s2 = s; @@ -427,7 +427,7 @@ QString Diff::charDiff(QString s1, QString s2) pos1 = pos2; pos2 = pos; - QString s = s1; + TQString s = s1; s1 = s2; s2 = s; |