summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-22 00:49:15 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-22 00:49:15 +0100
commit595d4fbfee788edfad7f9f8dfe7e76ee634c1a94 (patch)
treea4a3f440c20cd1460eb823bcfb34d1503b39c4f7 /src/dcp.cc
parent81daf10958b05fc0d617d421617da33ab45f2f4c (diff)
Various attempts to clean up DCP comparison code.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index c92a14b8..ca1c23d9 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -50,6 +50,7 @@
using std::string;
using std::list;
+using std::cout;
using std::stringstream;
using std::ostream;
using std::make_pair;
@@ -174,23 +175,28 @@ DCP::read (bool keep_going, ReadErrors* errors)
bool
DCP::equals (DCP const & other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
{
- if (_assets.size() != other._assets.size()) {
- note (DCP_ERROR, String::compose ("Asset counts differ: %1 vs %2", _assets.size(), other._assets.size()));
+ list<shared_ptr<CPL> > a = cpls ();
+ list<shared_ptr<CPL> > b = other.cpls ();
+
+ if (a.size() != b.size()) {
+ note (DCP_ERROR, String::compose ("CPL counts differ: %1 vs %2", a.size(), b.size()));
return false;
}
- list<shared_ptr<Asset> >::const_iterator a = _assets.begin ();
- list<shared_ptr<Asset> >::const_iterator b = other._assets.begin ();
+ bool r = true;
+
+ for (list<shared_ptr<CPL> >::const_iterator i = a.begin(); i != a.end(); ++i) {
+ list<shared_ptr<CPL> >::const_iterator j = b.begin ();
+ while (j != b.end() && !(*j)->equals (*i, opt, note)) {
+ ++j;
+ }
- while (a != _assets.end ()) {
- if (!(*a)->equals (*b, opt, note)) {
- return false;
+ if (j == b.end ()) {
+ r = false;
}
- ++a;
- ++b;
}
- return true;
+ return r;
}
void