diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
commit | 4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch) | |
tree | b0a7cd1c184f0003c0292eb416ed27f674f9cc43 /umbrello/umbrello/codeimport/import_utils.cpp | |
parent | 1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff) | |
download | tdesdk-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/codeimport/import_utils.cpp')
-rw-r--r-- | umbrello/umbrello/codeimport/import_utils.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/umbrello/umbrello/codeimport/import_utils.cpp b/umbrello/umbrello/codeimport/import_utils.cpp index 92a87867..87206ccb 100644 --- a/umbrello/umbrello/codeimport/import_utils.cpp +++ b/umbrello/umbrello/codeimport/import_utils.cpp @@ -12,8 +12,8 @@ // own header #include "import_utils.h" // qt/kde includes -#include <qmap.h> -#include <qregexp.h> +#include <tqmap.h> +#include <tqregexp.h> #include <kmessagebox.h> #include <kdebug.h> #include <klocale.h> @@ -64,7 +64,7 @@ bool bPutAtGlobalScope = false; /** * The include path list (see addIncludePath() and includePathList()) */ -QStringList incPathList; +TQStringList incPathList; void putAtGlobalScope(bool yesno) { bPutAtGlobalScope = yesno; @@ -82,13 +82,13 @@ bool newUMLObjectWasCreated() { return bNewUMLObjectWasCreated; } -QString formatComment(const QString &comment) { +TQString formatComment(const TQString &comment) { if (comment.isEmpty()) return comment; - QStringList lines = QStringList::split("\n", comment); - QString& first = lines.first(); - QRegExp wordex("\\w"); + TQStringList lines = TQStringList::split("\n", comment); + TQString& first = lines.first(); + TQRegExp wordex("\\w"); if (first.startsWith("/*")) { int wordpos = wordex.search(first); if (wordpos != -1) @@ -96,7 +96,7 @@ QString formatComment(const QString &comment) { else lines.pop_front(); // nothing interesting on this line } - QString& last = lines.last(); + TQString& last = lines.last(); int endpos = last.find("*/"); if (endpos != -1) { if (last.contains(wordex)) @@ -107,16 +107,16 @@ QString formatComment(const QString &comment) { if (! lines.count()) return ""; - QStringList::Iterator end(lines.end()); - for (QStringList::Iterator lit(lines.begin()); lit != end; ++lit) { - (*lit).remove(QRegExp("^\\s+")); - (*lit).remove(QRegExp("^\\*+\\s?")); + TQStringList::Iterator end(lines.end()); + for (TQStringList::Iterator lit(lines.begin()); lit != end; ++lit) { + (*lit).remove(TQRegExp("^\\s+")); + (*lit).remove(TQRegExp("^\\*+\\s?")); } return lines.join("\n"); } /* -UMLObject* findUMLObject(QString name, +UMLObject* findUMLObject(TQString name, Uml::Object_Type type) { // Why an extra wrapper? See comment at addMethodParameter() UMLObject * o = umldoc->findUMLObject(name, type); @@ -125,11 +125,11 @@ UMLObject* findUMLObject(QString name, */ UMLObject *createUMLObject(Uml::Object_Type type, - const QString& inName, + const TQString& inName, UMLPackage *parentPkg, - const QString& comment, - const QString& stereotype) { - QString name = inName; + const TQString& comment, + const TQString& stereotype) { + TQString name = inName; UMLDoc *umldoc = UMLApp::app()->getDocument(); UMLFolder *logicalView = umldoc->getRootFolder(Uml::mt_Logical); const Uml::Programming_Language pl = UMLApp::app()->getActiveLanguage(); @@ -142,13 +142,13 @@ UMLObject *createUMLObject(Uml::Object_Type type, bNewUMLObjectWasCreated = false; if (o == NULL) { // Strip possible adornments and look again. - int isConst = name.contains(QRegExp("^const ")); - name.remove(QRegExp("^const\\s+")); - QString typeName(name); - const int isAdorned = typeName.contains( QRegExp("[^\\w:\\. ]") ); + int isConst = name.contains(TQRegExp("^const ")); + name.remove(TQRegExp("^const\\s+")); + TQString typeName(name); + const int isAdorned = typeName.contains( TQRegExp("[^\\w:\\. ]") ); const int isPointer = typeName.contains('*'); const int isRef = typeName.contains('&'); - typeName.remove(QRegExp("[^\\w:\\. ].*$")); + typeName.remove(TQRegExp("[^\\w:\\. ].*$")); typeName = typeName.simplifyWhiteSpace(); UMLObject *origType = umldoc->findUMLObject(typeName, Uml::ot_UMLObject, parentPkg); if (origType == NULL) { @@ -156,17 +156,17 @@ UMLObject *createUMLObject(Uml::Object_Type type, if (bPutAtGlobalScope) parentPkg = logicalView; // Find, or create, the scopes. - QStringList components; + TQStringList components; if (typeName.contains("::")) { - components = QStringList::split("::", typeName); + components = TQStringList::split("::", typeName); } else if (typeName.contains(".")) { - components = QStringList::split(".", typeName); + components = TQStringList::split(".", typeName); } if (components.count() > 1) { typeName = components.back(); components.pop_back(); while ( components.count() ) { - QString scopeName = components.front(); + TQString scopeName = components.front(); components.pop_front(); o = umldoc->findUMLObject(scopeName, Uml::ot_UMLObject, parentPkg); if (o) { @@ -240,7 +240,7 @@ UMLObject *createUMLObject(Uml::Object_Type type, parentPkg->addObject(o); } } - QString strippedComment = formatComment(comment); + TQString strippedComment = formatComment(comment); if (! strippedComment.isEmpty()) { o->setDoc(strippedComment); } @@ -249,17 +249,17 @@ UMLObject *createUMLObject(Uml::Object_Type type, } if (gRelatedClassifier == NULL || gRelatedClassifier == o) return o; - QRegExp templateInstantiation("^[\\w:\\.]+\\s*<(.*)>"); + TQRegExp templateInstantiation("^[\\w:\\.]+\\s*<(.*)>"); int pos = templateInstantiation.search(name); if (pos == -1) return o; // Create dependencies on template parameters. - QString caption = templateInstantiation.cap(1); - QStringList params = QStringList::split(QRegExp("[^\\w:\\.]+"), caption); + TQString caption = templateInstantiation.cap(1); + TQStringList params = TQStringList::split(TQRegExp("[^\\w:\\.]+"), caption); if (!params.count()) return o; - QStringList::Iterator end(params.end()); - for (QStringList::Iterator it(params.begin()); it != end; ++it) { + TQStringList::Iterator end(params.end()); + for (TQStringList::Iterator it(params.begin()); it != end; ++it) { UMLObject *p = umldoc->findUMLObject(*it, Uml::ot_UMLObject, parentPkg); if (p == NULL || p->getBaseType() == Uml::ot_Datatype) continue; @@ -274,16 +274,16 @@ UMLObject *createUMLObject(Uml::Object_Type type, return o; } -UMLOperation* makeOperation(UMLClassifier *parent, const QString &name) { +UMLOperation* makeOperation(UMLClassifier *parent, const TQString &name) { UMLOperation *op = Object_Factory::createOperation(parent, name); return op; } UMLObject* insertAttribute(UMLClassifier *owner, Uml::Visibility scope, - const QString& name, + const TQString& name, UMLClassifier *attrType, - const QString& comment /* ="" */, + const TQString& comment /* ="" */, bool isStatic /* =false */) { Uml::Object_Type ot = owner->getBaseType(); Uml::Programming_Language pl = UMLApp::app()->getActiveLanguage(); @@ -299,7 +299,7 @@ UMLObject* insertAttribute(UMLClassifier *owner, UMLAttribute *attr = owner->addAttribute(name, attrType, scope); attr->setStatic(isStatic); - QString strippedComment = formatComment(comment); + TQString strippedComment = formatComment(comment); if (! strippedComment.isEmpty()) { attr->setDoc(strippedComment); } @@ -309,9 +309,9 @@ UMLObject* insertAttribute(UMLClassifier *owner, } UMLObject* insertAttribute(UMLClassifier *owner, Uml::Visibility scope, - const QString& name, - const QString& type, - const QString& comment /* ="" */, + const TQString& name, + const TQString& type, + const TQString& comment /* ="" */, bool isStatic /* =false */) { UMLObject *attrType = owner->findTemplate(type); if (attrType == NULL) { @@ -327,10 +327,10 @@ UMLObject* insertAttribute(UMLClassifier *owner, Uml::Visibility scope, } void insertMethod(UMLClassifier *klass, UMLOperation* &op, - Uml::Visibility scope, const QString& type, + Uml::Visibility scope, const TQString& type, bool isStatic, bool isAbstract, bool isFriend, bool isConstructor, - const QString& comment) { + const TQString& comment) { op->setVisibility(scope); if (!type.isEmpty() // return type may be missing (constructor/destructor) && type != "void") { @@ -359,7 +359,7 @@ void insertMethod(UMLClassifier *klass, UMLOperation* &op, if (isConstructor) op->setStereotype("constructor"); - QString strippedComment = formatComment(comment); + TQString strippedComment = formatComment(comment); if (! strippedComment.isEmpty()) { op->setDoc(strippedComment); } @@ -394,8 +394,8 @@ void insertMethod(UMLClassifier *klass, UMLOperation* &op, } UMLAttribute* addMethodParameter(UMLOperation *method, - const QString& type, - const QString& name) { + const TQString& type, + const TQString& name) { UMLClassifier *owner = static_cast<UMLClassifier*>(method->parent()); UMLObject *typeObj = owner->findTemplate(type); if (typeObj == NULL) { @@ -410,7 +410,7 @@ UMLAttribute* addMethodParameter(UMLOperation *method, return attr; } -void addEnumLiteral(UMLEnum *enumType, const QString &literal, const QString &comment) { +void addEnumLiteral(UMLEnum *enumType, const TQString &literal, const TQString &comment) { UMLObject *el = enumType->addEnumLiteral(literal); el->setDoc(comment); } @@ -433,28 +433,28 @@ void createGeneralization(UMLClassifier *child, UMLClassifier *parent) { umldoc->addAssociation(assoc); } -void createGeneralization(UMLClassifier *child, const QString &parentName) { +void createGeneralization(UMLClassifier *child, const TQString &parentName) { UMLObject *parentObj = createUMLObject( Uml::ot_Class, parentName ); UMLClassifier *parent = static_cast<UMLClassifier*>(parentObj); createGeneralization(child, parent); } -QStringList includePathList() { - QStringList includePathList(incPathList); +TQStringList includePathList() { + TQStringList includePathList(incPathList); char *umbrello_incpath = getenv( "UMBRELLO_INCPATH" ); if (umbrello_incpath) { - includePathList += QStringList::split( ':', umbrello_incpath ); + includePathList += TQStringList::split( ':', umbrello_incpath ); } return includePathList; } -void addIncludePath(const QString& path) { +void addIncludePath(const TQString& path) { if (! incPathList.contains(path)) incPathList.append(path); } -bool isDatatype(const QString& name, UMLPackage *parentPkg) { +bool isDatatype(const TQString& name, UMLPackage *parentPkg) { UMLDoc *umldoc = UMLApp::app()->getDocument(); UMLObject * o = umldoc->findUMLObject(name, Uml::ot_Datatype, parentPkg); return (o!=NULL); |