diff options
Diffstat (limited to 'umbrello/umbrello/codegenerators/xmlschemawriter.cpp')
-rw-r--r-- | umbrello/umbrello/codegenerators/xmlschemawriter.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/umbrello/umbrello/codegenerators/xmlschemawriter.cpp b/umbrello/umbrello/codegenerators/xmlschemawriter.cpp index 303d3230..8c043a3e 100644 --- a/umbrello/umbrello/codegenerators/xmlschemawriter.cpp +++ b/umbrello/umbrello/codegenerators/xmlschemawriter.cpp @@ -18,9 +18,9 @@ #include <klocale.h> #include <kmessagebox.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqregexp.h> #include "../umldoc.h" #include "../classifier.h" @@ -58,7 +58,7 @@ void XMLSchemaWriter::writeClass(UMLClassifier *c) } // find an appropriate name for our file - QString fileName = findFileName(c,".xsd"); + TQString fileName = findFileName(c,".xsd"); if (fileName.isEmpty()) { emit codeGenerated(c, false); @@ -66,13 +66,13 @@ void XMLSchemaWriter::writeClass(UMLClassifier *c) } // check that we may open that file for writing - QFile file; + TQFile file; if ( !openFile(file, fileName) ) { emit codeGenerated(c, false); return; } - QTextStream XMLschema(&file); + TQTextStream XMLschema(&file); // set package namespace tag appropriately if(!c->getPackage().isEmpty()) @@ -85,10 +85,10 @@ void XMLSchemaWriter::writeClass(UMLClassifier *c) XMLschema<<"<?xml version=\"1.0\"?>"<<m_endl; // 1. create the header - QString headerText = getHeadingFile(".xsd"); + TQString headerText = getHeadingFile(".xsd"); if(!headerText.isEmpty()) { - headerText.replace(QRegExp("%filename%"),fileName); - headerText.replace(QRegExp("%filepath%"),file.name()); + headerText.replace(TQRegExp("%filename%"),fileName); + headerText.replace(TQRegExp("%filepath%"),file.name()); } if(!headerText.isEmpty()) XMLschema<<headerText<<m_endl; @@ -141,7 +141,7 @@ void XMLSchemaWriter::writeClass(UMLClassifier *c) writtenClassifiers.clear(); } -void XMLSchemaWriter::writeElementDecl( const QString &elementName, const QString &elementTypeName, QTextStream &XMLschema) +void XMLSchemaWriter::writeElementDecl( const TQString &elementName, const TQString &elementTypeName, TQTextStream &XMLschema) { if(forceDoc()) writeComment(elementName+" is the root element, declared here.", XMLschema); @@ -153,7 +153,7 @@ void XMLSchemaWriter::writeElementDecl( const QString &elementName, const QStrin } -void XMLSchemaWriter::writeClassifier (UMLClassifier *c, QTextStream &XMLschema) +void XMLSchemaWriter::writeClassifier (UMLClassifier *c, TQTextStream &XMLschema) { // NO doing this 2 or more times. @@ -209,7 +209,7 @@ UMLAttributeList XMLSchemaWriter::findAttributes (UMLClassifier *c) // element use the interface in element aggregation) // -void XMLSchemaWriter::writeAbstractClassifier (UMLClassifier *c, QTextStream &XMLschema) +void XMLSchemaWriter::writeAbstractClassifier (UMLClassifier *c, TQTextStream &XMLschema) { // preparations @@ -226,9 +226,9 @@ void XMLSchemaWriter::writeAbstractClassifier (UMLClassifier *c, QTextStream &XM if(subclasses.count() > 0) { - QString elementName = getElementName(c); + TQString elementName = getElementName(c); UMLAttributeList attribs = findAttributes(c); - QStringList attribGroups = findAttributeGroups(c); + TQStringList attribGroups = findAttributeGroups(c); writeAttributeGroupDecl(elementName, attribs, XMLschema); @@ -245,11 +245,11 @@ void XMLSchemaWriter::writeAbstractClassifier (UMLClassifier *c, QTextStream &XM void XMLSchemaWriter::writeGroupClassifierDecl (UMLClassifier *c, UMLClassifierList subclasses, - QTextStream &XMLschema) + TQTextStream &XMLschema) { // name of class, subclassing classifiers - QString elementTypeName = getElementGroupTypeName(c); + TQString elementTypeName = getElementGroupTypeName(c); // start Writing node but only if it has subclasses? Nah..right now put in empty group XMLschema<<getIndent()<<"<"<<makeSchemaTag("group")<<" name=\""<<elementTypeName<<"\">"<<m_endl; @@ -277,7 +277,7 @@ void XMLSchemaWriter::writeComplexTypeClassifierDecl (UMLClassifier *c, UMLAssociationList aggregations, UMLAssociationList compositions, UMLClassifierList superclasses, - QTextStream &XMLschema) + TQTextStream &XMLschema) { // Preparations @@ -285,7 +285,7 @@ void XMLSchemaWriter::writeComplexTypeClassifierDecl (UMLClassifier *c, // sort attributes by Scope UMLAttributeList attribs = findAttributes(c); - QStringList attribGroups = findAttributeGroups(c); + TQStringList attribGroups = findAttributeGroups(c); // test for relevant associations bool hasAssociations = determineIfHasChildNodes(c); @@ -295,7 +295,7 @@ void XMLSchemaWriter::writeComplexTypeClassifierDecl (UMLClassifier *c, // START WRITING // start body of element - QString elementTypeName = getElementTypeName(c); + TQString elementTypeName = getElementTypeName(c); XMLschema<<getIndent()<<"<"<<makeSchemaTag("complexType")<<" name=\""<<elementTypeName<<"\""; @@ -308,7 +308,7 @@ void XMLSchemaWriter::writeComplexTypeClassifierDecl (UMLClassifier *c, if(hasSuperclass) { - QString superClassName = getElementTypeName(superclasses.first()); + TQString superClassName = getElementTypeName(superclasses.first()); XMLschema<<getIndent()<<"<"<<makeSchemaTag("complexContent")<<">"<<m_endl; //PROBLEM: we only treat ONE superclass for inheritence.. bah. @@ -368,7 +368,7 @@ void XMLSchemaWriter::writeComplexTypeClassifierDecl (UMLClassifier *c, } -void XMLSchemaWriter::writeConcreteClassifier (UMLClassifier *c, QTextStream &XMLschema) +void XMLSchemaWriter::writeConcreteClassifier (UMLClassifier *c, TQTextStream &XMLschema) { // preparations.. gather information about this classifier @@ -400,11 +400,11 @@ void XMLSchemaWriter::writeConcreteClassifier (UMLClassifier *c, QTextStream &XM } // these exist for abstract classes only (which become xs:group nodes) -QStringList XMLSchemaWriter::findAttributeGroups (UMLClassifier *c) +TQStringList XMLSchemaWriter::findAttributeGroups (UMLClassifier *c) { // we need to look for any class we inherit from. IF these // have attributes, then we need to notice - QStringList list; + TQStringList list; UMLClassifierList superclasses = c->findSuperClassConcepts(); // list of what inherits from us for(UMLClassifier *classifier = superclasses.first(); classifier; classifier = superclasses.next()) { @@ -432,7 +432,7 @@ bool XMLSchemaWriter::determineIfHasChildNodes( UMLClassifier *c) void XMLSchemaWriter::writeChildObjsInAssociation (UMLClassifier *c, UMLAssociationList assoc, - QTextStream &XMLschema) + TQTextStream &XMLschema) { UMLObjectList list = findChildObjsInAssociations (c, assoc); @@ -455,7 +455,7 @@ void XMLSchemaWriter::markAsWritten(UMLClassifier *c) { writtenClassifiers.append(c); } -void XMLSchemaWriter::writeAttributeDecls(UMLAttributeList &attribs, QTextStream &XMLschema ) +void XMLSchemaWriter::writeAttributeDecls(UMLAttributeList &attribs, TQTextStream &XMLschema ) { UMLAttribute *at; @@ -466,13 +466,13 @@ void XMLSchemaWriter::writeAttributeDecls(UMLAttributeList &attribs, QTextStream } -void XMLSchemaWriter::writeAttributeDecl(UMLAttribute *attrib, QTextStream &XMLschema ) +void XMLSchemaWriter::writeAttributeDecl(UMLAttribute *attrib, TQTextStream &XMLschema ) { - QString documentation = attrib->getDoc(); - QString typeName = fixTypeName(attrib->getTypeName()); + TQString documentation = attrib->getDoc(); + TQString typeName = fixTypeName(attrib->getTypeName()); bool isStatic = attrib->getStatic(); - QString initialValue = fixInitialStringDeclValue(attrib->getInitialValue(), typeName); + TQString initialValue = fixInitialStringDeclValue(attrib->getInitialValue(), typeName); if(!documentation.isEmpty()) writeComment(documentation, XMLschema); @@ -497,7 +497,7 @@ void XMLSchemaWriter::writeAttributeDecl(UMLAttribute *attrib, QTextStream &XMLs } -void XMLSchemaWriter::writeAttributeGroupDecl (const QString &elementName, UMLAttributeList &attribs, QTextStream &XMLschema ) +void XMLSchemaWriter::writeAttributeGroupDecl (const TQString &elementName, UMLAttributeList &attribs, TQTextStream &XMLschema ) { if (attribs.count()> 0) { @@ -522,16 +522,16 @@ void XMLSchemaWriter::writeAttributeGroupDecl (const QString &elementName, UMLAt } } -void XMLSchemaWriter::writeComment( const QString &comment, QTextStream &XMLschema ) +void XMLSchemaWriter::writeComment( const TQString &comment, TQTextStream &XMLschema ) { // in the case we have several line comment.. // NOTE: this part of the method has the problem of adopting UNIX newline, // need to resolve for using with MAC/WinDoze eventually I assume - QString indent = getIndent(); + TQString indent = getIndent(); XMLschema<<indent<<"<!-- "; - if (comment.contains(QRegExp("\n"))) { + if (comment.contains(TQRegExp("\n"))) { XMLschema<<m_endl; - QStringList lines = QStringList::split( "\n", comment); + TQStringList lines = TQStringList::split( "\n", comment); for(uint i= 0; i < lines.count(); i++) XMLschema<<indent<<" "<<lines[i]<<m_endl; @@ -550,7 +550,7 @@ void XMLSchemaWriter::writeComment( const QString &comment, QTextStream &XMLsche // badly for someone using a plain association between 2 different classes. THAT should // be done, but isnt yet (this is why I have left role b code in for now). -b.t. bool XMLSchemaWriter::writeAssociationDecls(UMLAssociationList associations, - bool noRoleNameOK, bool didFirstOne, Uml::IDType id, QTextStream &XMLschema) + bool noRoleNameOK, bool didFirstOne, Uml::IDType id, TQTextStream &XMLschema) { if( !associations.isEmpty() ) @@ -637,14 +637,14 @@ UMLObjectList XMLSchemaWriter::findChildObjsInAssociations (UMLClassifier *c, UM return list; } -void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const QString &multi, QTextStream &XMLschema) +void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const TQString &multi, TQTextStream &XMLschema) { bool isAbstract = c->getAbstract(); bool isInterface = c->isInterface(); - QString elementName = getElementName(c); - QString doc = c->getDoc(); + TQString elementName = getElementName(c); + TQString doc = c->getDoc(); if (!doc.isEmpty()) writeComment(doc, XMLschema); @@ -653,8 +653,8 @@ void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const QString // Min/Max Occurs is based on whether it is this a single element // or a List (maxoccurs>1). One day this will be done correctly with special // multiplicity object that we don't have to figure out what it means via regex. - QString minOccurs = "0"; - QString maxOccurs = "unbounded"; + TQString minOccurs = "0"; + TQString maxOccurs = "unbounded"; if (multi.isEmpty()) { // in this case, association will only specify ONE element can exist @@ -664,7 +664,7 @@ void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const QString } else { - QStringList values = QStringList::split( QRegExp("[^\\d{1,}|\\*]"), multi); + TQStringList values = TQStringList::split( TQRegExp("[^\\d{1,}|\\*]"), multi); // could use some improvement here.. for sequences like "0..1,3..5,10" we // don't capture the whole "richness" of the multi. Instead we translate it @@ -673,10 +673,10 @@ void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const QString { // populate both with the actual value as long as our value isnt an asterix // In that case, use special value (from above) - if(values[0].contains(QRegExp("\\d{1,}"))) + if(values[0].contains(TQRegExp("\\d{1,}"))) minOccurs = values[0]; // use first number in sequence - if(values[values.count()-1].contains(QRegExp("\\d{1,}"))) + if(values[values.count()-1].contains(TQRegExp("\\d{1,}"))) maxOccurs = values[values.count()-1]; // use only last number in sequence } } @@ -734,14 +734,14 @@ void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const QString // IF the type is "string" we need to declare it as // the XMLSchema Object "String" (there is no string primative in XMLSchema). // Same thing again for "bool" to "boolean" -QString XMLSchemaWriter::fixTypeName(const QString& string) +TQString XMLSchemaWriter::fixTypeName(const TQString& string) { - // string.replace(QRegExp("^string$"),schemaNamespaceTag+":string"); - // string.replace(QRegExp("^bool$"),schemaNamespaceTag+":boolean"); + // string.replace(TQRegExp("^string$"),schemaNamespaceTag+":string"); + // string.replace(TQRegExp("^bool$"),schemaNamespaceTag+":boolean"); return schemaNamespaceTag + ':' + string; } -QString XMLSchemaWriter::fixInitialStringDeclValue(QString value, const QString &type) +TQString XMLSchemaWriter::fixInitialStringDeclValue(TQString value, const TQString &type) { // check for strings only if (!value.isEmpty() && type == "xs:string") { @@ -753,36 +753,36 @@ QString XMLSchemaWriter::fixInitialStringDeclValue(QString value, const QString return value; } -QString XMLSchemaWriter::getElementName(UMLClassifier *c) +TQString XMLSchemaWriter::getElementName(UMLClassifier *c) { return cleanName(c->getName()); } -QString XMLSchemaWriter::getElementTypeName(UMLClassifier *c) +TQString XMLSchemaWriter::getElementTypeName(UMLClassifier *c) { - QString elementName = getElementName(c); + TQString elementName = getElementName(c); return elementName + "ComplexType"; } -QString XMLSchemaWriter::getElementGroupTypeName(UMLClassifier *c) +TQString XMLSchemaWriter::getElementGroupTypeName(UMLClassifier *c) { - QString elementName = getElementName(c); + TQString elementName = getElementName(c); return elementName + "GroupType"; } -QString XMLSchemaWriter::makePackageTag (QString tagName) { +TQString XMLSchemaWriter::makePackageTag (TQString tagName) { tagName.prepend( packageNamespaceTag + ':'); return tagName; } -QString XMLSchemaWriter::makeSchemaTag (QString tagName) { +TQString XMLSchemaWriter::makeSchemaTag (TQString tagName) { tagName.prepend( schemaNamespaceTag + ':'); return tagName; } -const QStringList XMLSchemaWriter::reservedKeywords() const { +const TQStringList XMLSchemaWriter::reservedKeywords() const { - static QStringList keywords; + static TQStringList keywords; if (keywords.isEmpty()) { keywords << "ATTLIST" |