summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codeimport/nativeimportbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'umbrello/umbrello/codeimport/nativeimportbase.cpp')
-rw-r--r--umbrello/umbrello/codeimport/nativeimportbase.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/umbrello/umbrello/codeimport/nativeimportbase.cpp b/umbrello/umbrello/codeimport/nativeimportbase.cpp
index 058b4d19..b2f7dac3 100644
--- a/umbrello/umbrello/codeimport/nativeimportbase.cpp
+++ b/umbrello/umbrello/codeimport/nativeimportbase.cpp
@@ -13,15 +13,15 @@
#include "nativeimportbase.h"
// qt/kde includes
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
#include <klocale.h>
#include <kdebug.h>
// app includes
#include "import_utils.h"
-NativeImportBase::NativeImportBase(const QString &singleLineCommentIntro) {
+NativeImportBase::NativeImportBase(const TQString &singleLineCommentIntro) {
m_singleLineCommentIntro = singleLineCommentIntro;
m_srcIndex = 0;
m_scopeIndex = 0; // index 0 is reserved for global scope
@@ -34,24 +34,24 @@ NativeImportBase::NativeImportBase(const QString &singleLineCommentIntro) {
NativeImportBase::~NativeImportBase() {
}
-void NativeImportBase::setMultiLineComment(const QString &intro, const QString &end) {
+void NativeImportBase::setMultiLineComment(const TQString &intro, const TQString &end) {
m_multiLineCommentIntro = intro;
m_multiLineCommentEnd = end;
}
-void NativeImportBase::setMultiLineAltComment(const QString &intro, const QString &end) {
+void NativeImportBase::setMultiLineAltComment(const TQString &intro, const TQString &end) {
m_multiLineAltCommentIntro = intro;
m_multiLineAltCommentEnd = end;
}
-void NativeImportBase::skipStmt(QString until /* = ";" */) {
+void NativeImportBase::skipStmt(TQString until /* = ";" */) {
const uint srcLength = m_source.count();
while (m_srcIndex < srcLength && m_source[m_srcIndex] != until)
m_srcIndex++;
}
-bool NativeImportBase::skipToClosing(QChar opener) {
- QString closing;
+bool NativeImportBase::skipToClosing(TQChar opener) {
+ TQString closing;
switch (opener) {
case '{':
closing = "}";
@@ -70,12 +70,12 @@ bool NativeImportBase::skipToClosing(QChar opener) {
<< "): " << "illegal input character" << endl;
return false;
}
- const QString opening(opener);
+ const TQString opening(opener);
skipStmt(opening);
const uint srcLength = m_source.count();
int nesting = 0;
while (m_srcIndex < srcLength) {
- QString nextToken = advance();
+ TQString nextToken = advance();
if (nextToken.isEmpty())
break;
if (nextToken == closing) {
@@ -91,7 +91,7 @@ bool NativeImportBase::skipToClosing(QChar opener) {
return true;
}
-QString NativeImportBase::advance() {
+TQString NativeImportBase::advance() {
while (m_srcIndex < m_source.count() - 1) {
if (m_source[++m_srcIndex].startsWith(m_singleLineCommentIntro))
m_comment += m_source[m_srcIndex];
@@ -102,12 +102,12 @@ QString NativeImportBase::advance() {
// if last item in m_source is a comment then it is dropped too
(m_srcIndex == m_source.count() - 1 &&
m_source[m_srcIndex].startsWith(m_singleLineCommentIntro))) {
- return QString();
+ return TQString();
}
return m_source[m_srcIndex];
}
-bool NativeImportBase::preprocess(QString& line) {
+bool NativeImportBase::preprocess(TQString& line) {
if (m_multiLineCommentIntro.isEmpty())
return false;
// Check for end of multi line comment.
@@ -126,7 +126,7 @@ bool NativeImportBase::preprocess(QString& line) {
delimiterLen = m_multiLineCommentEnd.length();
}
if (pos > 0) {
- QString text = line.mid(0, pos - 1);
+ TQString text = line.mid(0, pos - 1);
m_comment += text.stripWhiteSpace();
}
m_source.append(m_singleLineCommentIntro + m_comment); // denotes comments in `m_source'
@@ -162,7 +162,7 @@ bool NativeImportBase::preprocess(QString& line) {
if (endpos == -1) {
m_inComment = true;
if (pos + delimIntroLen < (int)line.length()) {
- QString cmnt = line.mid(pos + delimIntroLen);
+ TQString cmnt = line.mid(pos + delimIntroLen);
m_comment += cmnt.stripWhiteSpace() + "\n";
}
if (pos == 0)
@@ -170,16 +170,16 @@ bool NativeImportBase::preprocess(QString& line) {
line = line.left(pos);
} else { // It's a multiline comment on a single line.
if (endpos > pos + delimIntroLen) {
- QString cmnt = line.mid(pos + delimIntroLen, endpos - pos - delimIntroLen);
+ TQString cmnt = line.mid(pos + delimIntroLen, endpos - pos - delimIntroLen);
cmnt = cmnt.stripWhiteSpace();
if (!cmnt.isEmpty())
m_source.append(m_singleLineCommentIntro + cmnt);
}
endpos++; // endpos now points at the slash of "*/"
- QString pre;
+ TQString pre;
if (pos > 0)
pre = line.left(pos);
- QString post;
+ TQString post;
if (endpos + delimEndLen < (int)line.length())
post = line.mid(endpos + 1);
line = pre + post;
@@ -190,20 +190,20 @@ bool NativeImportBase::preprocess(QString& line) {
/// Split the line so that a string is returned as a single element of the list,
/// when not in a string then split at white space.
-QStringList NativeImportBase::split(const QString& lin) {
- QStringList list;
- QString listElement;
- QChar stringIntro = 0; // buffers the string introducer character
+TQStringList NativeImportBase::split(const TQString& lin) {
+ TQStringList list;
+ TQString listElement;
+ TQChar stringIntro = 0; // buffers the string introducer character
bool seenSpace = false;
- QString line = lin.stripWhiteSpace();
+ TQString line = lin.stripWhiteSpace();
for (uint i = 0; i < line.length(); i++) {
- const QChar& c = line[i];
+ const TQChar& c = line[i];
if (stringIntro) { // we are in a string
listElement += c;
if (c == stringIntro) {
if (line[i - 1] != '\\') {
list.append(listElement);
- listElement = QString();
+ listElement = TQString();
stringIntro = 0; // we are no longer in a string
}
}
@@ -219,7 +219,7 @@ QStringList NativeImportBase::split(const QString& lin) {
seenSpace = true;
if (!listElement.isEmpty()) {
list.append(listElement);
- listElement = QString();
+ listElement = TQString();
}
} else {
listElement += c;
@@ -233,23 +233,23 @@ QStringList NativeImportBase::split(const QString& lin) {
/// The lexer. Tokenizes the given string and fills `m_source'.
/// Stores possible comments in `m_comment'.
-void NativeImportBase::scan(QString line) {
+void NativeImportBase::scan(TQString line) {
if (preprocess(line))
return;
// Check for single line comment.
int pos = line.find(m_singleLineCommentIntro);
if (pos != -1) {
- QString cmnt = line.mid(pos);
+ TQString cmnt = line.mid(pos);
m_source.append(cmnt);
if (pos == 0)
return;
line = line.left(pos);
}
- if (line.contains(QRegExp("^\\s*$")))
+ if (line.contains(TQRegExp("^\\s*$")))
return;
- QStringList words = split(line);
- for (QStringList::Iterator it = words.begin(); it != words.end(); ++it) {
- QString word = *it;
+ TQStringList words = split(line);
+ for (TQStringList::Iterator it = words.begin(); it != words.end(); ++it) {
+ TQString word = *it;
if (word[0] == '"' || word[0] == '\'')
m_source.append(word); // string constants are handled by split()
else
@@ -260,34 +260,34 @@ void NativeImportBase::scan(QString line) {
void NativeImportBase::initVars() {
}
-void NativeImportBase::parseFile(const QString& filename) {
- QString nameWithoutPath = filename;
- nameWithoutPath.remove(QRegExp("^.*/"));
+void NativeImportBase::parseFile(const TQString& filename) {
+ TQString nameWithoutPath = filename;
+ nameWithoutPath.remove(TQRegExp("^.*/"));
if (m_parsedFiles.contains(nameWithoutPath))
return;
m_parsedFiles.append(nameWithoutPath);
- QString fname = filename;
- const QString msgPrefix = "NativeImportBase::parseFile(" + filename + "): ";
+ TQString fname = filename;
+ const TQString msgPrefix = "NativeImportBase::parseFile(" + filename + "): ";
if (filename.contains('/')) {
- QString path = filename;
- path.remove( QRegExp("/[^/]+$") );
+ TQString path = filename;
+ path.remove( TQRegExp("/[^/]+$") );
kDebug() << msgPrefix << "adding path " << path << endl;
Import_Utils::addIncludePath(path);
}
- if (! QFile::exists(filename)) {
+ if (! TQFile::exists(filename)) {
if (filename.startsWith("/")) {
kError() << msgPrefix << "cannot find file" << endl;
return;
}
bool found = false;
- QStringList includePaths = Import_Utils::includePathList();
- for (QStringList::Iterator pathIt = includePaths.begin();
+ TQStringList includePaths = Import_Utils::includePathList();
+ for (TQStringList::Iterator pathIt = includePaths.begin();
pathIt != includePaths.end(); ++pathIt) {
- QString path = (*pathIt);
+ TQString path = (*pathIt);
if (! path.endsWith("/")) {
path.append("/");
}
- if (QFile::exists(path + filename)) {
+ if (TQFile::exists(path + filename)) {
fname.prepend(path);
found = true;
break;
@@ -298,30 +298,30 @@ void NativeImportBase::parseFile(const QString& filename) {
return;
}
}
- QFile file(fname);
+ TQFile file(fname);
if (! file.open(IO_ReadOnly)) {
kError() << msgPrefix << "cannot open file" << endl;
return;
}
kDebug() << msgPrefix << "parsing." << endl;
- // Scan the input file into the QStringList m_source.
+ // Scan the input file into the TQStringList m_source.
m_source.clear();
m_srcIndex = 0;
initVars();
- QTextStream stream(&file);
+ TQTextStream stream(&file);
while (! stream.atEnd()) {
- QString line = stream.readLine();
+ TQString line = stream.readLine();
scan(line);
}
file.close();
- // Parse the QStringList m_source.
+ // Parse the TQStringList m_source.
m_klass = NULL;
m_currentAccess = Uml::Visibility::Public;
m_scopeIndex = 0;
m_scope[0] = NULL; // index 0 is reserved for global scope
const uint srcLength = m_source.count();
for (m_srcIndex = 0; m_srcIndex < srcLength; m_srcIndex++) {
- const QString& firstToken = m_source[m_srcIndex];
+ const TQString& firstToken = m_source[m_srcIndex];
//kDebug() << '"' << firstToken << '"' << endl;
if (firstToken.startsWith(m_singleLineCommentIntro)) {
m_comment = firstToken.mid(m_singleLineCommentIntro.length());
@@ -329,7 +329,7 @@ void NativeImportBase::parseFile(const QString& filename) {
}
if (! parseStmt())
skipStmt();
- m_comment = QString();
+ m_comment = TQString();
}
kDebug() << msgPrefix << "end of parse." << endl;
}