[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/interfaces/ktexteditor
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2010-04-22 17:44:36
Message-ID: 20100422174436.9EDD1AC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1117653 by cullmann:

add debug stream output for new ranges, like for old ones

 M  +25 -0     movingcursor.h  
 M  +24 -0     movingrange.h  


--- trunk/KDE/kdelibs/interfaces/ktexteditor/movingcursor.h #1117652:1117653
@@ -24,6 +24,7 @@
 #ifndef KDELIBS_KTEXTEDITOR_MOVINGCURSOR_H
 #define KDELIBS_KTEXTEDITOR_MOVINGCURSOR_H
 
+#include <kdebug.h>
 #include <ktexteditor/ktexteditor_export.h>
 #include <ktexteditor/cursor.h>
 
@@ -182,6 +183,30 @@
      * @return normal cursor
      */
     operator const Cursor () const { return Cursor (line(), column()); }
+
+    /**
+     * kDebug() stream operator. Writes this cursor to the debug output in a nicely formatted way.
+     * @param s debug stream
+     * @param cursor cursor to print
+     * @return debug stream
+     */
+    inline friend QDebug operator<< (QDebug s, const MovingCursor *cursor) {
+      if (cursor)
+        s.nospace() << "(" << cursor->line() << ", " << cursor->column() << ")";
+      else
+        s.nospace() << "(null cursor)";
+      return s.space();
+    }
+
+    /**
+     * kDebug() stream operator. Writes this cursor to the debug output in a nicely formatted way.
+     * @param s debug stream
+     * @param cursor cursor to print
+     * @return debug stream
+     */
+    inline friend QDebug operator<< (QDebug s, const MovingCursor &cursor) {
+      return s << &cursor;
+    }
 };
 
 }
--- trunk/KDE/kdelibs/interfaces/ktexteditor/movingrange.h #1117652:1117653
@@ -237,6 +237,30 @@
      * @return normal range
      */
     operator const Range () const { return Range (start().toCursor(), end().toCursor()); }
+
+    /**
+     * kDebug() stream operator. Writes this range to the debug output in a nicely formatted way.
+     * @param s debug stream
+     * @param cursor range to print
+     * @return debug stream
+     */
+    inline friend QDebug operator<< (QDebug s, const MovingRange *range) {
+      if (range)
+        s << "[" << range->start() << " -> " << range->end() << "]";
+      else
+        s << "(null range)";
+      return s.space();
+    }
+
+    /**
+     * kDebug() stream operator. Writes this range to the debug output in a nicely formatted way.
+     * @param s debug stream
+     * @param range range to print
+     * @return debug stream
+     */
+    inline friend QDebug operator<< (QDebug s, const MovingRange &range) {
+      return s << &range;
+    }
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(MovingRange::InsertBehaviors)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic