diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-23 16:30:01 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-12-23 17:35:02 +0100 |
| commit | 52d807654169d6443909c1d5dd20a155801faa26 (patch) | |
| tree | 727774d21ea1f4b54ccd61a09127894cb8d572ef /src/dcp_time.cc | |
| parent | a6ccc587277b848b4a60c07456b11eb1b076d181 (diff) | |
Remove String::compose and use fmt instead.
Diffstat (limited to 'src/dcp_time.cc')
| -rw-r--r-- | src/dcp_time.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc index f08f2b1c..22079938 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -40,8 +40,8 @@ #include "raw_convert.h" #include "dcp_time.h" #include "exceptions.h" -#include "compose.hpp" #include "dcp_assert.h" +#include <fmt/core.h> #include <boost/algorithm/string.hpp> #include <boost/optional.hpp> #include <iostream> @@ -105,7 +105,7 @@ Time::Time (string time, optional<int> tcr_) split (b, time, is_any_of (":")); if (b.size() < 3 || b[0].empty() || b[1].empty() || b[0].length() > 2 || b[1].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}", time))); } if (!tcr_) { @@ -115,17 +115,17 @@ Time::Time (string time, optional<int> tcr_) vector<string> bs; split (bs, b[2], is_any_of (".")); if (bs.size() != 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}", time))); } h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (bs[0].empty() || bs[0].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[0]))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; {} has bad length", time, bs[0]))); } s = raw_convert<int> (bs[0]); if (bs[1].empty() || bs[1].length() > 3) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[1]))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; {} has bad length", time, bs[1]))); } e = raw_convert<int> (bs[1]); tcr = 1000; @@ -134,16 +134,16 @@ Time::Time (string time, optional<int> tcr_) h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (b[2].empty() || b[2].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; {} has bad length", time, b[2]))); } s = raw_convert<int> (b[2]); if (b[3].empty() || b[3].length() > 3) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; {} has bad length", time, b[3]))); } e = raw_convert<int> (b[3]); tcr = 250; } else { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}", time))); } } else { @@ -151,17 +151,17 @@ Time::Time (string time, optional<int> tcr_) * It seems like there can be any number of E digits but let's just allow 2 or 3 */ split (b, time, is_any_of (":")); if (b.size() != 4) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; does not have 4 parts", time))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; does not have 4 parts", time))); } h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (b[2].empty() || b[2].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; {} has bad length", time, b[2]))); } s = raw_convert<int> (b[2]); if (b[3].empty() || b[3].length() > 3) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); + boost::throw_exception(ReadError(fmt::format("unrecognised time specification {}; {} has bad length", time, b[3]))); } e = raw_convert<int> (b[3]); tcr = tcr_.get(); |
