istream parse rectangles

This commit is contained in:
2024-08-23 20:47:29 -05:00
committed by Celtic Minstrel
parent 336d0e626b
commit e9b4aae524
2 changed files with 18 additions and 0 deletions

View File

@@ -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 << '"';

View File

@@ -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