summaryrefslogtreecommitdiffstats
path: root/poxml/parser.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
commit0813b39aed2cf4c84157a22c4c9594336d93d412 (patch)
tree0f6157f9c9ecc6ed26cb98f058219a8021d3f4a6 /poxml/parser.cpp
parent35dc58791106d7a1864264063df5f3ee3f1f0f15 (diff)
downloadtdesdk-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/parser.cpp')
-rw-r--r--poxml/parser.cpp100
1 files changed, 50 insertions, 50 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);