[Uml-devel] branches/work/soc-umbrello/umbrello/codegenerators

Andi Fischer andi.fischer at hispeed.ch
Sat Oct 8 13:09:36 UTC 2011


SVN commit 1257954 by fischer:

Debug output improved.

 M  +4 -3      codeblock.cpp  
 M  +2 -4      codeblock.h  
 M  +3 -3      codedocument.cpp  
 M  +2 -4      codedocument.h  
 M  +4 -3      textblock.cpp  
 M  +3 -5      textblock.h  


--- branches/work/soc-umbrello/umbrello/codegenerators/codeblock.cpp #1257953:1257954
@@ -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();
 }
--- branches/work/soc-umbrello/umbrello/codegenerators/codeblock.h #1257953:1257954
@@ -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
--- branches/work/soc-umbrello/umbrello/codegenerators/codedocument.cpp #1257953:1257954
@@ -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();
 }
--- branches/work/soc-umbrello/umbrello/codegenerators/codedocument.h #1257953:1257954
@@ -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
--- branches/work/soc-umbrello/umbrello/codegenerators/textblock.cpp #1257953:1257954
@@ -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();
 }
--- branches/work/soc-umbrello/umbrello/codegenerators/textblock.h #1257953:1257954
@@ -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




More information about the umbrello-devel mailing list