forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rect_io.h
42 lines (32 loc) · 814 Bytes
/
rect_io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Aseprite Gfx Library
// Copyright (C) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef GFX_RECT_IO_H_INCLUDED
#define GFX_RECT_IO_H_INCLUDED
#pragma once
#include "gfx/rect.h"
#include <iosfwd>
namespace gfx {
inline std::ostream& operator<<(std::ostream& os, const Rect& rect) {
return os << "("
<< rect.x << ", "
<< rect.y << ", "
<< rect.w << ", "
<< rect.h << ")";
}
inline std::istream& operator>>(std::istream& in, Rect& rect) {
while (in && in.get() != '(')
;
if (!in)
return in;
char chr;
in >> rect.x >> chr
>> rect.y >> chr
>> rect.w >> chr
>> rect.h >> chr;
return in;
}
}
#endif