X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.h;h=7e7a7b96bcadded154f19d924cfdcd3667e096a7;hb=462d0883022ade6bbb51ca8a8c7a76a79788a30d;hp=c62b98df65c140cfcedc90d13cbfca36e45dd181;hpb=bdd0b2919c1bdb9aee13cfcdeb991d505bacfc42;p=dcpomatic.git diff --git a/src/lib/util.h b/src/lib/util.h index c62b98df6..7e7a7b96b 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 @@ -150,4 +151,15 @@ list_to_vector (std::list v) return l; } +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