1// LAF Gfx Library
2// Copyright (C) 2020-2021 Igara Studio S.A.
3// Copyright (C) 2001-2016 David Capello
4//
5// This file is released under the terms of the MIT license.
6// Read LICENSE.txt for more information.
7
8#ifndef GFX_RECT_IO_H_INCLUDED
9#define GFX_RECT_IO_H_INCLUDED
10#pragma once
11
12#include "gfx/rect.h"
13#include <iostream>
14
15namespace gfx {
16
17 template<typename T>
18 inline std::ostream& operator<<(std::ostream& os, const RectT<T>& rect) {
19 return os << "("
20 << rect.x << ", "
21 << rect.y << ", "
22 << rect.w << ", "
23 << rect.h << ")";
24 }
25
26 template<typename T>
27 inline std::istream& operator>>(std::istream& in, RectT<T>& rect) {
28 while (in && in.get() != '(')
29 ;
30
31 if (!in)
32 return in;
33
34 char chr;
35 in >> rect.x >> chr
36 >> rect.y >> chr
37 >> rect.w >> chr
38 >> rect.h >> chr;
39
40 return in;
41 }
42
43}
44
45#endif
46