41 #include "asset_map.h"
42 #include "compose.hpp"
46 #include "filesystem.h"
51 LIBDCP_DISABLE_WARNINGS
52 #include <libxml++/libxml++.h>
53 LIBDCP_ENABLE_WARNINGS
54 #include <boost/algorithm/string.hpp>
58 using boost::function;
59 using std::shared_ptr;
60 using boost::optional;
86 Asset::add_to_pkl(shared_ptr<PKL> pkl, boost::filesystem::path root)
const
90 auto path = relative_to_root (
91 filesystem::canonical(root),
92 filesystem::canonical(
_file.get())
102 pkl->add_asset(_id, _id,
hash(), file_size(
_file.get()),
pkl_type(pkl->standard()),
_file->filename().string());
107 Asset::add_to_assetmap(
AssetMap& asset_map, boost::filesystem::path root)
const
110 add_file_to_assetmap (asset_map, root,
_file.get(), _id);
115 Asset::add_file_to_assetmap(
AssetMap& asset_map, boost::filesystem::path root, boost::filesystem::path file,
string id)
117 auto path = relative_to_root (
118 filesystem::canonical(root),
119 filesystem::canonical(
file)
129 asset_map.add_asset(
id,
file,
false);
134 Asset::hash(
function<
void (int64_t, int64_t)> progress)
const
147 Asset::equals(std::shared_ptr<const Asset> other,
EqualityOptions const& opt, NoteHandler note)
const
149 if (
_hash != other->_hash) {
151 note(NoteType::ERROR,
"Asset: hashes differ");
154 note(NoteType::NOTE,
"Asset: hashes differ");
166 _hash = optional<string>();
185 Asset::set_hash (
string hash)
194 _hash = optional<string>();
virtual std::string pkl_type(Standard standard) const =0
boost::optional< boost::filesystem::path > file() const
boost::optional< boost::filesystem::path > _file
void set_file_preserving_hash(boost::filesystem::path file) const
boost::optional< std::string > _hash
std::string hash(boost::function< void(int64_t, int64_t)> progress={}) const
void set_file(boost::filesystem::path file) const
void rename_file(boost::filesystem::path file)
A class to describe what "equality" means for a particular test.
bool asset_hashes_can_differ
Some part of a DCP that has a UUID.
Class to describe what equality means when calling Asset::equals().
Exceptions thrown by libdcp.
Namespace for everything in libdcp.
std::string make_digest(boost::filesystem::path filename, boost::function< void(int64_t, int64_t)>)
Methods for conversion to/from string.
Utility methods and classes.