X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Frect.h;fp=src%2Frect.h;h=a79f6ac441da510ee438b3fc6720a511682fd3d9;hp=0000000000000000000000000000000000000000;hb=f59f24dff392428d7219ba2d6be5e1e81c344ee0;hpb=d3e941df79b54b698a5b8a1d4763346c4d6eb3d7;ds=sidebyside diff --git a/src/rect.h b/src/rect.h new file mode 100644 index 0000000..a79f6ac --- /dev/null +++ b/src/rect.h @@ -0,0 +1,24 @@ +#ifndef _RECT_H +#define _RECT_H + +#include "common.h" +#include "real.h" + +namespace IPDF +{ + struct Rect + { + Real x; Real y; Real w; Real h; + Rect() = default; // Needed so we can fread/fwrite this struct + Rect(Real _x, Real _y, Real _w, Real _h) : x(_x), y(_y), w(_w), h(_h) {} + std::string Str() const + { + std::stringstream s; + // float conversion needed because it is fucking impossible to get ostreams working with template classes + s << "{" << Float(x) << ", " << Float(y) << ", " << Float(w) << ", " << Float(h) << "}"; + return s.str(); + } + }; +} + +#endif //_RECT_H