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_POINT_IO_H_INCLUDED
8#define GFX_POINT_IO_H_INCLUDED
9#pragma once
10
11#include "gfx/point.h"
12#include <iostream>
13
14namespace gfx {
15
16 template<typename T>
17 inline std::ostream& operator<<(std::ostream& os, const PointT<T>& point) {
18 return os << "("
19 << point.x << ", "
20 << point.y << ")";
21 }
22
23 template<typename T>
24 inline std::istream& operator>>(std::istream& in, PointT<T>& point) {
25 while (in && in.get() != '(')
26 ;
27
28 if (!in)
29 return in;
30
31 char chr;
32 in >> point.x >> chr
33 >> point.y;
34
35 return in;
36 }
37
38}
39
40#endif
41