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>2024-01-28 02:01:22 +0100
commit591c89275bfa26c3b2e1b0f1926909fc4bf5b219 (patch)
tree75dd0838141b38081bc754f6b88d4c56f7f5b083 /src/lib/util.h
parentd0e74dea9d189187d456173702a54a3b3c72aca0 (diff)
Normalise XML attribute names to be camelCase (#2241).
Diffstat (limited to 'src/lib/util.h')
-rw-r--r--src/lib/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/util.h b/src/lib/util.h
index b92869b25..2d65b9214 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>
@@ -98,4 +99,16 @@ extern bool contains_assetmap(boost::filesystem::path dir);
extern std::string word_wrap(std::string input, int columns);
extern void capture_ffmpeg_logs();
+
+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