Bug 939604 - Add support for more types to mozilla::gfx::Log. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Mon, 18 Nov 2013 14:29:54 +0000
changeset 170704 5775fb538d2b52df5f5b8795130e1bcee253b7ef
parent 170703 ef5d7b35634bbce9107698b1bd377101bcbeea51
child 170705 31c689d4df9cac91e874d4a6373e18bced25fec5
push idunknown
push userunknown
push dateunknown
reviewersBas
bugs939604
milestone28.0a1
Bug 939604 - Add support for more types to mozilla::gfx::Log. r=Bas
gfx/2d/Logging.h
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -74,23 +74,32 @@ public:
 template<int L>
 class Log
 {
 public:
   Log() {}
   ~Log() { mMessage << '\n'; WriteLog(mMessage.str()); }
 
   Log &operator <<(const std::string &aLogText) { mMessage << aLogText; return *this; }
+  Log &operator <<(const char aStr[]) { mMessage << static_cast<const char*>(aStr); return *this; }
+  Log &operator <<(bool aBool) { mMessage << (aBool ? "true" : "false"); return *this; }
+  Log &operator <<(int aInt) { mMessage << aInt; return *this; }
   Log &operator <<(unsigned int aInt) { mMessage << aInt; return *this; }
+  Log &operator <<(Float aFloat) { mMessage << aFloat; return *this; }
+  Log &operator <<(double aDouble) { mMessage << aDouble; return *this; }
+  Log &operator <<(const Point &aPoint)
+    { mMessage << "Point(" << aPoint.x << "," << aPoint.y << ")"; return *this; }
   Log &operator <<(const Size &aSize)
-    { mMessage << "(" << aSize.width << "x" << aSize.height << ")"; return *this; }
+    { mMessage << "Size(" << aSize.width << "," << aSize.height << ")"; return *this; }
   Log &operator <<(const IntSize &aSize)
-    { mMessage << "(" << aSize.width << "x" << aSize.height << ")"; return *this; }
+    { mMessage << "IntSize(" << aSize.width << "," << aSize.height << ")"; return *this; }
+  Log &operator <<(const Rect &aRect)
+    { mMessage << "Rect(" << aRect.x << "," << aRect.y << "," << aRect.width << "," << aRect.height << ")"; return *this; }
   Log &operator<<(const Matrix& aMatrix)
-    { mMessage << "[ " << aMatrix._11 << " " << aMatrix._12 << " ; " << aMatrix._21 << " " << aMatrix._22 << " ; " << aMatrix._31 << " " << aMatrix._32 << " ]"; return *this; }
+    { mMessage << "Matrix(" << aMatrix._11 << " " << aMatrix._12 << " ; " << aMatrix._21 << " " << aMatrix._22 << " ; " << aMatrix._31 << " " << aMatrix._32 << ")"; return *this; }
 
 
 private:
 
   void WriteLog(const std::string &aString) {
     OutputMessage(aString, L);
   }