summaryrefslogtreecommitdiff
path: root/src/types.cc
blob: 85c5fd6ecefe9e7b5e93339f5899cd8d3c80466b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <vector>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include "types.h"
#include "exceptions.h"

using namespace std;
using namespace libdcp;
using namespace boost;

Fraction::Fraction (string s)
{
	vector<string> b;
	split (b, s, is_any_of (" "));
	if (b.size() != 2) {
		throw XMLError ("malformed fraction " + s + " in XML node");
	}
	numerator = lexical_cast<int> (b[0]);
	denominator = lexical_cast<int> (b[1]);
}