#include "util.h"
#include "metadata.h"
#include "exceptions.h"
-#include "reel.h"
#include "cpl.h"
#include "signer.h"
#include "compose.hpp"
#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
-#include <sstream>
-#include <iomanip>
#include <cassert>
#include <iostream>
using std::string;
using std::list;
-using std::stringstream;
+using std::cout;
using std::ostream;
using std::make_pair;
using std::map;
} else if (boost::filesystem::exists (_directory / "ASSETMAP.xml")) {
asset_map_file = _directory / "ASSETMAP.xml";
} else {
- boost::throw_exception (DCPReadError (String::compose ("could not find AssetMap file `%1'", asset_map_file.string())));
+ boost::throw_exception (DCPReadError (String::compose ("could not find AssetMap file in `%1'", _directory.string())));
}
cxml::Document asset_map ("AssetMap");
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
DCP::write_pkl (Standard standard, string pkl_uuid, XMLMetadata metadata, shared_ptr<const Signer> signer) const
{
boost::filesystem::path p = _directory;
- stringstream s;
- s << pkl_uuid << "_pkl.xml";
- p /= s.str();
+ p /= String::compose ("%1_pkl.xml", pkl_uuid);
xmlpp::Document doc;
xmlpp::Element* pkl;