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 | 0813b39aed2cf4c84157a22c4c9594336d93d412 (patch) | |
tree | 0f6157f9c9ecc6ed26cb98f058219a8021d3f4a6 /poxml | |
parent | 35dc58791106d7a1864264063df5f3ee3f1f0f15 (diff) | |
download | tdesdk-0813b39aed2cf4c84157a22c4c9594336d93d412.tar.gz tdesdk-0813b39aed2cf4c84157a22c4c9594336d93d412.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'poxml')
-rw-r--r-- | poxml/parser.cpp | 100 | ||||
-rw-r--r-- | poxml/po2xml.cpp | 26 | ||||
-rw-r--r-- | poxml/split.cpp | 8 | ||||
-rw-r--r-- | poxml/transxx.cpp | 10 | ||||
-rw-r--r-- | poxml/xml2pot.cpp | 2 |
5 files changed, 73 insertions, 73 deletions
diff --git a/poxml/parser.cpp b/poxml/parser.cpp index 80810eeb..b4f0161b 100644 --- a/poxml/parser.cpp +++ b/poxml/parser.cpp @@ -180,8 +180,8 @@ bool StructureParser::closureTag(const TQString& message, const TQString &tag) uint index = 0; while (true) { - int nextclose = message.tqfind(TQRegExp(TQString::tqfromLatin1("</%1[\\s>]").tqarg(tag)), index); - int nextstart = message.tqfind(TQRegExp(TQString::tqfromLatin1("<%1[>\\s]").tqarg(tag)), index); + int nextclose = message.find(TQRegExp(TQString::tqfromLatin1("</%1[\\s>]").tqarg(tag)), index); + int nextstart = message.find(TQRegExp(TQString::tqfromLatin1("<%1[>\\s]").tqarg(tag)), index); // qDebug("finding %d %d %d %d", nextstart, nextclose, index, inside); if (nextclose == -1) { #ifdef POXML_DEBUG @@ -254,7 +254,7 @@ void StructureParser::descape(TQString &message) index++; } - message.tqreplace(TQRegExp("\010"), ""); + message.replace(TQRegExp("\010"), ""); } bool StructureParser::formatMessage(MsgBlock &msg) const @@ -327,8 +327,8 @@ bool StructureParser::formatMessage(MsgBlock &msg) const TQString orig = msg.msgid; TQString endtag = msg.msgid.mid(endindex + 2, msg.msgid.length() - (endindex + 2) - 1); - TQString endtag_attr = endtag.mid(endtag.tqfind(' '), endtag.length()); - endtag.tqreplace(infos_reg, ""); + TQString endtag_attr = endtag.mid(endtag.find(' '), endtag.length()); + endtag.replace(infos_reg, ""); if (endtag == starttag) { if (!closureTag(msg.msgid, starttag)) break; @@ -418,9 +418,9 @@ MsgList StructureParser::splitMessage(const MsgBlock &mb) #endif // the exception for poxml_* attributes is made in the closing tag - int closing_index = message.tqfind(TQRegExp(TQString::tqfromLatin1("</%1[\\s>]").tqarg(tag)), + int closing_index = message.find(TQRegExp(TQString::tqfromLatin1("</%1[\\s>]").tqarg(tag)), strindex); - int starting_index = message.tqfind(TQRegExp(TQString::tqfromLatin1("<%1[\\s>]").tqarg(tag)), + int starting_index = message.find(TQRegExp(TQString::tqfromLatin1("<%1[\\s>]").tqarg(tag)), strindex); #ifdef POXML_DEBUG @@ -510,8 +510,8 @@ MsgList StructureParser::splitMessage(const MsgBlock &mb) while (endindex >= 0 && (message.at(endindex) != '<' || message.at(endindex + 1) != '/')) endindex--; TQString tag = message.mid(endindex + 2, message.length() - endindex - 3); - if (tag.tqfind(' ') > 0 ) { - tag = tag.left(tag.tqfind(' ')); + if (tag.find(' ') > 0 ) { + tag = tag.left(tag.find(' ')); } #ifdef POXML_DEBUG qDebug("behind tag %s", tag.latin1()); @@ -529,9 +529,9 @@ MsgList StructureParser::splitMessage(const MsgBlock &mb) qDebug("inside %s %d", message.mid(strindex, 35).latin1(), inside); #endif - int closing_index = message.tqfindRev(TQRegExp(TQString::tqfromLatin1("</%1[\\s>]").tqarg(tag)), + int closing_index = message.findRev(TQRegExp(TQString::tqfromLatin1("</%1[\\s>]").tqarg(tag)), strindex - 1); - int starting_index = message.tqfindRev(TQRegExp(TQString::tqfromLatin1("<%1[\\s>]").tqarg(tag)), + int starting_index = message.findRev(TQRegExp(TQString::tqfromLatin1("<%1[\\s>]").tqarg(tag)), strindex - 1); #ifdef POXML_DEBUG @@ -640,7 +640,7 @@ bool StructureParser::endElement( const TQString& , const TQString&, const TQStr (*it).lines.first().offset = 0; } } - (*it).msgid.tqreplace(infos_reg, TQString()); + (*it).msgid.replace(infos_reg, TQString()); if (!(*it).msgid.isEmpty()) list.append(*it); @@ -663,11 +663,11 @@ bool StructureParser::comment ( const TQString &c ) TQString StructureParser::escapeLiterals( const TQString &_contents) { TQString contents = _contents; - contents.tqreplace(TQRegExp("\n"), "&POXML_LINEFEED;"); - contents.tqreplace(TQRegExp("<"), "&POXML_LT;"); - contents.tqreplace(TQRegExp(">"), "&POXML_GT;"); - contents.tqreplace(TQRegExp("\t"), " "); - contents.tqreplace(TQRegExp(" "), "&POXML_SPACE;"); + contents.replace(TQRegExp("\n"), "&POXML_LINEFEED;"); + contents.replace(TQRegExp("<"), "&POXML_LT;"); + contents.replace(TQRegExp(">"), "&POXML_GT;"); + contents.replace(TQRegExp("\t"), " "); + contents.replace(TQRegExp(" "), "&POXML_SPACE;"); return contents; } @@ -675,11 +675,11 @@ TQString StructureParser::escapeLiterals( const TQString &_contents) { TQString StructureParser::descapeLiterals( const TQString &_contents) { TQString contents = _contents; - contents.tqreplace(TQRegExp("&POXML_LINEFEED;"), "\n"); - contents.tqreplace(TQRegExp("&POXML_LT;"), "<"); - contents.tqreplace(TQRegExp("&POXML_GT;"), ">"); - contents.tqreplace(TQRegExp("&POXML_SPACE;"), " "); - contents.tqreplace(TQRegExp("!POXML_AMP!"), "&"); + contents.replace(TQRegExp("&POXML_LINEFEED;"), "\n"); + contents.replace(TQRegExp("&POXML_LT;"), "<"); + contents.replace(TQRegExp("&POXML_GT;"), ">"); + contents.replace(TQRegExp("&POXML_SPACE;"), " "); + contents.replace(TQRegExp("!POXML_AMP!"), "&"); return contents; } @@ -710,23 +710,23 @@ void StructureParser::stripWhiteSpace( TQString &contents) void StructureParser::cleanupTags( TQString &contents ) { - contents.tqreplace(TQRegExp("&"), "!POXML_AMP!"); + contents.replace(TQRegExp("&"), "!POXML_AMP!"); for (int index = 0; literaltags[index]; index++) { TQRegExp start(TQString("<%1[\\s>]").tqarg(literaltags[index])); TQRegExp end(TQString("</%1[\\s>]").tqarg(literaltags[index])); int strindex = 0; while (true) { - strindex = contents.tqfind(start, strindex); + strindex = contents.find(start, strindex); if (strindex < 0) break; while (contents.at(strindex) != '>') strindex++; strindex++; // one more - int endindex = contents.tqfind(end, strindex); + int endindex = contents.find(end, strindex); TQString part = contents.mid(strindex, endindex - strindex); TQString newpart = escapeLiterals(part); - contents.tqreplace(strindex, part.length(), newpart); + contents.replace(strindex, part.length(), newpart); // this assumes that literal tags to not overlap strindex = strindex + newpart.length(); } @@ -739,7 +739,7 @@ void StructureParser::cleanupTags( TQString &contents ) if (index < 0) break; TQString tag = unclosed.cap(1); - contents.tqreplace(index, unclosed.matchedLength(), TQString("</%1>").tqarg(tag)); + contents.replace(index, unclosed.matchedLength(), TQString("</%1>").tqarg(tag)); } TQRegExp start("<((\\s*[^<>\\s])*)\\s\\s*(/*)>"); @@ -753,7 +753,7 @@ void StructureParser::cleanupTags( TQString &contents ) TQString tag = start.cap(1); TQString cut = start.capturedTexts().last(); // qDebug("UNCLO %s %d -%s- -%s-", start.cap(0).latin1(), index, tag.latin1(), cut.latin1()); - contents.tqreplace(index, start.matchedLength(), TQString("<%1%2>").tqarg(tag).tqarg(cut)); + contents.replace(index, start.matchedLength(), TQString("<%1%2>").tqarg(tag).tqarg(cut)); } TQRegExp singletag("<(\\w*)\\s([^><]*)/>"); @@ -764,7 +764,7 @@ void StructureParser::cleanupTags( TQString &contents ) break; TQString tag = singletag.cap(1); if (!StructureParser::isSingleTag(tag)) { - contents.tqreplace(index, singletag.matchedLength(), TQString("<%1 %2></%3>").tqarg(tag).tqarg(singletag.cap(2)).tqarg(tag)); + contents.replace(index, singletag.matchedLength(), TQString("<%1 %2></%3>").tqarg(tag).tqarg(singletag.cap(2)).tqarg(tag)); } } @@ -775,7 +775,7 @@ void StructureParser::cleanupTags( TQString &contents ) if (index < 0) break; TQString msgid = trans_comment.cap(1); - contents.tqreplace(index, trans_comment.matchedLength(), TQString("<trans_comment>%1</trans_comment>").tqarg(msgid)); + contents.replace(index, trans_comment.matchedLength(), TQString("<trans_comment>%1</trans_comment>").tqarg(msgid)); } #ifdef POXML_DEBUG @@ -791,11 +791,11 @@ static bool removeEmptyTag( TQString &contents, const TQString & tag) TQRegExp empty(TQString("<%1[^>]*>[\\s\n][\\s\n]*</%2\\s*>").tqarg(tag).tqarg(tag)); int strindex = 0; while (true) { - strindex = contents.tqfind(empty, strindex); + strindex = contents.find(empty, strindex); if (strindex < 0) break; qDebug("found empty tag %s", tag.latin1()); - contents.tqreplace(strindex, empty.matchedLength(), " "); + contents.replace(strindex, empty.matchedLength(), " "); strindex++; return true; } @@ -831,8 +831,8 @@ bool StructureParser::characters(const TQString &ch) TQString escape(TQString message) { - message.tqreplace(TQRegExp("\\\\"), "\\\\"); - message.tqreplace(TQRegExp("\""), "\\\""); + message.replace(TQRegExp("\\\\"), "\\\\"); + message.replace(TQRegExp("\""), "\\\""); return message; } @@ -871,46 +871,46 @@ TQString escapePO(TQString msgid) { int index = 0; while (true) { - index = msgid.tqfind("\\n", index); + index = msgid.find("\\n", index); if (index == -1) break; if (index >= 1 && msgid.at(index - 1) == '\\' && msgid.at(index - 2) != '\\') { - msgid.tqreplace(index - 1, 3, "&POXML_LITERALLINEFEED;"); + msgid.replace(index - 1, 3, "&POXML_LITERALLINEFEED;"); index += 3; } else - msgid.tqreplace(index, 2, "\n"); + msgid.replace(index, 2, "\n"); } index = 0; while (true) { - index = msgid.tqfind("\\\"", index); + index = msgid.find("\\\"", index); if (index == -1) break; if (index > 1 && msgid.at(index - 1) == '\\' && msgid.at(index - 2) != '\\') - msgid.tqreplace(index - 1, 3, "&POXML_LITERALTQUOTE;"); + msgid.replace(index - 1, 3, "&POXML_LITERALTQUOTE;"); else - msgid.tqreplace(index, 2, "\""); + msgid.replace(index, 2, "\""); } index = 0; while (true) { - index = msgid.tqfind("\\t", index); + index = msgid.find("\\t", index); if (index == -1) break; if (msgid.at(index - 1) == '\\') - msgid.tqreplace(index - 1, 3, "\\t"); + msgid.replace(index - 1, 3, "\\t"); else - msgid.tqreplace(index, 2, "\t"); + msgid.replace(index, 2, "\t"); } index = 0; while (true) { - index = msgid.tqfind("\\\\", index); + index = msgid.find("\\\\", index); if (index == -1) break; - msgid.tqreplace(index, 2, "\\"); + msgid.replace(index, 2, "\\"); index += 1; } - msgid.tqreplace(TQRegExp("&POXML_LITERALLINEFEED;"), "\\n"); - msgid.tqreplace(TQRegExp("&POXML_LITERALTQUOTE;"), "\\"); + msgid.replace(TQRegExp("&POXML_LITERALLINEFEED;"), "\\n"); + msgid.replace(TQRegExp("&POXML_LITERALTQUOTE;"), "\\"); return msgid; } @@ -930,7 +930,7 @@ MsgList parseXML(const char *filename) StructureParser::cleanupTags(contents); while (true) { - int index = contents.tqfind("<!ENTITY"); + int index = contents.find("<!ENTITY"); if (index < 0) break; int inside = 0; @@ -952,7 +952,7 @@ MsgList parseXML(const char *filename) endindex++; } endindex++; - contents.tqreplace(index, endindex - index, replacement); + contents.replace(index, endindex - index, replacement); } TQTextStream ts(contents.utf8(), IO_ReadOnly); @@ -975,7 +975,7 @@ MsgList parseXML(const char *filename) for (MsgList::Iterator it = english.begin(); it != english.end(); it++) { - TQMap<TQString,TQString>::Iterator found = msgids.tqfind((*it).msgid); + TQMap<TQString,TQString>::Iterator found = msgids.find((*it).msgid); if ((*it).msgid.length() < 4) { (*it).msgid = TQString("<%1>").tqarg((*it).tag) + (*it).msgid + TQString("</%1>").tqarg((*it).tag); diff --git a/poxml/po2xml.cpp b/poxml/po2xml.cpp index 314b0b5b..c30a340f 100644 --- a/poxml/po2xml.cpp +++ b/poxml/po2xml.cpp @@ -19,7 +19,7 @@ TQString translate(TQString xml, TQString orig, TQString translation) TQString prefix; while (xml.at(0) == '<' && orig.at(0) != '<') { // a XML tag as prefix - int index = xml.tqfind('>'); + int index = xml.find('>'); assert(index != -1); index++; while (xml.at(index) == ' ') @@ -28,13 +28,13 @@ TQString translate(TQString xml, TQString orig, TQString translation) xml = xml.mid(index, xml.length()); } - int index = xml.tqfind(orig); + int index = xml.find(orig); if (index == -1) { - qWarning("can't tqfind\n%s\nin\n%s", orig.latin1(), xml.latin1()); + qWarning("can't find\n%s\nin\n%s", orig.latin1(), xml.latin1()); exit(1); } if (!translation.isEmpty()) - xml.tqreplace(index, orig.length(), translation); + xml.replace(index, orig.length(), translation); return prefix + xml; } @@ -65,7 +65,7 @@ int main( int argc, char **argv ) { TQString msgstr; TQString msgid = escapePO((*it).msgid); - if ((*it).comment.tqfind("fuzzy") < 0) + if ((*it).comment.find("fuzzy") < 0) msgstr = escapePO((*it).msgstr); #ifdef POXML_DEBUG @@ -88,7 +88,7 @@ int main( int argc, char **argv ) line_offsets.append(0); int index = 0; while (true) { - index = xml_text.tqfind('\n', index) + 1; + index = xml_text.find('\n', index) + 1; if (index <= 0) break; line_offsets.append(index); @@ -137,7 +137,7 @@ int main( int argc, char **argv ) TQString xml = xml_text.mid(start_pos, end_pos - start_pos); int index = 0; while (true) { - index = xml.tqfind("<!--"); + index = xml.find("<!--"); if (index == -1) break; int end_index = index + 4; @@ -147,13 +147,13 @@ int main( int argc, char **argv ) { end_index++; } - xml.tqreplace(index, end_index + 1 - index, " "); + xml.replace(index, end_index + 1 - index, " "); index = end_index; } StructureParser::descape(xml); TQString descaped = StructureParser::descapeLiterals((*it).msgid); - if (translations.tqcontains(descaped)) + if (translations.contains(descaped)) descaped = translations[descaped]; #ifdef POXML_DEBUG @@ -236,21 +236,21 @@ int main( int argc, char **argv ) ts << xml_text.mid(old_pos); - output.tqreplace(TQRegExp("<trans_comment\\s*>"), ""); - output.tqreplace(TQRegExp("</trans_comment\\s*>"), ""); + output.replace(TQRegExp("<trans_comment\\s*>"), ""); + output.replace(TQRegExp("</trans_comment\\s*>"), ""); StructureParser::removeEmptyTags(output); index = 0; while (true) { - index = output.tqfind(TQRegExp(">[^\n]"), index ); + index = output.find(TQRegExp(">[^\n]"), index ); if ( index == -1 ) break; if ( output.at( index - 1 ) == '/' || output.at( index - 1 ) == '-' || output.at( index - 1 ) == ']' || output.at( index - 1 ) == '?' ) index = index + 1; else { - output.tqreplace( index, 1, "\n>" ); + output.replace( index, 1, "\n>" ); index = index + 2; } } diff --git a/poxml/split.cpp b/poxml/split.cpp index fa8faab1..db20f15f 100644 --- a/poxml/split.cpp +++ b/poxml/split.cpp @@ -36,7 +36,7 @@ int main( int argc, char **argv ) if (report_mismatches && errors.count()) { for (TQMap<int, TQString>::ConstIterator it = errors.begin(); it != errors.end(); ++it) { - if (translated.pc.anchors.tqcontains(it.data())) + if (translated.pc.anchors.contains(it.data())) fprintf(stderr, "id=\"%s\" not in the same paragraphs (%d vs %d)\n", it.data().latin1(), english.pc.anchors[it.data()], translated.pc.anchors[it.data()]); else { @@ -65,7 +65,7 @@ int main( int argc, char **argv ) it != english.end(); ) { if ((*it).msgid == "ROLES_OF_TRANSLATORS") { - if ((*it).msgstr.length() && !(*it).msgstr.tqcontains("ROLES_OF_TRANSLATORS")) { + if ((*it).msgstr.length() && !(*it).msgstr.contains("ROLES_OF_TRANSLATORS")) { have_roles_of_translators = true; } else { @@ -77,7 +77,7 @@ int main( int argc, char **argv ) } if ((*it).msgid == "CREDIT_FOR_TRANSLATORS") { - if ((*it).msgstr.length() && !(*it).msgstr.tqcontains("CREDIT_FOR_TRANSLATORS")) { + if ((*it).msgstr.length() && !(*it).msgstr.contains("CREDIT_FOR_TRANSLATORS")) { have_credit_for_translators = true; } else { @@ -88,7 +88,7 @@ int main( int argc, char **argv ) continue; } - if (msgids.tqcontains((*it).msgid)) { + if (msgids.contains((*it).msgid)) { english[msgids[(*it).msgid]].lines += (*it).lines; if (english[msgids[(*it).msgid]].msgstr != (*it).msgstr) { fprintf(stderr, "two different translations for \"%s\" (\"%s\" and \"%s\") - choosing first one\n", diff --git a/poxml/transxx.cpp b/poxml/transxx.cpp index 92004372..864259da 100644 --- a/poxml/transxx.cpp +++ b/poxml/transxx.cpp @@ -42,7 +42,7 @@ int main(int argc, char **argv) return 1; } - const bool is_desktop = filename.tqfind( "desktop_") >= 0; + const bool is_desktop = filename.find( "desktop_") >= 0; // The header is the last item (due too the sorting) MsgList::const_iterator header = --translated.end(); @@ -85,22 +85,22 @@ int main(int argc, char **argv) TQString msgstr; - if ( msgid.tqfind( "Definition of PluralForm" ) != -1 ) { + if ( msgid.find( "Definition of PluralForm" ) != -1 ) { outputMsg("msgstr", "NoPlural"); cout << "\n"; continue; } if ( is_desktop ) { - msgstr = msgid.left( msgid.tqfind( '=' ) + 1); - msgstr += translation + msgid.mid( msgid.tqfind( '=' ) + 1) + translation; + msgstr = msgid.left( msgid.find( '=' ) + 1); + msgstr += translation + msgid.mid( msgid.find( '=' ) + 1) + translation; outputMsg( "msgstr", escapePO(msgstr) ); cout << "\n"; continue; } if (msgid.startsWith("_n: ") || msgid.startsWith("_: ") ) { // KDE extentions - msgid = msgid.mid(msgid.tqfind("\\n") + 2, msgid.length()); + msgid = msgid.mid(msgid.find("\\n") + 2, msgid.length()); } if (msgid.endsWith("%")) diff --git a/poxml/xml2pot.cpp b/poxml/xml2pot.cpp index d73542d7..e98c1c5f 100644 --- a/poxml/xml2pot.cpp +++ b/poxml/xml2pot.cpp @@ -21,7 +21,7 @@ int main( int argc, char **argv ) for (MsgList::Iterator it = english.begin(); it != english.end(); ) { - if (msgids.tqcontains((*it).msgid)) { + if (msgids.contains((*it).msgid)) { english[msgids[(*it).msgid]].lines += (*it).lines; MsgList::Iterator tmp = it; it++; |