istream parse rectangles
This commit is contained in:
@@ -269,6 +269,23 @@ std::ostream& operator<< (std::ostream& out, rectangle r) {
|
||||
return out;
|
||||
}
|
||||
|
||||
std::istream& operator>> (std::istream& in, rectangle& r) {
|
||||
location tl;
|
||||
location br;
|
||||
in.get(); // {
|
||||
in >> tl;
|
||||
in.get(); //
|
||||
in.get(); // -
|
||||
in.get(); //
|
||||
in >> br;
|
||||
in.get(); // }
|
||||
r.top = tl.y;
|
||||
r.left = tl.x;
|
||||
r.bottom = br.y;
|
||||
r.right = br.x;
|
||||
return in;
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& out, info_rect_t r) {
|
||||
out << static_cast<rectangle&>(r);
|
||||
out << " -- \"" << r.descr << '"';
|
||||
|
@@ -169,6 +169,7 @@ std::istream& operator>> (std::istream& in, location& l);
|
||||
std::ostream& operator<< (std::ostream& out, spec_loc_t l);
|
||||
std::ostream& operator<< (std::ostream& out, sign_loc_t l);
|
||||
std::ostream& operator<< (std::ostream& out, rectangle r);
|
||||
std::istream& operator>> (std::istream& in, rectangle& r);
|
||||
std::ostream& operator<< (std::ostream& out, info_rect_t r);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user