From 797916ae28d976f3c5be62d37b45864219af6098 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 13 May 2013 14:20:36 +0100 Subject: Use libcxml. Lump all static configuration flags into one. --- src/asset_map.cc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/asset_map.cc') diff --git a/src/asset_map.cc b/src/asset_map.cc index 8fcc515f..fb42f363 100644 --- a/src/asset_map.cc +++ b/src/asset_map.cc @@ -24,6 +24,7 @@ #include #include "asset_map.h" #include "util.h" +#include "xml.h" using std::string; using std::list; @@ -31,28 +32,27 @@ using boost::shared_ptr; using namespace libdcp; AssetMap::AssetMap (string file) - : XMLFile (file, "AssetMap") { - id = string_child ("Id"); - creator = string_child ("Creator"); - volume_count = int64_child ("VolumeCount"); - issue_date = string_child ("IssueDate"); - issuer = string_child ("Issuer"); - assets = type_grand_children ("AssetList", "Asset"); + cxml::File f (file, "AssetMap"); + + id = f.string_child ("Id"); + creator = f.string_child ("Creator"); + volume_count = f.number_child ("VolumeCount"); + issue_date = f.string_child ("IssueDate"); + issuer = f.string_child ("Issuer"); + assets = type_grand_children (f, "AssetList", "Asset"); } -AssetMapAsset::AssetMapAsset (xmlpp::Node const * node) - : XMLNode (node) +AssetMapAsset::AssetMapAsset (shared_ptr node) { - id = string_child ("Id"); - packing_list = optional_string_child ("PackingList"); - chunks = type_grand_children ("ChunkList", "Chunk"); + id = node->string_child ("Id"); + packing_list = node->optional_string_child ("PackingList").get_value_or (""); + chunks = type_grand_children (node, "ChunkList", "Chunk"); } -Chunk::Chunk (xmlpp::Node const * node) - : XMLNode (node) +Chunk::Chunk (shared_ptr node) { - path = string_child ("Path"); + path = node->string_child ("Path"); string const prefix = "file://"; @@ -60,9 +60,9 @@ Chunk::Chunk (xmlpp::Node const * node) path = path.substr (prefix.length()); } - volume_index = optional_int64_child ("VolumeIndex"); - offset = optional_int64_child ("Offset"); - length = optional_int64_child ("Length"); + volume_index = node->optional_number_child ("VolumeIndex").get_value_or (0); + offset = node->optional_number_child ("Offset").get_value_or (0); + length = node->optional_number_child ("Length").get_value_or (0); } shared_ptr -- cgit v1.2.3