summaryrefslogtreecommitdiff
path: root/src/lib/util.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-09-11 00:10:22 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-03 17:53:00 +0200
commit462d0883022ade6bbb51ca8a8c7a76a79788a30d (patch)
tree4ddfa86e43174bfccf4f175e447c7268a66415f4 /src/lib/util.h
parentbdd0b2919c1bdb9aee13cfcdeb991d505bacfc42 (diff)
Normalise XML attribute names to be camelCase (#2241).
Diffstat (limited to 'src/lib/util.h')
-rw-r--r--src/lib/util.h12
1 files changed, 12 insertions, 0 deletions
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 <libcxml/cxml.h>
#include <dcp/atmos_asset.h>
#include <dcp/decrypted_kdm.h>
#include <dcp/util.h>
@@ -150,4 +151,15 @@ list_to_vector (std::list<T> v)
return l;
}
+template <class T>
+T
+number_attribute(cxml::ConstNodePtr node, std::string name1, std::string name2)
+{
+ auto value = node->optional_number_attribute<T>(name1);
+ if (!value) {
+ value = node->number_attribute<T>(name2);
+ }
+ return *value;
+}
+
#endif