summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/import_rose.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
commit4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch)
treeb0a7cd1c184f0003c0292eb416ed27f674f9cc43 /umbrello/umbrello/import_rose.cpp
parent1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff)
downloadtdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz
tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'umbrello/umbrello/import_rose.cpp')
-rw-r--r--umbrello/umbrello/import_rose.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/umbrello/umbrello/import_rose.cpp b/umbrello/umbrello/import_rose.cpp
index aeaeb7fb..3968e72a 100644
--- a/umbrello/umbrello/import_rose.cpp
+++ b/umbrello/umbrello/import_rose.cpp
@@ -13,12 +13,12 @@
#include "import_rose.h"
// qt includes
-#include <qstring.h>
-#include <qtextstream.h>
-#include <qptrlist.h>
-#include <qstringlist.h>
-#include <qregexp.h>
-#include <qmessagebox.h>
+#include <tqstring.h>
+#include <tqtextstream.h>
+#include <tqptrlist.h>
+#include <tqstringlist.h>
+#include <tqregexp.h>
+#include <tqmessagebox.h>
#include <klocale.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -29,7 +29,7 @@
namespace Import_Rose {
-typedef QPtrList<PetalNode> PetalNodeList;
+typedef TQPtrList<PetalNode> PetalNodeList;
uint nClosures; // Multiple closing parentheses may appear on a single
// line. The parsing is done line-by-line and using
@@ -41,35 +41,35 @@ uint nClosures; // Multiple closing parentheses may appear on a single
// have been seen.
uint linum; // line number
-QString g_methodName;
-void methodName(const QString& m) {
+TQString g_methodName;
+void methodName(const TQString& m) {
g_methodName = m;
}
/**
* Auxiliary function for diagnostics: Return current location.
*/
-QString loc() {
- return "Import_Rose::" + g_methodName + " line " + QString::number(linum) + ": ";
+TQString loc() {
+ return "Import_Rose::" + g_methodName + " line " + TQString::number(linum) + ": ";
}
/**
* Split a line into lexemes.
*/
-QStringList scan(const QString& lin) {
- QStringList result;
- QString line = lin.stripWhiteSpace();
+TQStringList scan(const TQString& lin) {
+ TQStringList result;
+ TQString line = lin.stripWhiteSpace();
if (line.isEmpty())
return result; // empty
- QString lexeme;
+ TQString lexeme;
const uint len = line.length();
bool inString = false;
for (uint i = 0; i < len; i++) {
- QChar c = line[i];
+ TQChar c = line[i];
if (c == '"') {
lexeme += c;
if (inString) {
result.append(lexeme);
- lexeme = QString();
+ lexeme = TQString();
}
inString = !inString;
} else if (inString ||
@@ -78,10 +78,10 @@ QStringList scan(const QString& lin) {
} else {
if (!lexeme.isEmpty()) {
result.append(lexeme);
- lexeme = QString();
+ lexeme = TQString();
}
if (! c.isSpace()) {
- result.append(QString(c));
+ result.append(TQString(c));
}
}
}
@@ -93,8 +93,8 @@ QStringList scan(const QString& lin) {
/**
* Emulate perl shift().
*/
-QString shift(QStringList& l) {
- QString first = l.first();
+TQString shift(TQStringList& l) {
+ TQString first = l.first();
l.pop_front();
return first;
}
@@ -102,7 +102,7 @@ QString shift(QStringList& l) {
/**
* Check for closing of one or more scopes.
*/
-bool checkClosing(QStringList& tokens) {
+bool checkClosing(TQStringList& tokens) {
if (tokens.count() == 0)
return false;
if (tokens.last() == ")") {
@@ -124,8 +124,8 @@ bool checkClosing(QStringList& tokens) {
* @return True if the given text is a natural or negative number
* or a quoted string.
*/
-bool isImmediateValue(QString s) {
- return s.contains(QRegExp("^[\\d\\-\"]"));
+bool isImmediateValue(TQString s) {
+ return s.contains(TQRegExp("^[\\d\\-\"]"));
}
/**
@@ -140,12 +140,12 @@ bool isImmediateValue(QString s) {
* or
* "\"SomeText\" 888"
*/
-QString extractImmediateValues(QStringList& l) {
+TQString extractImmediateValues(TQStringList& l) {
if (l.count() == 0)
- return QString();
+ return TQString();
if (l.first() == "(")
l.pop_front();
- QString result;
+ TQString result;
bool start = true;
while (l.count() && isImmediateValue(l.first())) {
if (start)
@@ -165,9 +165,9 @@ QString extractImmediateValues(QStringList& l) {
return result;
}
-QString collectVerbatimText(QTextStream& stream) {
- QString result;
- QString line;
+TQString collectVerbatimText(TQTextStream& stream) {
+ TQString result;
+ TQString line;
methodName("collectVerbatimText");
while (!(line = stream.readLine()).isNull()) {
linum++;
@@ -176,21 +176,21 @@ QString collectVerbatimText(QTextStream& stream) {
break;
if (line[0] != '|') {
kError() << loc() << "expecting '|' at start of verbatim text" << endl;
- return QString();
+ return TQString();
} else {
result += line.mid(1) + '\n';
}
}
if (line.isNull()) {
kError() << loc() << "premature EOF" << endl;
- return QString();
+ return TQString();
}
if (! line.isEmpty()) {
for (uint i = 0; i < line.length(); i++) {
- const QChar& clParenth = line[i];
+ const TQChar& clParenth = line[i];
if (clParenth != ')') {
kError() << loc() << "expected ')', found: " << clParenth << endl;
- return QString();
+ return TQString();
}
nClosures++;
}
@@ -218,19 +218,19 @@ QString collectVerbatimText(QTextStream& stream) {
* In this case the two lines are extracted without the leading '|'.
* The line ending '\n' of each line is preserved.
*/
-QString extractValue(QStringList& l, QTextStream& stream) {
+TQString extractValue(TQStringList& l, TQTextStream& stream) {
methodName("extractValue");
if (l.count() == 0)
- return QString();
+ return TQString();
if (l.first() == "(")
l.pop_front();
if (l.first() != "value")
- return QString();
+ return TQString();
l.pop_front(); // remove "value"
l.pop_front(); // remove the value type: could be e.g. "Text" or "cardinality"
- QString result;
+ TQString result;
if (l.count() == 0) { // expect verbatim text to follow on subsequent lines
- QString text = collectVerbatimText(stream);
+ TQString text = collectVerbatimText(stream);
nClosures--; // expect own closure
return text;
} else {
@@ -252,17 +252,17 @@ QString extractValue(QStringList& l, QTextStream& stream) {
* Read attributes of a node.
* @param initialArgs Tokens on the line of the opening "(" of the node
* but with leading whitespace and the opening "(" removed.
- * @param stream The QTextStream from which to read following lines.
+ * @param stream The TQTextStream from which to read following lines.
* @return Pointer to the created PetalNode or NULL on error.
*/
-PetalNode *readAttributes(QStringList initialArgs, QTextStream& stream) {
+PetalNode *readAttributes(TQStringList initialArgs, TQTextStream& stream) {
methodName("readAttributes");
if (initialArgs.count() == 0) {
kError() << loc() << "initialArgs is empty" << endl;
return NULL;
}
PetalNode::NodeType nt;
- QString type = shift(initialArgs);
+ TQString type = shift(initialArgs);
if (type == "object")
nt = PetalNode::nt_object;
else if (type == "list")
@@ -277,16 +277,16 @@ PetalNode *readAttributes(QStringList initialArgs, QTextStream& stream) {
if (seenClosing)
return node;
PetalNode::NameValueList attrs;
- QString line;
+ TQString line;
while (!(line = stream.readLine()).isNull()) {
linum++;
line = line.stripWhiteSpace();
if (line.isEmpty())
continue;
- QStringList tokens = scan(line);
- QString stringOrNodeOpener = shift(tokens);
- QString name;
- if (nt == PetalNode::nt_object && !stringOrNodeOpener.contains(QRegExp("^[A-Za-z]"))) {
+ TQStringList tokens = scan(line);
+ TQString stringOrNodeOpener = shift(tokens);
+ TQString name;
+ if (nt == PetalNode::nt_object && !stringOrNodeOpener.contains(TQRegExp("^[A-Za-z]"))) {
kError() << loc() << "unexpected line " << line << endl;
return NULL;
}
@@ -322,7 +322,7 @@ PetalNode *readAttributes(QStringList initialArgs, QTextStream& stream) {
continue;
}
if (stringOrNodeOpener == "(") {
- QString nxt = tokens.first();
+ TQString nxt = tokens.first();
if (isImmediateValue(nxt)) {
value.string = extractImmediateValues(tokens);
} else if (nxt == "value" || nxt.startsWith("\"")) {
@@ -357,25 +357,25 @@ PetalNode *readAttributes(QStringList initialArgs, QTextStream& stream) {
return node;
}
-bool loadFromMDL(QIODevice& file) {
- QTextStream stream(&file);
- stream.setEncoding(QTextStream::Latin1);
- QString line;
+bool loadFromMDL(TQIODevice& file) {
+ TQTextStream stream(&file);
+ stream.setEncoding(TQTextStream::Latin1);
+ TQString line;
PetalNode *root = NULL;
linum = 0;
while (!(line = stream.readLine()).isNull()) {
linum++;
- if (line.contains( QRegExp("^\\s*\\(object Petal") )) {
+ if (line.contains( TQRegExp("^\\s*\\(object Petal") )) {
while (!(line = stream.readLine()).isNull() && !line.contains(')')) {
linum++; // CHECK: do we need petal version info?
}
if (line.isNull())
break;
} else {
- QRegExp objectRx("^\\s*\\(object ");
+ TQRegExp objectRx("^\\s*\\(object ");
if (line.contains(objectRx)) {
nClosures = 0;
- QStringList initialArgs = scan(line);
+ TQStringList initialArgs = scan(line);
initialArgs.pop_front(); // remove opening parenthesis
root = readAttributes(initialArgs, stream);
}