summaryrefslogtreecommitdiffstats
path: root/poxml
diff options
context:
space:
mode:
Diffstat (limited to 'poxml')
-rw-r--r--poxml/GettextParser.cpp14
-rw-r--r--poxml/parser.cpp214
-rw-r--r--poxml/parser.h80
-rw-r--r--poxml/po2xml.cpp40
-rw-r--r--poxml/split.cpp14
-rw-r--r--poxml/transxx.cpp38
-rw-r--r--poxml/xml2pot.cpp12
7 files changed, 206 insertions, 206 deletions
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 <iostream>
#include <stdlib.h>
#include <assert.h>
-#include <qregexp.h>
+#include <tqregexp.h>
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("</%1[\\s>]").arg(tag)), index);
- int nextstart = message.find(QRegExp(QString::fromLatin1("<%1[>\\s]").arg(tag)), index);
+ int nextclose = message.find(TQRegExp(TQString::fromLatin1("</%1[\\s>]").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("</%1[\\s>]").arg(tag)),
+ int closing_index = message.find(TQRegExp(TQString::fromLatin1("</%1[\\s>]").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("</%1[\\s>]").arg(tag)),
+ int closing_index = message.findRev(TQRegExp(TQString::fromLatin1("</%1[\\s>]").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("</%1").arg(tname);
- message += QString(" poxml_line=\"%1\"").arg(locator->lineNumber());
- message += QString(" poxml_col=\"%1\"").arg(locator->columnNumber());
+ message += TQString("</%1").arg(tname);
+ message += TQString(" poxml_line=\"%1\"").arg(locator->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("</%1[\\s>]").arg(literaltags[index]));
+ TQRegExp start(TQString("<%1[\\s>]").arg(literaltags[index]));
+ TQRegExp end(TQString("</%1[\\s>]").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("</(\\w*)\\s\\s*>");
+ TQRegExp unclosed("</(\\w*)\\s\\s*>");
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("</%1>").arg(tag));
+ TQString tag = unclosed.cap(1);
+ contents.replace(index, unclosed.matchedLength(), TQString("</%1>").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></%3>").arg(tag).arg(singletag.cap(2)).arg(tag));
+ contents.replace(index, singletag.matchedLength(), TQString("<%1 %2></%3>").arg(tag).arg(singletag.cap(2)).arg(tag));
}
}
- QRegExp trans_comment("<!-- TRANS:([^<>]*)-->");
+ TQRegExp trans_comment("<!-- TRANS:([^<>]*)-->");
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("<trans_comment>%1</trans_comment>").arg(msgid));
+ TQString msgid = trans_comment.cap(1);
+ contents.replace(index, trans_comment.matchedLength(), TQString("<trans_comment>%1</trans_comment>").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]*</%2\\s*>").arg(tag).arg(tag));
+ TQRegExp empty(TQString("<%1[^>]*>[\\s\n][\\s\n]*</%2\\s*>").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<QString, QString> msgids;
+ TQMap<TQString, TQString> msgids;
for (MsgList::Iterator it = english.begin();
it != english.end(); it++)
{
- QMap<QString,QString>::Iterator found = msgids.find((*it).msgid);
+ TQMap<TQString,TQString>::Iterator found = msgids.find((*it).msgid);
if ((*it).msgid.length() < 4) {
- (*it).msgid = QString("<%1>").arg((*it).tag) + (*it).msgid +
- QString("</%1>").arg((*it).tag);
+ (*it).msgid = TQString("<%1>").arg((*it).tag) + (*it).msgid +
+ TQString("</%1>").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("</%1>").arg((*it2).tag);
+ (*it2).msgid = TQString("<%1>").arg((*it2).tag) + msgid + TQString("</%1>").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 <qxml.h>
-#include <qmap.h>
-#include <qregexp.h>
+#include <tqxml.h>
+#include <tqmap.h>
+#include <tqregexp.h>
struct BlockInfo {
int start_line;
@@ -31,13 +31,13 @@ class MsgBlock {
MsgBlock(const MsgBlock &rhs ) {
*this = rhs;
}
- QValueList<BlockInfo> lines;
- QString tag;
- QString comment;
- QString msgid;
- QString msgid_plural;
- QString msgstr;
- QStringList msgstr_plurals;
+ TQValueList<BlockInfo> 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<QString, int> anchors;
+ TQMap<TQString, int> anchors;
int current;
};
-class MsgList : public QValueList<MsgBlock>
+class MsgList : public TQValueList<MsgBlock>
{
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 <stdlib.h>
#include <iostream>
#include <assert.h>
-#include <qregexp.h>
+#include <tqregexp.h>
#include <fstream>
#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<QString, QString> translations;
+ TQMap<TQString, TQString> 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<int> line_offsets;
+ TQValueList<int> 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("<!--");
@@ -152,7 +152,7 @@ int main( int argc, char **argv )
}
StructureParser::descape(xml);
- QString descaped = StructureParser::descapeLiterals((*it).msgid);
+ TQString descaped = StructureParser::descapeLiterals((*it).msgid);
if (translations.contains(descaped))
descaped = translations[descaped];
@@ -170,7 +170,7 @@ int main( int argc, char **argv )
index++;
while ((*it).msgid.at(index) == ' ')
index++;
- QString omsgid = (*it).msgid;
+ TQString omsgid = (*it).msgid;
(*it).msgid = (*it).msgid.mid(index);
index = (*it).msgid.length() - 1;
@@ -236,14 +236,14 @@ int main( int argc, char **argv )
ts << xml_text.mid(old_pos);
- output.replace(QRegExp("<trans_comment\\s*>"), "");
- output.replace(QRegExp("</trans_comment\\s*>"), "");
+ output.replace(TQRegExp("<trans_comment\\s*>"), "");
+ output.replace(TQRegExp("</trans_comment\\s*>"), "");
StructureParser::removeEmptyTags(output);
index = 0;
while (true) {
- index = output.find(QRegExp(">[^\n]"), index );
+ index = output.find(TQRegExp(">[^\n]"), index );
if ( index == -1 )
break;
if ( output.at( index - 1 ) == '/' || output.at( index - 1 ) == '-' ||
diff --git a/poxml/split.cpp b/poxml/split.cpp
index 28149ed6..29104d3e 100644
--- a/poxml/split.cpp
+++ b/poxml/split.cpp
@@ -16,14 +16,14 @@ int main( int argc, char **argv )
MsgList english = parseXML(argv[1]);
MsgList translated = parseXML(argv[2]);
- QMap<QString, int>::ConstIterator eit2 = english.pc.anchors.begin();
+ TQMap<TQString, int>::ConstIterator eit2 = english.pc.anchors.begin();
- QMap<int, QString> errors;
+ TQMap<int, TQString> errors;
while (eit2 != english.pc.anchors.end())
{
if (eit2.data() == translated.pc.anchors[eit2.key()]) {
- QString key = eit2.key();
+ TQString key = eit2.key();
eit2++;
translated.pc.anchors.remove(key);
english.pc.anchors.remove(key);
@@ -34,7 +34,7 @@ int main( int argc, char **argv )
}
if (report_mismatches && errors.count()) {
- for (QMap<int, QString>::ConstIterator it = errors.begin(); it != errors.end(); ++it)
+ for (TQMap<int, TQString>::ConstIterator it = errors.begin(); it != errors.end(); ++it)
{
if (translated.pc.anchors.contains(it.data()))
fprintf(stderr, "id=\"%s\" not in the same paragraphs (%d vs %d)\n", it.data().latin1(),
@@ -58,7 +58,7 @@ int main( int argc, char **argv )
bool have_roles_of_translators = false;
bool have_credit_for_translators = false;
- QMap<QString, int> msgids;
+ TQMap<TQString, int> msgids;
int index = 0;
for (MsgList::Iterator it = english.begin();
@@ -112,7 +112,7 @@ int main( int argc, char **argv )
while (tit != translated.end())
{
MsgBlock mb;
- mb.msgid = QString::fromLatin1("appended paragraph %1").arg(counter++);
+ mb.msgid = TQString::fromLatin1("appended paragraph %1").arg(counter++);
mb.msgstr = (*tit).msgid;
mb.lines += (*tit).lines;
english.append(mb);
@@ -130,7 +130,7 @@ int main( int argc, char **argv )
it != english.end(); ++it)
{
cout << "#: ";
- for (QValueList<BlockInfo>::ConstIterator it2 =
+ for (TQValueList<BlockInfo>::ConstIterator it2 =
(*it).lines.begin(); it2 != (*it).lines.end(); it2++) {
if (it2 != (*it).lines.begin())
cout << ", ";
diff --git a/poxml/transxx.cpp b/poxml/transxx.cpp
index dc3dde00..d876d56c 100644
--- a/poxml/transxx.cpp
+++ b/poxml/transxx.cpp
@@ -4,9 +4,9 @@ using namespace std;
#include <fstream>
#include "GettextLexer.hpp"
-#include <qregexp.h>
-#include <qdatetime.h>
-#include <qfileinfo.h>
+#include <tqregexp.h>
+#include <tqdatetime.h>
+#include <tqfileinfo.h>
int main(int argc, char **argv)
{
@@ -15,15 +15,15 @@ int main(int argc, char **argv)
return -1;
}
- QString translation = "xx";
- QCString filename;
+ TQString translation = "xx";
+ TQCString filename;
if( argc == 4 ) {
- if( argv[1]!=QString("--text") ) {
+ if( argv[1]!=TQString("--text") ) {
qWarning( "usage: %s [--text translation] potfile", argv[0] );
return -1;
}
- translation = QString::fromLocal8Bit(argv[2]);
+ translation = TQString::fromLocal8Bit(argv[2]);
filename = argv[3];
} else {
filename = argv[1];
@@ -54,17 +54,17 @@ int main(int argc, char **argv)
}
else
{
- QStringList headerLines = QStringList::split( "\\n", ( *header ).msgstr, false );
- QFileInfo fi( QString::fromLocal8Bit( filename ) );
- QString projectId( "Project-Id-Version: " );
+ TQStringList headerLines = TQStringList::split( "\\n", ( *header ).msgstr, false );
+ TQFileInfo fi( TQString::fromLocal8Bit( filename ) );
+ TQString projectId( "Project-Id-Version: " );
projectId += fi.baseName( false );
- headerLines.gres( QRegExp( "^Project-Id-Version:.*" ), projectId );
- headerLines.gres( QRegExp( "^Last-Translator:.*" ), "Last-Translator: transxx program <null@kde.org>" );
- headerLines.gres( QRegExp( "^Language-Team:.*" ), "Language-Team: Test Language <kde-i18n-doc@kde.org>" );
- QString revisionDate ( "PO-Revision-Date: " );
- const QDateTime dt = QDateTime::currentDateTime( Qt::UTC );
+ headerLines.gres( TQRegExp( "^Project-Id-Version:.*" ), projectId );
+ headerLines.gres( TQRegExp( "^Last-Translator:.*" ), "Last-Translator: transxx program <null@kde.org>" );
+ headerLines.gres( TQRegExp( "^Language-Team:.*" ), "Language-Team: Test Language <kde-i18n-doc@kde.org>" );
+ TQString revisionDate ( "PO-Revision-Date: " );
+ const TQDateTime dt = TQDateTime::currentDateTime( Qt::UTC );
revisionDate += dt.toString( "yyyy-MM-dd hh:mm+0000" );
- headerLines.gres( QRegExp( "^PO-Revision-Date:.*" ), revisionDate );
+ headerLines.gres( TQRegExp( "^PO-Revision-Date:.*" ), revisionDate );
headerLines << "Plural-Forms: nplurals=1; plural=0;";
outputMsg ( "msgid", "" );
outputMsg ( "msgstr", escapePO( headerLines.join("\\n") + "\\n" ) );
@@ -74,8 +74,8 @@ int main(int argc, char **argv)
for (MsgList::ConstIterator it = translated.begin();
it != translated.end(); ++it)
{
- QString msgid = ( *it ).msgid;
- QString msgid_plural = ( *it ).msgid_plural;
+ TQString msgid = ( *it ).msgid;
+ TQString msgid_plural = ( *it ).msgid_plural;
if ( !msgid.isEmpty() ) {
outputMsg("msgid", escapePO( msgid) );
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
outputMsg("msgid_plural", escapePO( msgid_plural ) );
}
- QString msgstr;
+ TQString msgstr;
if ( msgid.find( "Definition of PluralForm" ) != -1 ) {
outputMsg("msgstr", "NoPlural");
diff --git a/poxml/xml2pot.cpp b/poxml/xml2pot.cpp
index 593e75be..340d4689 100644
--- a/poxml/xml2pot.cpp
+++ b/poxml/xml2pot.cpp
@@ -1,8 +1,8 @@
#include "parser.h"
#include <stdlib.h>
#include <iostream>
-#include <qfileinfo.h>
-#include <qdatetime.h>
+#include <tqfileinfo.h>
+#include <tqdatetime.h>
using namespace std;
@@ -15,7 +15,7 @@ int main( int argc, char **argv )
MsgList english = parseXML(argv[1]);
- QMap<QString, int> msgids;
+ TQMap<TQString, int> msgids;
int index = 0;
for (MsgList::Iterator it = english.begin();
@@ -33,7 +33,7 @@ int main( int argc, char **argv )
}
}
- const QDateTime now = QDateTime::currentDateTime( Qt::UTC );
+ const TQDateTime now = TQDateTime::currentDateTime( Qt::UTC );
cout << "# SOME DESCRIPTIVE TITLE.\n";
cout << "# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n";
@@ -52,14 +52,14 @@ int main( int argc, char **argv )
cout << "\"Content-Transfer-Encoding: 8bit\\n\"\n";
cout << "\n";
- const QString fname = QFileInfo(argv[1]).fileName();
+ const TQString fname = TQFileInfo(argv[1]).fileName();
for (MsgList::ConstIterator it = english.begin();
it != english.end(); ++it)
{
cout << "#. Tag: " << (*it).tag.utf8() << endl;
cout << "#: ";
- for (QValueList<BlockInfo>::ConstIterator it2 =
+ for (TQValueList<BlockInfo>::ConstIterator it2 =
(*it).lines.begin(); it2 != (*it).lines.end(); it2++) {
if (it2 != (*it).lines.begin())
cout << " ";