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

Andi Fischer andi.fischer at hispeed.ch
Sat Oct 8 13:53:01 UTC 2011


SVN commit 1257959 by fischer:

Debug output improved.

 M  +4 -3      codegenerators/codeblock.cpp  
 M  +2 -4      codegenerators/codeblock.h  
 M  +3 -3      codegenerators/codedocument.cpp  
 M  +2 -4      codegenerators/codedocument.h  
 M  +4 -3      codegenerators/textblock.cpp  
 M  +3 -5      codegenerators/textblock.h  
 M  +11 -0     folder.cpp  
 M  +2 -0      folder.h  
 M  +3 -2      umlobject.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codeblock.cpp #1257958:1257959
@@ -12,6 +12,7 @@
 #include "codeblock.h"
 
 #include "codedocument.h"
+#include "debug_utils.h"
 
 #include <QtCore/QTextStream>
 
@@ -133,9 +134,9 @@
     }
 }
 
-QTextStream& operator<<(QTextStream& str, const CodeBlock& obj)
+QDebug operator<<(QDebug str, const CodeBlock& obj)
 {
-    str << "CodeBlock: " << CodeBlock::enumToString(obj.contentType())
+    str.nospace() << "CodeBlock: " << CodeBlock::enumToString(obj.contentType())
         << ", ..." << static_cast<TextBlock*>(const_cast<CodeBlock*>(&obj));
-    return str;
+    return str.space();
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codeblock.h #1257958:1257959
@@ -42,13 +42,13 @@
 
     virtual void setAttributesFromObject(TextBlock * obj);
 
+    friend QDebug operator<<(QDebug str, const CodeBlock& obj);
+
 protected:
 
     virtual void setAttributesOnNode(QDomDocument & doc, QDomElement & blockElement);
     virtual void setAttributesFromNode(QDomElement & element);
 
-    friend QTextStream& operator<<(QTextStream& str, const CodeBlock& obj);
-
 private:
 
     // specifies whether the content (text) of this object
@@ -57,6 +57,4 @@
 
 };
 
-QTextStream& operator<<(QTextStream& str, const CodeBlock& obj);
-
 #endif // CODEBLOCK_H
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codedocument.cpp #1257958:1257959
@@ -519,9 +519,9 @@
     return NULL;
 }
 
-QTextStream& operator<<(QTextStream& os, const CodeDocument& obj)
+QDebug operator<<(QDebug os, const CodeDocument& obj)
 {
-    os << "CodeDocument: id=" << obj.getID()
+    os.nospace() << "CodeDocument: id=" << obj.getID()
        << " , file=" << obj.getFileName();  //:TODO: add all attributes
-    return os;
+    return os.space();
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codedocument.h #1257958:1257959
@@ -79,6 +79,8 @@
 
     virtual void updateContent();
 
+    friend QDebug operator<<(QDebug os, const CodeDocument& obj);
+
 protected:
 
     virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
@@ -99,8 +101,6 @@
 
     virtual TextBlock * findCodeClassFieldTextBlockByTag( const QString &tag );
 
-    friend QTextStream& operator<<(QTextStream& os, const CodeDocument& obj);
-
 private:
 
     int m_lastTagIndex;
@@ -120,6 +120,4 @@
 
 };
 
-QTextStream& operator<<(QTextStream& os, const CodeDocument& obj);
-
 #endif // CODEDOCUMENT_H
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/textblock.cpp #1257958:1257959
@@ -15,6 +15,7 @@
 // local includes
 #include "codedocument.h"
 #include "codegenerationpolicy.h"
+#include "debug_utils.h"
 #include "uml.h"
 
 // qt includes
@@ -415,13 +416,13 @@
 /**
  * Operator '<<' for TextBlock.
  */
-QTextStream& operator<<(QTextStream& os, const TextBlock& obj)
+QDebug operator<<(QDebug os, const TextBlock& obj)
 {
-    os << "TextBlock: tag=" << obj.getTag()
+    os.nospace() << "TextBlock: tag=" << obj.getTag()
        << ", writeOutText=" << (obj.getWriteOutText() ? "true" : "false")
        << ", canDelete=" << (obj.canDelete() ? "true" : "false")
        << ", indentationLevel=" << obj.getIndentationLevel()
        << ", parentDocument id=" << (obj.getParentDocument() ? obj.getParentDocument()->getID() : "null")
        << ", text=" << obj.getText();
-    return os;
+    return os.space();
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/textblock.h #1257958:1257959
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2009                                               *
+ *   copyright (C) 2004-2011                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -84,6 +84,8 @@
     virtual int firstEditableLine();
     virtual int lastEditableLine();
 
+    friend QDebug operator<<(QDebug os, const TextBlock& obj);
+
 protected:
 
     void setCanDelete(bool canDelete);
@@ -93,8 +95,6 @@
     virtual void setAttributesOnNode(QDomDocument & doc, QDomElement & blockElement);
     virtual void setAttributesFromNode(QDomElement & root);
 
-    friend QTextStream& operator<<(QTextStream& os, const TextBlock& obj);
-
 private:
 
     QString m_text;   //< The actual text of this code block.
@@ -106,6 +106,4 @@
 
 };
 
-QTextStream& operator<<(QTextStream& os, const TextBlock& obj);
-
 #endif // TEXTBLOCK_H
--- trunk/KDE/kdesdk/umbrello/umbrello/folder.cpp #1257958:1257959
@@ -524,4 +524,15 @@
     return totalSuccess;
 }
 
+/**
+ * Overloading operator for debugging output.
+ */
+QDebug operator<<(QDebug out, const UMLFolder& item)
+{
+    out.nospace() << "UMLFolder: localName=" << item.m_localName
+        << ", folderFile=" << item.m_folderFile
+        << ", diagrams=" << item.m_diagrams.count();
+    return out.space();
+}
+
 #include "folder.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/folder.h #1257958:1257959
@@ -61,6 +61,8 @@
 
     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
 
+    friend QDebug operator<<(QDebug out, const UMLFolder& item);
+
 protected:
     void saveContents(QDomDocument& qDoc, QDomElement& qElement);
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #1257958:1257959
@@ -1059,8 +1059,9 @@
  */
 QDebug operator<<(QDebug out, const UMLObject& obj)
 {
-    out << obj.name();
-    return out;
+    out.nospace() << "UMLObject: name= " << obj.name()
+        << ", type= " << UMLObject::toString(obj.m_BaseType);
+    return out.space();
 }
 
 #include "umlobject.moc"




More information about the umbrello-devel mailing list