Ver código fonte

LibGfx: Add formatter for Rect.

asynts 4 anos atrás
pai
commit
3b601cd4bd
1 arquivos alterados com 13 adições e 0 exclusões
  1. 13 0
      Libraries/LibGfx/Rect.h

+ 13 - 0
Libraries/LibGfx/Rect.h

@@ -26,6 +26,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <AK/Format.h>
 #include <LibGfx/Orientation.h>
 #include <LibGfx/Orientation.h>
 #include <LibGfx/Point.h>
 #include <LibGfx/Point.h>
 #include <LibGfx/Size.h>
 #include <LibGfx/Size.h>
@@ -411,6 +412,18 @@ ALWAYS_INLINE IntRect enclosing_int_rect(const FloatRect& float_rect)
 
 
 }
 }
 
 
+namespace AK {
+
+template<typename T>
+struct Formatter<Gfx::Rect<T>> : Formatter<StringView> {
+    void format(TypeErasedFormatParams& params, FormatBuilder& builder, const Gfx::Rect<T>& value)
+    {
+        Formatter<StringView>::format(params, builder, value.to_string());
+    }
+};
+
+}
+
 namespace IPC {
 namespace IPC {
 
 
 bool decode(Decoder&, Gfx::IntRect&);
 bool decode(Decoder&, Gfx::IntRect&);