*/
+#include "raw_convert.h"
+#include "types.h"
+#include "exceptions.h"
+#include <boost/algorithm/string.hpp>
#include <vector>
#include <cstdio>
#include <iomanip>
-#include <boost/lexical_cast.hpp>
-#include <boost/algorithm/string.hpp>
-#include "types.h"
-#include "exceptions.h"
-#include "raw_convert.h"
using namespace std;
-using namespace libdcp;
+using namespace dcp;
using namespace boost;
+/** Construct a Fraction from a string of the form <numerator> <denominator>
+ * e.g. "1 3".
+ */
Fraction::Fraction (string s)
{
vector<string> b;
}
bool
-libdcp::operator== (Fraction const & a, Fraction const & b)
+dcp::operator== (Fraction const & a, Fraction const & b)
{
return (a.numerator == b.numerator && a.denominator == b.denominator);
}
bool
-libdcp::operator!= (Fraction const & a, Fraction const & b)
+dcp::operator!= (Fraction const & a, Fraction const & b)
{
return (a.numerator != b.numerator || a.denominator != b.denominator);
}
-Color::Color ()
+/** Construct a Colour, initialising it to black. */
+Colour::Colour ()
: r (0)
, g (0)
, b (0)
}
-Color::Color (int r_, int g_, int b_)
+/** Construct a Colour from R, G and B. The values run between
+ * 0 and 255.
+ */
+Colour::Colour (int r_, int g_, int b_)
: r (r_)
, g (g_)
, b (b_)
}
-/** Construct a Color from an ARGB hex string; the alpha value is ignored.
+/** Construct a Colour from an ARGB hex string; the alpha value is ignored.
* @param argb_hex A string of the form AARRGGBB, where e.g. RR is a two-character
* hex value.
*/
-Color::Color (string argb_hex)
+Colour::Colour (string argb_hex)
{
int alpha;
- if (sscanf (argb_hex.c_str(), "%2x%2x%2x%2x", &alpha, &r, &g, &b) < 4) {
+ if (sscanf (argb_hex.c_str(), "%2x%2x%2x%2x", &alpha, &r, &g, &b) != 4) {
boost::throw_exception (XMLError ("could not parse colour string"));
}
}
* hex value. The alpha value will always be FF (ie 255; maximum alpha).
*/
string
-Color::to_argb_string () const
+Colour::to_argb_string () const
{
stringstream s;
s << "FF";
return t;
}
-/** operator== for Colors.
- * @param a First color to compare.
- * @param b Second color to compare.
+/** operator== for Colours.
+ * @param a First colour to compare.
+ * @param b Second colour to compare.
*/
bool
-libdcp::operator== (Color const & a, Color const & b)
+dcp::operator== (Colour const & a, Colour const & b)
{
return (a.r == b.r && a.g == b.g && a.b == b.b);
}
-/** operator!= for Colors.
- * @param a First color to compare.
- * @param b Second color to compare.
+/** operator!= for Colours.
+ * @param a First colour to compare.
+ * @param b Second colour to compare.
*/
bool
-libdcp::operator!= (Color const & a, Color const & b)
+dcp::operator!= (Colour const & a, Colour const & b)
{
return !(a == b);
}
ostream &
-libdcp::operator<< (ostream& s, Color const & c)
+dcp::operator<< (ostream& s, Colour const & c)
{
s << "(" << c.r << ", " << c.g << ", " << c.b << ")";
return s;
}
string
-libdcp::effect_to_string (Effect e)
+dcp::effect_to_string (Effect e)
{
switch (e) {
case NONE:
}
Effect
-libdcp::string_to_effect (string s)
+dcp::string_to_effect (string s)
{
if (s == "none") {
return NONE;
}
string
-libdcp::valign_to_string (VAlign v)
+dcp::valign_to_string (VAlign v)
{
switch (v) {
case TOP:
}
VAlign
-libdcp::string_to_valign (string s)
+dcp::string_to_valign (string s)
{
if (s == "top") {
return TOP;