From b3ab068b2106c5ee53e283ee69588f9e4a07ca3d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 11 Sep 2022 00:10:22 +0200 Subject: Normalise XML attribute names to be camelCase (#2241). --- src/lib/util.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/lib/util.h') diff --git a/src/lib/util.h b/src/lib/util.h index 4c8a2b1b7..c168be863 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -32,6 +32,7 @@ #include "dcpomatic_time.h" #include "pixel_quanta.h" #include "types.h" +#include #include #include #include @@ -97,4 +98,16 @@ extern std::string error_details(boost::system::error_code ec); extern bool contains_assetmap(boost::filesystem::path dir); extern std::string word_wrap(std::string input, int columns); + +template +T +number_attribute(cxml::ConstNodePtr node, std::string name1, std::string name2) +{ + auto value = node->optional_number_attribute(name1); + if (!value) { + value = node->number_attribute(name2); + } + return *value; +} + #endif -- cgit v1.2.3