diff options
Diffstat (limited to 'umbrello/umbrello/codeimport/javaimport.cpp')
-rw-r--r-- | umbrello/umbrello/codeimport/javaimport.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/umbrello/umbrello/codeimport/javaimport.cpp b/umbrello/umbrello/codeimport/javaimport.cpp index 8df6e5e7..7f62a1a9 100644 --- a/umbrello/umbrello/codeimport/javaimport.cpp +++ b/umbrello/umbrello/codeimport/javaimport.cpp @@ -13,10 +13,10 @@ #include "javaimport.h" // qt/kde includes -#include <qfile.h> -#include <qtextstream.h> -#include <qstringlist.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqstringlist.h> +#include <tqregexp.h> #include <kdebug.h> // app includes #include "import_utils.h" @@ -29,7 +29,7 @@ #include "../operation.h" #include "../attribute.h" -QStringList JavaImport::s_filesAlreadyParsed; +TQStringList JavaImport::s_filesAlreadyParsed; int JavaImport::s_parseDepth = 0; JavaImport::JavaImport() : NativeImportBase("//") { @@ -45,7 +45,7 @@ void JavaImport::initVars() { } /// Catenate possible template arguments/array dimensions to the end of the type name. -QString JavaImport::joinTypename(QString typeName) { +TQString JavaImport::joinTypename(TQString typeName) { if (m_source[m_srcIndex + 1] == "<" || m_source[m_srcIndex + 1] == "[") { uint start = ++m_srcIndex; @@ -62,19 +62,19 @@ QString JavaImport::joinTypename(QString typeName) { return typeName; } -void JavaImport::fillSource(const QString& word) { - QString lexeme; +void JavaImport::fillSource(const TQString& word) { + TQString lexeme; const uint len = word.length(); for (uint i = 0; i < len; i++) { - const QChar& c = word[i]; + const TQChar& c = word[i]; if (c.isLetterOrNumber() || c == '_' || c == '.') { lexeme += c; } else { if (!lexeme.isEmpty()) { m_source.append(lexeme); - lexeme = QString(); + lexeme = TQString(); } - m_source.append(QString(c)); + m_source.append(TQString(c)); } } if (!lexeme.isEmpty()) @@ -83,15 +83,15 @@ void JavaImport::fillSource(const QString& word) { ///Spawn off an import of the specified file -void JavaImport::spawnImport( QString file ) { +void JavaImport::spawnImport( TQString file ) { // if the file is being parsed, don't bother // if (s_filesAlreadyParsed.contains( file ) ) { return; } - if (QFile::exists(file)) { + if (TQFile::exists(file)) { JavaImport importer; - QStringList fileList; + TQStringList fileList; fileList.append( file ); s_filesAlreadyParsed.append( file ); importer.importFiles( fileList ); @@ -100,7 +100,7 @@ void JavaImport::spawnImport( QString file ) { ///returns the UML Object if found, or null otherwise -UMLObject* findObject( QString name, UMLPackage *parentPkg ) { +UMLObject* findObject( TQString name, UMLPackage *parentPkg ) { UMLDoc *umldoc = UMLApp::app()->getDocument(); UMLObject * o = umldoc->findUMLObject(name, Uml::ot_UMLObject , parentPkg); return o; @@ -108,14 +108,14 @@ UMLObject* findObject( QString name, UMLPackage *parentPkg ) { ///Resolve the specified className -UMLObject* JavaImport::resolveClass (QString className) { +UMLObject* JavaImport::resolveClass (TQString className) { kDebug() << "importJava trying to resolve " << className << endl; // keep track if we are dealing with an array // bool isArray = className.contains('['); // remove any [] so that the class itself can be resolved // - QString baseClassName = className; + TQString baseClassName = className; baseClassName.remove('['); baseClassName.remove(']'); @@ -123,7 +123,7 @@ UMLObject* JavaImport::resolveClass (QString className) { // current package, which is in the same directory as the current file // being parsed // - QStringList file = QStringList::split( '/', m_currentFileName); + TQStringList file = TQStringList::split( '/', m_currentFileName); // remove the filename. This leaves the full path to the containing // dir which should also include the package hierarchy // @@ -132,9 +132,9 @@ UMLObject* JavaImport::resolveClass (QString className) { // the file we're looking for might be in the same directory as the // current class // - QString myDir = file.join( "/" ); - QString myFile = '/' + myDir + '/' + baseClassName + ".java"; - if ( QFile::exists(myFile) ) { + TQString myDir = file.join( "/" ); + TQString myFile = '/' + myDir + '/' + baseClassName + ".java"; + if ( TQFile::exists(myFile) ) { spawnImport( myFile ); if ( isArray ) { // we have imported the type. For arrays we want to return @@ -147,7 +147,7 @@ UMLObject* JavaImport::resolveClass (QString className) { // the class we want is not in the same package as the one being imported. // use the imports to find the one we want. // - QStringList package = QStringList::split( '.', m_currentPackage); + TQStringList package = TQStringList::split( '.', m_currentPackage); int dirsInPackageCount = package.size(); for (int count=0; count < dirsInPackageCount; count ++ ) { @@ -156,27 +156,27 @@ UMLObject* JavaImport::resolveClass (QString className) { file.pop_back(); } // this is now the root of any further source imports - QString sourceRoot = '/' + file.join("/") + '/'; + TQString sourceRoot = '/' + file.join("/") + '/'; - for (QStringList::Iterator pathIt = m_imports.begin(); + for (TQStringList::Iterator pathIt = m_imports.begin(); pathIt != m_imports.end(); ++pathIt) { - QString import = (*pathIt); - QStringList split = QStringList::split( '.', import ); + TQString import = (*pathIt); + TQStringList split = TQStringList::split( '.', import ); split.pop_back(); // remove the * or the classname if ( import.endsWith( "*" ) || import.endsWith( baseClassName) ) { // check if the file we want is in this imported package // convert the org.test type package into a filename // - QString aFile = sourceRoot + split.join("/") + '/' + baseClassName + ".java"; - if ( QFile::exists(aFile) ) { + TQString aFile = sourceRoot + split.join("/") + '/' + baseClassName + ".java"; + if ( TQFile::exists(aFile) ) { spawnImport( aFile ); // we need to set the package for the class that will be resolved // start at the root package UMLPackage *parent = m_scope[0]; UMLPackage *current = NULL; - for (QStringList::Iterator it = split.begin(); it != split.end(); ++it) { - QString name = (*it); + for (TQStringList::Iterator it = split.begin(); it != split.end(); ++it) { + TQString name = (*it); UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Package, name, parent); current = static_cast<UMLPackage*>(ns); @@ -197,7 +197,7 @@ UMLObject* JavaImport::resolveClass (QString className) { /// keep track of the current file being parsed and reset the list of imports -void JavaImport::parseFile(const QString& filename) { +void JavaImport::parseFile(const TQString& filename) { m_currentFileName= filename; m_imports.clear(); // default visibility is Impl, unless we are an interface, then it is @@ -223,14 +223,14 @@ void JavaImport::parseFile(const QString& filename) { bool JavaImport::parseStmt() { const uint srcLength = m_source.count(); - const QString& keyword = m_source[m_srcIndex]; + const TQString& keyword = m_source[m_srcIndex]; //kDebug() << '"' << keyword << '"' << endl; if (keyword == "package") { m_currentPackage = advance(); - const QString& qualifiedName = m_currentPackage; - QStringList names = QStringList::split(".", qualifiedName); - for (QStringList::Iterator it = names.begin(); it != names.end(); ++it) { - QString name = (*it); + const TQString& qualifiedName = m_currentPackage; + TQStringList names = TQStringList::split(".", qualifiedName); + for (TQStringList::Iterator it = names.begin(); it != names.end(); ++it) { + TQString name = (*it); UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Package, name, m_scope[m_scopeIndex], m_comment); m_scope[++m_scopeIndex] = static_cast<UMLPackage*>(ns); @@ -242,7 +242,7 @@ bool JavaImport::parseStmt() { return true; } if (keyword == "class" || keyword == "interface") { - const QString& name = advance(); + const TQString& name = advance(); const Uml::Object_Type t = (keyword == "class" ? Uml::ot_Class : Uml::ot_Interface); UMLObject *ns = Import_Utils::createUMLObject(t, name, m_scope[m_scopeIndex], m_comment); m_scope[++m_scopeIndex] = m_klass = static_cast<UMLClassifier*>(ns); @@ -270,14 +270,14 @@ bool JavaImport::parseStmt() { return false; } while (1) { - const QString arg = m_source[++start]; - if (! arg.contains( QRegExp("^[A-Za-z_]") )) { + const TQString arg = m_source[++start]; + if (! arg.contains( TQRegExp("^[A-Za-z_]") )) { kDebug() << "importJava(" << name << "): cannot handle template syntax (" << arg << ")" << endl; break; } /* UMLTemplate *tmpl = */ m_klass->addTemplate(arg); - const QString next = m_source[++start]; + const TQString next = m_source[++start]; if (next == ">") break; if (next != ",") { @@ -289,7 +289,7 @@ bool JavaImport::parseStmt() { advance(); // skip over ">" } if (m_source[m_srcIndex] == "extends") { - const QString& baseName = advance(); + const TQString& baseName = advance(); // try to resolve the class we are extending, or if impossible // create a placeholder UMLObject *parent = resolveClass( baseName ); @@ -304,7 +304,7 @@ bool JavaImport::parseStmt() { } if (m_source[m_srcIndex] == "implements") { while (m_srcIndex < srcLength - 1 && advance() != "{") { - const QString& baseName = m_source[m_srcIndex]; + const TQString& baseName = m_source[m_srcIndex]; // try to resolve the interface we are implementing, if this fails // create a placeholder UMLObject *interface = resolveClass( baseName ); @@ -327,14 +327,14 @@ bool JavaImport::parseStmt() { return true; } if (keyword == "enum") { - const QString& name = advance(); + const TQString& name = advance(); UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Enum, name, m_scope[m_scopeIndex], m_comment); UMLEnum *enumType = static_cast<UMLEnum*>(ns); skipStmt("{"); while (m_srcIndex < srcLength - 1 && advance() != "}") { Import_Utils::addEnumLiteral(enumType, m_source[m_srcIndex]); - QString next = advance(); + TQString next = advance(); if (next == "{" || next == "(") { if (! skipToClosing(next[0])) return false; @@ -389,7 +389,7 @@ bool JavaImport::parseStmt() { } if (keyword == "import") { // keep track of imports so we can resolve classes we are dependent on - QString import = advance(); + TQString import = advance(); if ( import.endsWith(".") ) { //this most likely an import that ends with a * // @@ -420,28 +420,28 @@ bool JavaImport::parseStmt() { // (of a member of class or interface, or return type // of an operation.) Up next is the name of the attribute // or operation. - if (! keyword.contains( QRegExp("^\\w") )) { + if (! keyword.contains( TQRegExp("^\\w") )) { kError() << "importJava: ignoring " << keyword << endl; return false; } - QString typeName = m_source[m_srcIndex]; + TQString typeName = m_source[m_srcIndex]; typeName = joinTypename(typeName); // At this point we need a class. if (m_klass == NULL) { kError() << "importJava: no class set for " << typeName << endl; return false; } - QString name = advance(); - QString nextToken; + TQString name = advance(); + TQString nextToken; if (typeName == m_klass->getName() && name == "(") { // Constructor. nextToken = name; name = typeName; - typeName = QString(); + typeName = TQString(); } else { nextToken = advance(); } - if (name.contains( QRegExp("\\W") )) { + if (name.contains( TQRegExp("\\W") )) { kError() << "importJava: expecting name in " << name << endl; return false; } @@ -450,13 +450,13 @@ bool JavaImport::parseStmt() { UMLOperation *op = Import_Utils::makeOperation(m_klass, name); m_srcIndex++; while (m_srcIndex < srcLength && m_source[m_srcIndex] != ")") { - QString typeName = m_source[m_srcIndex]; + TQString typeName = m_source[m_srcIndex]; if ( typeName == "final" || typeName.startsWith( "//") ) { // ignore the "final" keyword and any comments in method args typeName = advance(); } typeName = joinTypename(typeName); - QString parName = advance(); + TQString parName = advance(); // the Class might not be resolved yet so resolve it if necessary UMLObject *obj = resolveClass(typeName); if (obj) { |