diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-19 22:47:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-03 10:43:43 +0200 |
| commit | a55f7fa11991d222251a2a50f9349d8dbeed5ed7 (patch) | |
| tree | bc004308c7a2d9d32987624bb10d9e8503e7d86e | |
| parent | 32f606385df561d018e206afe2be0014ac40a812 (diff) | |
Move number_attribute() to xml_util.h
| -rw-r--r-- | src/lib/util.h | 13 | ||||
| -rw-r--r-- | src/lib/xml_util.h | 35 |
2 files changed, 35 insertions, 13 deletions
diff --git a/src/lib/util.h b/src/lib/util.h index 846059e1a..a3a384847 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -32,7 +32,6 @@ #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> @@ -103,18 +102,6 @@ extern std::string rfc_2822_date(time_t time); bool paths_exist(std::vector<boost::filesystem::path> const& paths); std::function<AVPixelFormat (AVPixelFormat)> force(AVPixelFormat format); - -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; -} - extern std::string screen_names_to_string(std::vector<std::string> names); extern std::string report_problem(); diff --git a/src/lib/xml_util.h b/src/lib/xml_util.h new file mode 100644 index 000000000..2dbade015 --- /dev/null +++ b/src/lib/xml_util.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include <libcxml/cxml.h> + + +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; +} + |
