[Uml-devel] KDE/kdesdk/umbrello/umbrello/codegenerators

Andi Fischer andi.fischer at hispeed.ch
Wed Oct 1 21:38:22 UTC 2008


SVN commit 866776 by fischer:

Krazy: fixing postfix usage of ++ and --.

 M  +3 -8      as/aswriter.cpp  
 M  +5 -5      cpp/cppwriter.cpp  
 M  +3 -2      csharp/csharpwriter.cpp  
 M  +4 -3      d/dwriter.cpp  
 M  +3 -3      idl/idlwriter.cpp  
 M  +1 -1      php/phpwriter.cpp  
 M  +1 -3      sql/sqlwriter.cpp  
 M  +4 -3      tcl/tclwriter.cpp  
 M  +2 -1      xml/xmlschemawriter.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/as/aswriter.cpp #866775:866776
@@ -1,16 +1,11 @@
 /***************************************************************************
-    begin                : Sat Feb 08 2003
-    copyright            : (C) 2003 by Alexander Blum
-    email                : blum at kewbee.de
- ***************************************************************************/
-
-/***************************************************************************
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2004-2007                                               *
+ *   copyright (C) 2003      Alexander Blum <blum at kewbee.de>               *
+ *   copyright (C) 2004-2008                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -299,7 +294,7 @@
 
         int i= atl.count();
         int j=0;
-        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext(); j++ ) {
+        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext(); ++j) {
             UMLAttribute* at = atlIt.next();
             as << cleanName(at->getName())
             << (!(at->getInitialValue().isEmpty()) ? (QString(" = ")+at->getInitialValue()) : QString(""))
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cpp/cppwriter.cpp #866775:866776
@@ -51,7 +51,7 @@
     // allows you to specify where the vector variable should be in your code,
     // and "%ITEMCLASS%", if needed, where the class of the item is declared.
     VECTOR_METHOD_APPEND = "%VARNAME%.push_back(add_object);"; // for std::vector
-    VECTOR_METHOD_REMOVE = "int i, size = %VARNAME%.size();\nfor ( i = 0; i < size; i++) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == remove_object) {\n\t\tvector<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }"; // for std::vector
+    VECTOR_METHOD_REMOVE = "int i, size = %VARNAME%.size();\nfor ( i = 0; i < size; ++i) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == remove_object) {\n\t\tvector<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }"; // for std::vector
     VECTOR_METHOD_INIT.clear(); // nothing to be done
     /*
         VECTOR_METHOD_APPEND = "%VARNAME%.append(&add_object);"; // Qt lib implementation
@@ -582,7 +582,7 @@
     if (comment.contains(QRegExp("\n"))) {
 
         QStringList lines = comment.split( '\n' );
-        for (int i= 0; i < lines.count(); i++)
+        for (int i= 0; i < lines.count(); ++i)
         {
             cpp << myIndent << "// " << lines[i] << m_endl;
         }
@@ -606,7 +606,7 @@
     if (!end.isEmpty())
     {
         QStringList lines = end.split( '\n' );
-        for (int i= 0; i < lines.count(); i++)
+        for (int i = 0; i < lines.count(); ++i)
             cpp << formatDoc(lines[i], indent + " * ");
     }
     cpp << indent << " */" << m_endl;
@@ -1099,7 +1099,7 @@
 
         // generate parameters
         uint j = 0;
-        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext() ; j++) {
+        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext() ; ++j) {
             UMLAttribute* at = atlIt.next();
             QString typeName = fixTypeName(at->getTypeName());
             QString atName = cleanName(at->getName());
@@ -1201,7 +1201,7 @@
         return;
 
     QStringList lines = text.split( '\n' );
-    for (int i= 0; i < lines.count(); i++)
+    for (int i= 0; i < lines.count(); ++i)
         stream << indent << lines[i] << m_endl;
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/csharp/csharpwriter.cpp #866775:866776
@@ -508,7 +508,7 @@
         // method parameters
         int i= atl.count();
         int j=0;
-        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext() ; j++) {
+        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext(); ++j) {
             UMLAttribute* at = atlIt.next();
             cs << makeLocalTypeName(at) << " " << cleanName(at->getName());
 
@@ -713,8 +713,9 @@
     static QStringList keywords;
 
     if (keywords.isEmpty()) {
-        for (int i = 0; reserved_words[i]; i++)
+        for (int i = 0; reserved_words[i]; ++i) {
             keywords.append(reserved_words[i]);
+        }
     }
 
     return keywords;
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/d/dwriter.cpp #866775:866776
@@ -472,10 +472,11 @@
     if (!end.isEmpty())
     {
         QStringList lines = end.split( "\n" );
-        for (int i= 0; i < lines.count(); i++)
+        for (int i= 0; i < lines.count(); ++i) {
             d << formatDoc(lines[i], indent + " * ");
+        }
     }
-    d<<indent<< " */" << m_endl;
+    d << indent << " */" << m_endl;
 }
 
 void DWriter::writeAssociationDecls(UMLAssociationList associations, Uml::IDType id, QTextStream &d)
@@ -893,7 +894,7 @@
         atl = op->getParmList();
         int i = atl.count();
         int j = 0;
-        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext();  j++) {
+        for (UMLAttributeListIt atlIt( atl ); atlIt.hasNext();  ++j) {
             UMLAttribute* at = atlIt.next();
             QString typeName = fixTypeName(at->getTypeName());
             QString atName = cleanName(at->getName());
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/idl/idlwriter.cpp #866775:866776
@@ -184,7 +184,7 @@
         m_indentLevel--;
         idl << getIndent() << "};" << m_endl << m_endl;
         // Close the modules inside which we might be nested.
-        for (int i = 0; i < pkgList.count(); i++) {
+        for (int i = 0; i < pkgList.count(); ++i) {
             m_indentLevel--;
             idl << getIndent() << "};" << m_endl << m_endl;
         }
@@ -260,7 +260,7 @@
             idl << getIndent() << "// " << stype << ": Unknown stereotype" << m_endl << m_endl;
         }
         // Close the modules inside which we might be nested.
-        for (int i = 0; i < pkgList.count(); i++) {
+        for (int i = 0; i < pkgList.count(); ++i) {
             m_indentLevel--;
             idl << getIndent() << "};" << m_endl << m_endl;
         }
@@ -379,7 +379,7 @@
     idl << getIndent() << "};" << m_endl << m_endl;
 
     // Close the modules inside which we might be nested.
-    for (int i = 0; i < pkgList.count(); i++) {
+    for (int i = 0; i < pkgList.count(); ++i) {
         m_indentLevel--;
         idl << getIndent() << "};" << m_endl << m_endl;
     }
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/php/phpwriter.cpp #866775:866776
@@ -3325,7 +3325,7 @@
     static QStringList keywords;
 
     if (keywords.isEmpty()) {
-        for (int i = 0; words[i]; i++)
+        for (int i = 0; words[i]; ++i)
             keywords.append(words[i]);
     }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/sql/sqlwriter.cpp #866775:866776
@@ -141,17 +141,15 @@
     }
 
     QMap<UMLAssociation*,UMLAssociation*>::Iterator itor = constraintMap.begin();
-    for (;itor != constraintMap.end();itor++) {
+    for (; itor != constraintMap.end(); ++itor) {
         UMLAssociation* a = itor.value();
         sql << "ALTER TABLE "<< entityname
             << " ADD CONSTRAINT " << a->getName() << " FOREIGN KEY ("
             << a->getRoleName(Uml::B) << ") REFERENCES "
             << a->getObject(Uml::A)->getName()
             << " (" << a->getRoleName(Uml::A) << ");" << m_endl;
-
     }
 
-
     file.close();
     emit codeGenerated(m_pEntity, true);
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/tcl/tclwriter.cpp #866775:866776
@@ -355,7 +355,7 @@
 void TclWriter::writeComm(const QString &text)
 {
     QStringList lines = text.split(QRegExp("\n"));
-    for (int i = 0; i < lines.count(); i++) {
+    for (int i = 0; i < lines.count(); ++i) {
         *mStream << getIndent() << "# " << lines[i] << m_endl;
     }
 }
@@ -363,7 +363,7 @@
 void TclWriter::writeDocu(const QString &text)
 {
     QStringList lines = text.split(QRegExp("\n"));
-    for (int i = 0; i < lines.count(); i++) {
+    for (int i = 0; i < lines.count(); ++i) {
         *mStream << getIndent() << "## " << lines[i] << m_endl;
     }
 }
@@ -879,8 +879,9 @@
 
     if (keywords.isEmpty())
     {
-        for (int i = 0; tclwords[i]; i++)
+        for (int i = 0; tclwords[i]; ++i) {
             keywords.append(tclwords[i]);
+        }
     }
     return keywords;
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/xml/xmlschemawriter.cpp #866775:866776
@@ -328,9 +328,10 @@
         if(hasAttributes)
         {
             writeAttributeDecls(attribs, XMLschema);
-            for (int i= 0; i < attribGroups.count(); i++)
+            for (int i= 0; i < attribGroups.count(); ++i) {
                 XMLschema<<getIndent()<<"<"<<makeSchemaTag("attributeGroup")<<" ref=\""
                 <<makePackageTag(attribGroups[i])<<"\"/>"<<m_endl;
+            }
         }
 
         if(hasSuperclass)




More information about the umbrello-devel mailing list