X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.h;h=7e7a7b96bcadded154f19d924cfdcd3667e096a7;hb=6b9aeb06323b50fb4d02477f8fcccf8ddad83ad1;hp=c62b98df65c140cfcedc90d13cbfca36e45dd181;hpb=8377ed4386af507038b3d0528c25068ee3275bb7;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