3 #include <boost/lexical_cast.hpp>
4 #include <boost/algorithm/string.hpp>
6 #include "exceptions.h"
9 using namespace libdcp;
10 using namespace boost;
12 Fraction::Fraction (string s)
15 split (b, s, is_any_of (" "));
17 throw XMLError ("malformed fraction " + s + " in XML node");
19 numerator = lexical_cast<int> (b[0]);
20 denominator = lexical_cast<int> (b[1]);
31 Color::Color (int r_, int g_, int b_)
39 Color::Color (string argb_hex)
42 if (sscanf (argb_hex.c_str(), "%2x%2x%2x%2x", &alpha, &r, &g, &b) < 4) {
43 throw XMLError ("could not parse colour string");
49 libdcp::operator== (Color const & a, Color const & b)
51 return (a.r == b.r && a.g == b.g && a.b == b.b);
55 libdcp::operator<< (ostream& s, Color const & c)
57 s << "(" << c.r << ", " << c.g << ", " << c.b << ")";