summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-02 23:44:58 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-04 20:48:35 +0200
commit48bfa4b2040d2bacd6befdab6c12b2ee3e9be5a1 (patch)
tree8a7ae3f46a2f2034d069fceadf67958949a6da8a /src
parentb0c9c0470708d0822631b82915f4ed67e5fc7c1b (diff)
Add to_upper() method to util.{cc,h}
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc8
-rw-r--r--src/lib/util.cc9
-rw-r--r--src/lib/util.h1
3 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index b34c85295..1f188021b 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -919,9 +919,8 @@ Film::isdcf_name (bool if_created_now) const
auto audio_langs = audio_languages();
auto audio_language = (audio_langs.empty() || !audio_langs.front().language()) ? "XX" : audio_langs.front().language()->subtag();
- transform (audio_language.begin(), audio_language.end(), audio_language.begin(), ::toupper);
- d += "_" + audio_language;
+ d += "_" + to_upper (audio_language);
/* I'm not clear on the precise details of the convention for CCAP labelling;
for now I'm just appending -CCAP if we have any closed captions.
@@ -945,7 +944,7 @@ Film::isdcf_name (bool if_created_now) const
if (burnt_in) {
transform (lang.begin(), lang.end(), lang.begin(), ::tolower);
} else {
- transform (lang.begin(), lang.end(), lang.begin(), ::toupper);
+ lang = to_upper (lang);
}
d += "-" + lang;
@@ -959,8 +958,7 @@ Film::isdcf_name (bool if_created_now) const
if (_release_territory) {
auto territory = _release_territory->subtag();
- transform (territory.begin(), territory.end(), territory.begin(), ::toupper);
- d += "_" + territory;
+ d += "_" + to_upper (territory);
if (_ratings.empty ()) {
d += "-NR";
} else {
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 24ea42b8f..d3511e8c7 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1167,3 +1167,12 @@ default_font_file ()
return liberation_normal;
}
+
+
+string
+to_upper (string s)
+{
+ transform (s.begin(), s.end(), s.begin(), ::toupper);
+ return s;
+}
+
diff --git a/src/lib/util.h b/src/lib/util.h
index ceb30701c..7f8106f3c 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -122,6 +122,7 @@ extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path
extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container);
extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
extern boost::filesystem::path default_font_file ();
+extern std::string to_upper (std::string s);
template <class T>
std::list<T>