diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-03-19 19:47:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-03-19 19:47:07 +0000 |
| commit | 3bae1fb76f8d4751ee62717e3f18cee47d1deb90 (patch) | |
| tree | a74fbc1f602586a6bfd4e8c156f73caf3b1888ec /src/types.cc | |
| parent | 097f27fcbd28d81b1ff2ae37949b1fcc3a97a716 (diff) | |
Support RatingList.
Diffstat (limited to 'src/types.cc')
| -rw-r--r-- | src/types.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/types.cc b/src/types.cc index d27b2ec1..4c53b162 100644 --- a/src/types.cc +++ b/src/types.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -36,6 +36,7 @@ #include "exceptions.h" #include "compose.hpp" #include "dcp_assert.h" +#include <libxml++/libxml++.h> #include <boost/algorithm/string.hpp> #include <vector> #include <cstdio> @@ -426,3 +427,30 @@ dcp::marker_from_string (string s) DCP_ASSERT (false); } + +Rating::Rating (cxml::ConstNodePtr node) +{ + agency = node->string_child("Agency"); + label = node->string_child("Label"); + node->done (); +} + +void +Rating::as_xml (xmlpp::Element* parent) const +{ + parent->add_child("Agency")->add_child_text(agency); + parent->add_child("Label")->add_child_text(label); +} + +bool +dcp::operator== (Rating const & a, Rating const & b) +{ + return a.agency == b.agency && a.label == b.label; +} + +ostream & +dcp::operator<< (ostream& s, Rating const & r) +{ + s << r.agency << " " << r.label; + return s; +} |
