Some comments.
[libdcp.git] / src / pkl.cc
1 #include <iostream>
2 #include "pkl.h"
3
4 using namespace std;
5 using namespace boost;
6 using namespace libdcp;
7
8 PKL::PKL (string file)
9         : XMLFile (file, "PackingList")
10 {
11         id = string_node ("Id");
12         annotation_text = string_node ("AnnotationText");
13         issue_date = string_node ("IssueDate");
14         issuer = string_node ("Issuer");
15         creator = string_node ("Creator");
16         assets = sub_nodes<PKLAsset> ("AssetList", "Asset");
17 }
18
19 PKLAsset::PKLAsset (xmlpp::Node const * node)
20         : XMLNode (node)
21 {
22         id = string_node ("Id");
23         annotation_text = optional_string_node ("AnnotationText");
24         hash = string_node ("Hash");
25         size = int64_node ("Size");
26         type = string_node ("Type");
27         original_file_name = optional_string_node ("OriginalFileName");
28 }
29         
30 shared_ptr<PKLAsset>
31 PKL::asset_from_id (string id) const
32 {
33         for (list<shared_ptr<PKLAsset> >::const_iterator i = assets.begin (); i != assets.end(); ++i) {
34                 if ((*i)->id == id) {
35                         return *i;
36                 }
37         }
38
39         return shared_ptr<PKLAsset> ();
40 }
41