From 4ae0c208b66e0f7954e194384464fe2d0a2c56dd Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:51:49 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- poxml/GettextParser.cpp | 14 ++-- poxml/parser.cpp | 214 ++++++++++++++++++++++++------------------------ poxml/parser.h | 80 +++++++++--------- poxml/po2xml.cpp | 40 ++++----- poxml/split.cpp | 14 ++-- poxml/transxx.cpp | 38 ++++----- poxml/xml2pot.cpp | 12 +-- 7 files changed, 206 insertions(+), 206 deletions(-) (limited to 'poxml') diff --git a/poxml/GettextParser.cpp b/poxml/GettextParser.cpp index 90651eaa..fda1066a 100644 --- a/poxml/GettextParser.cpp +++ b/poxml/GettextParser.cpp @@ -204,9 +204,9 @@ string GettextParser::comment() { if ( inputState->guessing==0 ) { #line 59 "gettext.g" - mb.comment = QString::fromUtf8(c.c_str()); - mb.msgid = QString::fromUtf8(mi.c_str()); - mb.msgstr = QString::fromUtf8(ms.c_str()); + mb.comment = TQString::fromUtf8(c.c_str()); + mb.msgid = TQString::fromUtf8(mi.c_str()); + mb.msgstr = TQString::fromUtf8(ms.c_str()); #line 212 "GettextParser.cpp" } @@ -219,10 +219,10 @@ string GettextParser::comment() { if ( inputState->guessing==0 ) { #line 66 "gettext.g" - mb.comment = QString::fromUtf8(c.c_str()); - mb.msgid = QString::fromUtf8(mi.c_str()); - mb.msgid_plural = QString::fromUtf8(mip.c_str()); - mb.msgstr = QString::fromUtf8(ms.c_str()); + mb.comment = TQString::fromUtf8(c.c_str()); + mb.msgid = TQString::fromUtf8(mi.c_str()); + mb.msgid_plural = TQString::fromUtf8(mip.c_str()); + mb.msgstr = TQString::fromUtf8(ms.c_str()); #line 228 "GettextParser.cpp" } diff --git a/poxml/parser.cpp b/poxml/parser.cpp index c34976bf..2f0f7e16 100644 --- a/poxml/parser.cpp +++ b/poxml/parser.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include using namespace std; @@ -47,7 +47,7 @@ static const char *cuttingtags[] = {"bridgehead", "trans_comment", "para", "titl static const char *literaltags[] = {"literallayout", "synopsis", "screen", "programlisting", 0}; -bool StructureParser::fatalError ( const QXmlParseException &e ) +bool StructureParser::fatalError ( const TQXmlParseException &e ) { cerr << "fatalError " << e.message().latin1() << " " << e.lineNumber() << " " << e.columnNumber() << endl; @@ -56,14 +56,14 @@ bool StructureParser::fatalError ( const QXmlParseException &e ) bool StructureParser::startDocument() { - infos_reg = QRegExp("\\s*poxml_line=\"(\\d+)\" poxml_col=\"(\\d+)\""); - do_not_split_reg = QRegExp("\\s*condition=\"do-not-split\""); + infos_reg = TQRegExp("\\s*poxml_line=\"(\\d+)\" poxml_col=\"(\\d+)\""); + do_not_split_reg = TQRegExp("\\s*condition=\"do-not-split\""); message = ""; inside = 0; return true; } -bool StructureParser::isCuttingTag(const QString &qName) +bool StructureParser::isCuttingTag(const TQString &qName) { int index = 0; while (cuttingtags[index]) { @@ -74,7 +74,7 @@ bool StructureParser::isCuttingTag(const QString &qName) return isLiteralTag(qName); } -bool StructureParser::isSingleTag(const QString &qName) +bool StructureParser::isSingleTag(const TQString &qName) { int index = 0; while (singletags[index]) { @@ -85,7 +85,7 @@ bool StructureParser::isSingleTag(const QString &qName) return false; } -bool StructureParser::isLiteralTag(const QString &qName) +bool StructureParser::isLiteralTag(const TQString &qName) { int index = 0; while (literaltags[index]) { @@ -96,24 +96,24 @@ bool StructureParser::isLiteralTag(const QString &qName) return false; } -bool StructureParser::skippedEntity ( const QString & name ) +bool StructureParser::skippedEntity ( const TQString & name ) { if (inside) - message += QString("&%1;").arg(name); + message += TQString("&%1;").arg(name); return true; } -bool StructureParser::startElement( const QString& , const QString& , - const QString& qName, - const QXmlAttributes & attr ) +bool StructureParser::startElement( const TQString& , const TQString& , + const TQString& qName, + const TQXmlAttributes & attr ) { - QString tname = qName.lower(); + TQString tname = qName.lower(); bool first = false; if (isCuttingTag(tname)) { if (!inside) { - message = QString::null; + message = TQString::null; list.pc.increasePara(); startline = locator->lineNumber(); startcol = locator->columnNumber(); @@ -124,12 +124,12 @@ bool StructureParser::startElement( const QString& , const QString& , if (inside) { - QString tmp = "<" + tname; + TQString tmp = "<" + tname; for (int i = 0; i < attr.length(); i++) { - tmp += QString(" %1=\"%2\"").arg(attr.qName(i)).arg(attr.value(i)); + tmp += TQString(" %1=\"%2\"").arg(attr.qName(i)).arg(attr.value(i)); } - tmp += QString(" poxml_line=\"%1\"").arg(locator->lineNumber()); - tmp += QString(" poxml_col=\"%1\"").arg(locator->columnNumber()); + tmp += TQString(" poxml_line=\"%1\"").arg(locator->lineNumber()); + tmp += TQString(" poxml_col=\"%1\"").arg(locator->columnNumber()); if (isSingleTag(qName)) tmp += "/>"; @@ -160,17 +160,17 @@ bool StructureParser::endCDATA() return true; } -bool StructureParser::isClosure(const QString &message) +bool StructureParser::isClosure(const TQString &message) { assert(message.at(0) == '<'); int endindex = 1; while (!message.at(endindex).isSpace() && message.at(endindex) != '>') endindex++; - QString tag = message.mid(1, endindex - 1); + TQString tag = message.mid(1, endindex - 1); return closureTag(message, tag); } -bool StructureParser::closureTag(const QString& message, const QString &tag) +bool StructureParser::closureTag(const TQString& message, const TQString &tag) { #ifdef POXML_DEBUG qDebug("closureTag %s %s", message.latin1(), tag.latin1()); @@ -180,8 +180,8 @@ bool StructureParser::closureTag(const QString& message, const QString &tag) uint index = 0; while (true) { - int nextclose = message.find(QRegExp(QString::fromLatin1("]").arg(tag)), index); - int nextstart = message.find(QRegExp(QString::fromLatin1("<%1[>\\s]").arg(tag)), index); + int nextclose = message.find(TQRegExp(TQString::fromLatin1("]").arg(tag)), index); + int nextstart = message.find(TQRegExp(TQString::fromLatin1("<%1[>\\s]").arg(tag)), index); // qDebug("finding %d %d %d %d", nextstart, nextclose, index, inside); if (nextclose == -1) { #ifdef POXML_DEBUG @@ -214,7 +214,7 @@ bool StructureParser::closureTag(const QString& message, const QString &tag) } } -void StructureParser::descape(QString &message) +void StructureParser::descape(TQString &message) { uint index = 0; stripWhiteSpace( message ); @@ -239,7 +239,7 @@ void StructureParser::descape(QString &message) while (endindex < message.length() && !message.at(endindex).isSpace() && message.at(endindex) != '>') endindex++; - QString tag = message.mid(index + 1, endindex - index - 1); + TQString tag = message.mid(index + 1, endindex - index - 1); if (tag.at(0) == '/') { if (isLiteralTag(tag.mid(1))) inside--; @@ -254,7 +254,7 @@ void StructureParser::descape(QString &message) index++; } - message.replace(QRegExp("\010"), ""); + message.replace(TQRegExp("\010"), ""); } bool StructureParser::formatMessage(MsgBlock &msg) const @@ -278,7 +278,7 @@ bool StructureParser::formatMessage(MsgBlock &msg) const { int slen = strlen(singletags[index]); - if (msg.msgid.left(slen + 1) == QString::fromLatin1("<%1").arg(singletags[index]) && + if (msg.msgid.left(slen + 1) == TQString::fromLatin1("<%1").arg(singletags[index]) && !msg.msgid.at( slen + 1 ).isLetterOrNumber() ) { #ifdef POXML_DEBUG @@ -316,7 +316,7 @@ bool StructureParser::formatMessage(MsgBlock &msg) const int strindex = 1; while (msg.msgid.at(strindex) != ' ' && msg.msgid.at(strindex) != '>') strindex++; - QString starttag = msg.msgid.mid(1, strindex - 1); + TQString starttag = msg.msgid.mid(1, strindex - 1); int endindex = msg.msgid.length() - 2; while (msg.msgid.at(endindex) != '<' && msg.msgid.at(endindex + 1) != '/') endindex--; @@ -324,10 +324,10 @@ bool StructureParser::formatMessage(MsgBlock &msg) const qDebug("endIndex %d", endindex); #endif strindex = endindex; - QString orig = msg.msgid; + TQString orig = msg.msgid; - QString endtag = msg.msgid.mid(endindex + 2, msg.msgid.length() - (endindex + 2) - 1); - QString endtag_attr = endtag.mid(endtag.find(' '), endtag.length()); + TQString endtag = msg.msgid.mid(endindex + 2, msg.msgid.length() - (endindex + 2) - 1); + TQString endtag_attr = endtag.mid(endtag.find(' '), endtag.length()); endtag.replace(infos_reg, ""); if (endtag == starttag) { if (!closureTag(msg.msgid, starttag)) @@ -338,7 +338,7 @@ bool StructureParser::formatMessage(MsgBlock &msg) const strindex = 0; while (msg.msgid.at(strindex) != '>') strindex++; - QString attr = msg.msgid.left(strindex); + TQString attr = msg.msgid.left(strindex); msg.msgid = msg.msgid.mid(strindex + 1); offset += strindex + 1; for (int index = 0; msg.msgid.at(index) == ' '; index++, offset++) ; @@ -389,7 +389,7 @@ MsgList StructureParser::splitMessage(const MsgBlock &mb) MsgBlock msg1 = mb; MsgBlock msg2 = mb; - QString message = mb.msgid; + TQString message = mb.msgid; #ifdef POXML_DEBUG qDebug("splitMessage %s", message.latin1()); @@ -399,7 +399,7 @@ MsgList StructureParser::splitMessage(const MsgBlock &mb) int endindex = 1; while (!message.at(endindex).isSpace() && message.at(endindex) != '>') endindex++; - QString tag = message.mid(1, endindex - 1); + TQString tag = message.mid(1, endindex - 1); if (closureTag(message, tag)) goto error; @@ -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.find(QRegExp(QString::fromLatin1("]").arg(tag)), + int closing_index = message.find(TQRegExp(TQString::fromLatin1("]").arg(tag)), strindex); - int starting_index = message.find(QRegExp(QString::fromLatin1("<%1[\\s>]").arg(tag)), + int starting_index = message.find(TQRegExp(TQString::fromLatin1("<%1[\\s>]").arg(tag)), strindex); #ifdef POXML_DEBUG @@ -509,7 +509,7 @@ MsgList StructureParser::splitMessage(const MsgBlock &mb) int endindex = message.length() - 1; while (endindex >= 0 && (message.at(endindex) != '<' || message.at(endindex + 1) != '/')) endindex--; - QString tag = message.mid(endindex + 2, message.length() - endindex - 3); + TQString tag = message.mid(endindex + 2, message.length() - endindex - 3); if (tag.find(' ') > 0 ) { tag = tag.left(tag.find(' ')); } @@ -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.findRev(QRegExp(QString::fromLatin1("]").arg(tag)), + int closing_index = message.findRev(TQRegExp(TQString::fromLatin1("]").arg(tag)), strindex - 1); - int starting_index = message.findRev(QRegExp(QString::fromLatin1("<%1[\\s>]").arg(tag)), + int starting_index = message.findRev(TQRegExp(TQString::fromLatin1("<%1[\\s>]").arg(tag)), strindex - 1); #ifdef POXML_DEBUG @@ -593,17 +593,17 @@ error: return result; } -bool StructureParser::endElement( const QString& , const QString&, const QString& qName) +bool StructureParser::endElement( const TQString& , const TQString&, const TQString& qName) { - QString tname = qName.lower(); + TQString tname = qName.lower(); // qDebug("endElement %s - %s %d", tname.latin1(), message.latin1(), inside); if (inside) { if (!isSingleTag(qName)) { - message += QString("lineNumber()); - message += QString(" poxml_col=\"%1\"").arg(locator->columnNumber()); + message += TQString("lineNumber()); + message += TQString(" poxml_col=\"%1\"").arg(locator->columnNumber()); message += ">"; } } @@ -640,7 +640,7 @@ bool StructureParser::endElement( const QString& , const QString&, const QString (*it).lines.first().offset = 0; } } - (*it).msgid.replace(infos_reg, QString::null); + (*it).msgid.replace(infos_reg, TQString::null); if (!(*it).msgid.isEmpty()) list.append(*it); @@ -651,7 +651,7 @@ bool StructureParser::endElement( const QString& , const QString&, const QString return true; } -bool StructureParser::comment ( const QString &c ) +bool StructureParser::comment ( const TQString &c ) { if (c.left(7) != " TRANS:") return true; @@ -660,30 +660,30 @@ bool StructureParser::comment ( const QString &c ) return true; } -QString StructureParser::escapeLiterals( const QString &_contents) { - QString contents = _contents; +TQString StructureParser::escapeLiterals( const TQString &_contents) { + TQString contents = _contents; - contents.replace(QRegExp("\n"), "&POXML_LINEFEED;"); - contents.replace(QRegExp("<"), "&POXML_LT;"); - contents.replace(QRegExp(">"), "&POXML_GT;"); - contents.replace(QRegExp("\t"), " "); - contents.replace(QRegExp(" "), "&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; } -QString StructureParser::descapeLiterals( const QString &_contents) { - QString contents = _contents; +TQString StructureParser::descapeLiterals( const TQString &_contents) { + TQString contents = _contents; - contents.replace(QRegExp("&POXML_LINEFEED;"), "\n"); - contents.replace(QRegExp("&POXML_LT;"), "<"); - contents.replace(QRegExp("&POXML_GT;"), ">"); - contents.replace(QRegExp("&POXML_SPACE;"), " "); - contents.replace(QRegExp("!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; } -void StructureParser::stripWhiteSpace( QString &contents) +void StructureParser::stripWhiteSpace( TQString &contents) { contents = contents.stripWhiteSpace(); bool changed; @@ -708,13 +708,13 @@ void StructureParser::stripWhiteSpace( QString &contents) } while (changed); } -void StructureParser::cleanupTags( QString &contents ) +void StructureParser::cleanupTags( TQString &contents ) { - contents.replace(QRegExp("&"), "!POXML_AMP!"); + contents.replace(TQRegExp("&"), "!POXML_AMP!"); for (int index = 0; literaltags[index]; index++) { - QRegExp start(QString("<%1[\\s>]").arg(literaltags[index])); - QRegExp end(QString("]").arg(literaltags[index])); + TQRegExp start(TQString("<%1[\\s>]").arg(literaltags[index])); + TQRegExp end(TQString("]").arg(literaltags[index])); int strindex = 0; while (true) { strindex = contents.find(start, strindex); @@ -724,25 +724,25 @@ void StructureParser::cleanupTags( QString &contents ) strindex++; strindex++; // one more int endindex = contents.find(end, strindex); - QString part = contents.mid(strindex, endindex - strindex); - QString newpart = escapeLiterals(part); + TQString part = contents.mid(strindex, endindex - strindex); + TQString newpart = escapeLiterals(part); contents.replace(strindex, part.length(), newpart); // this assumes that literal tags to not overlap strindex = strindex + newpart.length(); } } - QRegExp unclosed(""); + TQRegExp unclosed(""); int index = -1; while (true) { index = unclosed.search(contents, index + 1); if (index < 0) break; - QString tag = unclosed.cap(1); - contents.replace(index, unclosed.matchedLength(), QString("").arg(tag)); + TQString tag = unclosed.cap(1); + contents.replace(index, unclosed.matchedLength(), TQString("").arg(tag)); } - QRegExp start("<((\\s*[^<>\\s])*)\\s\\s*(/*)>"); + TQRegExp start("<((\\s*[^<>\\s])*)\\s\\s*(/*)>"); start.setMinimal(true); index = -1; @@ -750,32 +750,32 @@ void StructureParser::cleanupTags( QString &contents ) index = start.search(contents, index + 1); if (index < 0) break; - QString tag = start.cap(1); - QString cut = start.capturedTexts().last(); + 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.replace(index, start.matchedLength(), QString("<%1%2>").arg(tag).arg(cut)); + contents.replace(index, start.matchedLength(), TQString("<%1%2>").arg(tag).arg(cut)); } - QRegExp singletag("<(\\w*)\\s([^><]*)/>"); + TQRegExp singletag("<(\\w*)\\s([^><]*)/>"); index = -1; while (true) { index = singletag.search(contents, index + 1); if (index < 0) break; - QString tag = singletag.cap(1); + TQString tag = singletag.cap(1); if (!StructureParser::isSingleTag(tag)) { - contents.replace(index, singletag.matchedLength(), QString("<%1 %2>").arg(tag).arg(singletag.cap(2)).arg(tag)); + contents.replace(index, singletag.matchedLength(), TQString("<%1 %2>").arg(tag).arg(singletag.cap(2)).arg(tag)); } } - QRegExp trans_comment(""); + TQRegExp trans_comment(""); index = -1; while (true) { index = trans_comment.search(contents, index + 1); if (index < 0) break; - QString msgid = trans_comment.cap(1); - contents.replace(index, trans_comment.matchedLength(), QString("%1").arg(msgid)); + TQString msgid = trans_comment.cap(1); + contents.replace(index, trans_comment.matchedLength(), TQString("%1").arg(msgid)); } #ifdef POXML_DEBUG @@ -784,11 +784,11 @@ void StructureParser::cleanupTags( QString &contents ) } -static bool removeEmptyTag( QString &contents, const QString & tag) +static bool removeEmptyTag( TQString &contents, const TQString & tag) { // qDebug("cont %s %s", contents.latin1(), tag.latin1()); - QRegExp empty(QString("<%1[^>]*>[\\s\n][\\s\n]*").arg(tag).arg(tag)); + TQRegExp empty(TQString("<%1[^>]*>[\\s\n][\\s\n]*").arg(tag).arg(tag)); int strindex = 0; while (true) { strindex = contents.find(empty, strindex); @@ -802,7 +802,7 @@ static bool removeEmptyTag( QString &contents, const QString & tag) return false; } -void StructureParser::removeEmptyTags( QString &contents ) +void StructureParser::removeEmptyTags( TQString &contents ) { bool removed; do { @@ -822,24 +822,24 @@ void StructureParser::removeEmptyTags( QString &contents ) } while (removed); } -bool StructureParser::characters(const QString &ch) +bool StructureParser::characters(const TQString &ch) { if (inside && !ch.isEmpty()) message += ch; return true; } -QString escape(QString message) +TQString escape(TQString message) { - message.replace(QRegExp("\\\\"), "\\\\"); - message.replace(QRegExp("\""), "\\\""); + message.replace(TQRegExp("\\\\"), "\\\\"); + message.replace(TQRegExp("\""), "\\\""); return message; } -void outputMsg(const char *prefix, const QString &message) +void outputMsg(const char *prefix, const TQString &message) { - QStringList list = QStringList::split('\n', message, true); - QString line; + TQStringList list = TQStringList::split('\n', message, true); + TQString line; if (list.count() == 1) { line = list.first(); @@ -849,7 +849,7 @@ void outputMsg(const char *prefix, const QString &message) cout << prefix << " \"" << escape(line).utf8().data() << "\"\n"; } else { cout << prefix << " \"\"\n"; - for (QStringList::ConstIterator it = list.begin(); it != list.end(); it++) { + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); it++) { line = *it; if (!line.isEmpty()) { cout << " \"" << escape(line).utf8().data(); @@ -867,7 +867,7 @@ void outputMsg(const char *prefix, const QString &message) } } -QString escapePO(QString msgid) +TQString escapePO(TQString msgid) { int index = 0; while (true) { @@ -909,8 +909,8 @@ QString escapePO(QString msgid) index += 1; } - msgid.replace(QRegExp("&POXML_LITERALLINEFEED;"), "\\n"); - msgid.replace(QRegExp("&POXML_LITERALQUOTE;"), "\\"); + msgid.replace(TQRegExp("&POXML_LITERALLINEFEED;"), "\\n"); + msgid.replace(TQRegExp("&POXML_LITERALQUOTE;"), "\\"); return msgid; } @@ -918,15 +918,15 @@ QString escapePO(QString msgid) MsgList parseXML(const char *filename) { StructureParser handler; - QFile xmlFile( filename ); + TQFile xmlFile( filename ); xmlFile.open(IO_ReadOnly); - QCString ccontents; + TQCString ccontents; ccontents.fill(0, xmlFile.size() + 1); memcpy(ccontents.data(), xmlFile.readAll().data(), xmlFile.size()); xmlFile.close(); - QString contents = QString::fromUtf8( ccontents ); + TQString contents = TQString::fromUtf8( ccontents ); StructureParser::cleanupTags(contents); while (true) { @@ -935,7 +935,7 @@ MsgList parseXML(const char *filename) break; int inside = 0; int endindex = index + 1; - QString replacement = ""; + TQString replacement = ""; while (contents.at(endindex) != '>' || inside) { switch (contents.at(endindex).latin1()) { @@ -955,9 +955,9 @@ MsgList parseXML(const char *filename) contents.replace(index, endindex - index, replacement); } - QTextStream ts(contents.utf8(), IO_ReadOnly); - QXmlInputSource source( ts ); - QXmlSimpleReader reader; + TQTextStream ts(contents.utf8(), IO_ReadOnly); + TQXmlInputSource source( ts ); + TQXmlSimpleReader reader; reader.setFeature( "http://trolltech.com/xml/features/report-start-end-entity", true); reader.setContentHandler( &handler ); reader.setLexicalHandler( &handler ); @@ -970,15 +970,15 @@ MsgList parseXML(const char *filename) do { changed = false; - QMap msgids; + TQMap msgids; for (MsgList::Iterator it = english.begin(); it != english.end(); it++) { - QMap::Iterator found = msgids.find((*it).msgid); + TQMap::Iterator found = msgids.find((*it).msgid); if ((*it).msgid.length() < 4) { - (*it).msgid = QString("<%1>").arg((*it).tag) + (*it).msgid + - QString("").arg((*it).tag); + (*it).msgid = TQString("<%1>").arg((*it).tag) + (*it).msgid + + TQString("").arg((*it).tag); changed = true; break; } @@ -988,12 +988,12 @@ MsgList parseXML(const char *filename) qDebug("same msgid for '%s' and '%s'", found.data().latin1(), (*it).tag.latin1()); #endif changed = true; - QString msgid = (*it).msgid; + TQString msgid = (*it).msgid; for (MsgList::Iterator it2 = english.begin(); it2 != english.end(); it2++) { if ((*it2).msgid == msgid) - (*it2).msgid = QString("<%1>").arg((*it2).tag) + msgid + QString("").arg((*it2).tag); + (*it2).msgid = TQString("<%1>").arg((*it2).tag) + msgid + TQString("").arg((*it2).tag); } break; } diff --git a/poxml/parser.h b/poxml/parser.h index f63f6cef..923723c5 100644 --- a/poxml/parser.h +++ b/poxml/parser.h @@ -1,9 +1,9 @@ #ifndef PARSER_H #define PARSER_H -#include -#include -#include +#include +#include +#include struct BlockInfo { int start_line; @@ -31,13 +31,13 @@ class MsgBlock { MsgBlock(const MsgBlock &rhs ) { *this = rhs; } - QValueList lines; - QString tag; - QString comment; - QString msgid; - QString msgid_plural; - QString msgstr; - QStringList msgstr_plurals; + TQValueList lines; + TQString tag; + TQString comment; + TQString msgid; + TQString msgid_plural; + TQString msgstr; + TQStringList msgstr_plurals; int start, end; bool do_not_split; @@ -59,14 +59,14 @@ class ParaCounter { public: ParaCounter() { current = 0; } - void addAnchor(QString anchor) { anchors.insert(anchor, current); } + void addAnchor(TQString anchor) { anchors.insert(anchor, current); } void increasePara() { current++; } - QMap anchors; + TQMap anchors; int current; }; -class MsgList : public QValueList +class MsgList : public TQValueList { public: MsgList() {} @@ -77,48 +77,48 @@ class StructureParser : public QXmlDefaultHandler { public: bool startDocument(); - bool startElement( const QString&, const QString&, const QString& , - const QXmlAttributes& ); - bool endElement( const QString&, const QString&, const QString& ); - bool characters( const QString &ch); - static bool isCuttingTag(const QString &tag); - static bool isSingleTag(const QString &qName); - static bool isLiteralTag(const QString &qName); - void setDocumentLocator ( QXmlLocator * l ) { locator = l; } - bool skippedEntity ( const QString & name ); - bool fatalError ( const QXmlParseException & ); - bool comment ( const QString & ); - bool error(const QXmlParseException &e ) { return fatalError(e); } - bool warning(const QXmlParseException &e ) { return fatalError(e); } + bool startElement( const TQString&, const TQString&, const TQString& , + const TQXmlAttributes& ); + bool endElement( const TQString&, const TQString&, const TQString& ); + bool characters( const TQString &ch); + static bool isCuttingTag(const TQString &tag); + static bool isSingleTag(const TQString &qName); + static bool isLiteralTag(const TQString &qName); + void setDocumentLocator ( TQXmlLocator * l ) { locator = l; } + bool skippedEntity ( const TQString & name ); + bool fatalError ( const TQXmlParseException & ); + bool comment ( const TQString & ); + bool error(const TQXmlParseException &e ) { return fatalError(e); } + bool warning(const TQXmlParseException &e ) { return fatalError(e); } MsgList getList() const { return list; } MsgList splitMessage(const MsgBlock &message); virtual bool startCDATA(); virtual bool endCDATA(); - static bool closureTag(const QString& message, const QString &tag); - static bool isClosure(const QString &message); - static void descape(QString &message); - static QString escapeLiterals( const QString &contents); - static QString descapeLiterals( const QString &contents); - static void cleanupTags( QString &contents ); - static void removeEmptyTags( QString &contents); - static void stripWhiteSpace( QString &contents); + static bool closureTag(const TQString& message, const TQString &tag); + static bool isClosure(const TQString &message); + static void descape(TQString &message); + static TQString escapeLiterals( const TQString &contents); + static TQString descapeLiterals( const TQString &contents); + static void cleanupTags( TQString &contents ); + static void removeEmptyTags( TQString &contents); + static void stripWhiteSpace( TQString &contents); private: bool formatMessage(MsgBlock &message) const; - QXmlLocator *locator; - QString message; + TQXmlLocator *locator; + TQString message; int inside, startline, startcol; int line; MsgList list; - mutable QRegExp infos_reg; - mutable QRegExp do_not_split_reg; + mutable TQRegExp infos_reg; + mutable TQRegExp do_not_split_reg; }; -void outputMsg(const char *prefix, const QString &message); +void outputMsg(const char *prefix, const TQString &message); MsgList parseXML(const char *filename); -QString escapePO(QString msgid); +TQString escapePO(TQString msgid); #endif diff --git a/poxml/po2xml.cpp b/poxml/po2xml.cpp index 9e8bc1a5..c30a340f 100644 --- a/poxml/po2xml.cpp +++ b/poxml/po2xml.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "GettextLexer.hpp" @@ -14,9 +14,9 @@ using namespace std; -QString translate(QString xml, QString orig, QString translation) +TQString translate(TQString xml, TQString orig, TQString translation) { - QString prefix; + TQString prefix; while (xml.at(0) == '<' && orig.at(0) != '<') { // a XML tag as prefix int index = xml.find('>'); @@ -59,12 +59,12 @@ int main( int argc, char **argv ) return 1; } - QMap translations; + TQMap translations; for (MsgList::ConstIterator it = translated.begin(); it != translated.end(); ++it) { - QString msgstr; - QString msgid = escapePO((*it).msgid); + TQString msgstr; + TQString msgid = escapePO((*it).msgid); if ((*it).comment.find("fuzzy") < 0) msgstr = escapePO((*it).msgstr); @@ -74,17 +74,17 @@ int main( int argc, char **argv ) translations.insert(msgid, msgstr); } - QFile xml(argv[1]); + TQFile xml(argv[1]); xml.open(IO_ReadOnly); - QTextStream ds(&xml); - ds.setEncoding(QTextStream::UnicodeUTF8); - QString xml_text = ds.read(); + TQTextStream ds(&xml); + ds.setEncoding(TQTextStream::UnicodeUTF8); + TQString xml_text = ds.read(); xml.close(); - QString output; - QTextStream ts(&output, IO_WriteOnly); + TQString output; + TQTextStream ts(&output, IO_WriteOnly); StructureParser::cleanupTags(xml_text); - QValueList line_offsets; + TQValueList line_offsets; line_offsets.append(0); int index = 0; while (true) { @@ -95,7 +95,7 @@ int main( int argc, char **argv ) } int old_start_line = -1, old_start_col = -1; - QString old_text; + TQString old_text; MsgList::Iterator old_it = english.end(); for (MsgList::Iterator it = english.begin(); @@ -134,7 +134,7 @@ int main( int argc, char **argv ) continue; int end_pos = line_offsets[bi.end_line - 1] + bi.end_col - 1; - QString xml = xml_text.mid(start_pos, end_pos - start_pos); + TQString xml = xml_text.mid(start_pos, end_pos - start_pos); int index = 0; while (true) { index = xml.find("