summaryrefslogtreecommitdiff
path: root/src/asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-01-27 14:41:33 +0000
committerCarl Hetherington <cth@carlh.net>2014-01-27 14:41:33 +0000
commit8c2f3517e868078b551bb01d975f2956cb692fbf (patch)
tree81bf98f00b9a267a73494c1939c6e9473559c85e /src/asset.cc
parente5d368553b47a566a83d4edce0a8f166db9509e6 (diff)
Various tinkerings.
Diffstat (limited to 'src/asset.cc')
-rw-r--r--src/asset.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/asset.cc b/src/asset.cc
index 74e32cf0..43db41e3 100644
--- a/src/asset.cc
+++ b/src/asset.cc
@@ -37,6 +37,10 @@ Asset::Asset ()
}
+/** Create an Asset from a given file. The ID will
+ * be extracted from the file.
+ * @param file File name.
+ */
Asset::Asset (boost::filesystem::path file)
: _file (file)
{
@@ -55,6 +59,8 @@ Asset::Asset (string id)
void
Asset::write_to_pkl (xmlpp::Node* node) const
{
+ assert (!_file.empty ());
+
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _id);
asset->add_child("AnnotationText")->add_child_text (_id);
@@ -66,6 +72,8 @@ Asset::write_to_pkl (xmlpp::Node* node) const
void
Asset::write_to_assetmap (xmlpp::Node* node) const
{
+ assert (!_file.empty ());
+
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _id);
xmlpp::Node* chunk_list = asset->add_child ("ChunkList");
@@ -79,6 +87,8 @@ Asset::write_to_assetmap (xmlpp::Node* node) const
string
Asset::hash () const
{
+ assert (!_file.empty ());
+
if (!_hash.empty ()) {
_hash = make_digest (_file, 0);
}