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

Oliver Kellogg okellogg at users.sourceforge.net
Sun Sep 2 10:26:06 UTC 2007


SVN commit 707581 by okellogg:

EBN Krazy #18 (inappropriate pass-by-value function args)

 M  +8 -1      csharpwriter.cpp  
 M  +8 -1      csharpwriter.h  
 M  +6 -4      dwriter.cpp  
 M  +4 -4      dwriter.h  
 M  +2 -1      javawriter.cpp  
 M  +1 -1      javawriter.h  
 M  +3 -2      phpwriter.cpp  
 M  +2 -1      phpwriter.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/csharpwriter.cpp #707580:707581
@@ -628,7 +628,14 @@
     }
 }
 
-void CSharpWriter::writeAttribute(QString doc, Uml::Visibility visibility, bool isStatic, QString typeName, QString name, QString initialValue, bool asProperty, QTextStream &cs) {
+void CSharpWriter::writeAttribute(const QString& doc,
+                                  Uml::Visibility visibility,
+                                  bool isStatic,
+                                  const QString& typeName,
+                                  const QString& name,
+                                  const QString& initialValue,
+                                  bool asProperty,
+                                  QTextStream &cs) {
 
     if (forceDoc() || !doc.isEmpty()) {
 
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/csharpwriter.h #707580:707581
@@ -150,7 +150,14 @@
       * @param asProperty true writes as property (get/set), false writes single line variable
       * @param cs output stream
       */
-    void writeAttribute(QString doc, Uml::Visibility visibility, bool isStatic, QString typeName, QString name, QString initialValue, bool asProperty, QTextStream &cs);
+    void writeAttribute(const QString& doc,
+                        Uml::Visibility visibility,
+                        bool isStatic,
+                        const QString& typeName,
+                        const QString& name,
+                        const QString& initialValue,
+                        bool asProperty,
+                        QTextStream &cs);
 
     /** find the type in used namespaces, if namespace found return short name, complete otherwise.
       *
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/dwriter.cpp #707580:707581
@@ -899,7 +899,8 @@
     }
 }
 
-QString DWriter::fixInitialStringDeclValue(QString value, QString type) {
+QString DWriter::fixInitialStringDeclValue(const QString& val, const QString& type) {
+    QString value = val;
     // check for strings only
     if (!value.isEmpty() && type == "String") {
         if (!value.startsWith('"'))
@@ -928,16 +929,17 @@
     return(obj!=0)?obj->getName():QString("NULL");
 }
 
-QString DWriter::deCapitaliseFirstLetter(QString string) {
+QString DWriter::deCapitaliseFirstLetter(const QString& str) {
+    QString string = str;
     string.replace( 0, 1, string[0].lower());
     return string;
 }
 
-QString DWriter::pluralize(QString string) {
+QString DWriter::pluralize(const QString& string) {
     return string + (string.right(1) == "s" ? "es" : "s");
 }
 
-QString DWriter::unPluralize(QString string) {
+QString DWriter::unPluralize(const QString& string) {
     // does not handle special cases liek datum -> data, etc.
 
     if (string.count() > 2 && string.right(3) == "ses") {
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/dwriter.h #707580:707581
@@ -227,17 +227,17 @@
     /**
      * Lowers the case of the first letter in the given string
      */
-    QString deCapitaliseFirstLetter(QString string);
+    QString deCapitaliseFirstLetter(const QString& str);
 
     /**
      * Returns the plural form of a subject.
      */
-    QString pluralize(QString string);
+    QString pluralize(const QString& string);
  
     /**
      * Returns the non-plural form of a subject.
      */
-    QString unPluralize(QString string);
+    QString unPluralize(const QString& str);
     
     /**
      * Replaces `string' with `String' and `bool' with `boolean'
@@ -247,7 +247,7 @@
     /**
      * check that initial values of strings have quotes around them
      */
-    QString fixInitialStringDeclValue(QString value, QString type);
+    QString fixInitialStringDeclValue(const QString& val, const QString& type);
 
     /**
      * Write a blank line
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/javawriter.cpp #707580:707581
@@ -869,8 +869,9 @@
     }
 }
 
-QString JavaWriter::fixInitialStringDeclValue(QString value, QString type)
+QString JavaWriter::fixInitialStringDeclValue(const QString& val, QString type)
 {
+    QString value = val;
     // check for strings only
     if (!value.isEmpty() && type == "String") {
         if (!value.startsWith('"'))
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/javawriter.h #707580:707581
@@ -207,7 +207,7 @@
     /**
      * check that initial values of strings have quotes around them
      */
-    QString fixInitialStringDeclValue(QString value, QString type);
+    QString fixInitialStringDeclValue(const QString& val, QString type);
 
     /**
      * Write a blank line
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/phpwriter.cpp #707580:707581
@@ -3181,8 +3181,9 @@
     }
 }
 
-void PhpWriter::writeOperations(QString /* classname */, UMLOperationList &opList, QTextStream &php) {
-
+void PhpWriter::writeOperations(const QString& /* classname */,
+                                UMLOperationList &opList,
+                                QTextStream &php) {
     foreach (UMLOperation* op , opList ) {
         UMLAttributeList atl = op->getParmList();
         //write method doc if we have doc || if at least one of the params has doc
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/phpwriter.h #707580:707581
@@ -71,7 +71,8 @@
       * @param opList the list of operations
       * @param php output stream for the PHP file
       */
-    void writeOperations(QString classname, UMLOperationList &opList,
+    void writeOperations(const QString& classname,
+                         UMLOperationList &opList,
                          QTextStream &php);
 
     /** write all the attributes of a class




More information about the umbrello-devel mailing list