using namespace dcp;
using namespace boost;
+bool dcp::operator== (dcp::Size const & a, dcp::Size const & b)
+{
+ return (a.width == b.width && a.height == b.height);
+}
+
+bool dcp::operator!= (dcp::Size const & a, dcp::Size const & b)
+{
+ return !(a == b);
+}
+
+ostream& dcp::operator<< (ostream& s, dcp::Size const & a)
+{
+ s << a.width << "x" << a.height;
+ return s;
+}
+
/** Construct a Fraction from a string of the form <numerator> <denominator>
* e.g. "1 3".
*/
string
Colour::to_argb_string () const
{
- locked_stringstream s;
- s << "FF";
- s << hex
- << setw(2) << setfill('0') << r
- << setw(2) << setfill('0') << g
- << setw(2) << setfill('0') << b;
-
- string t = s.str();
- to_upper (t);
- return t;
+ char buffer[9];
+ snprintf (buffer, sizeof(buffer), "FF%02X%02X%02X", r, g, b);
+ return buffer;
+}
+
+/** @return An RGB string of the form RRGGBB, where e.g. RR is a two-character
+ * hex value.
+ */
+string
+Colour::to_rgb_string () const
+{
+ char buffer[7];
+ snprintf (buffer, sizeof(buffer), "%02X%02X%02X", r, g, b);
+ return buffer;
}
/** operator== for Colours.