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