various Asibfm700MountConfig class fixes

This commit is contained in:
2025-10-31 12:22:16 +03:00
parent a1fa54c636
commit d69ea51b0c
5 changed files with 70 additions and 40 deletions

View File

@@ -365,44 +365,35 @@ public:
return getValue<double>("refractWavelength").value_or(0.0);
};
template <mcc::traits::mcc_view_or_output_char_range R>
template <mcc::traits::mcc_output_char_range R>
R leapSecondFilename() const
{
R r;
if constexpr (std::ranges::view<R>) {
std::string const& val = getValue<std::string>("leapSecondFilename").value_or("");
r = R{val.begin(), val.end()};
} else {
std::string val = getValue<std::string>("leapSecondFilename").value_or("");
std::ranges::copy(val, std::back_inserter(r));
}
std::string val = getValue<std::string>("leapSecondFilename").value_or("");
std::ranges::copy(val, std::back_inserter(r));
return r;
}
std::string_view leapSecondFilename() const
std::string leapSecondFilename() const
{
return leapSecondFilename<std::string_view>();
return leapSecondFilename<std::string>();
};
template <mcc::traits::mcc_view_or_output_char_range R>
template <mcc::traits::mcc_output_char_range R>
R bulletinAFilename() const
{
R r;
if constexpr (std::ranges::view<R>) {
std::string const& val = getValue<std::string>("bulletinAFilename").value_or("");
r = R{val.begin(), val.end()};
} else {
std::string val = getValue<std::string>("bulletinAFilename").value_or("");
std::ranges::copy(val, std::back_inserter(r));
}
std::string val = getValue<std::string>("bulletinAFilename").value_or("");
std::ranges::copy(val, std::back_inserter(r));
return r;
}
std::string_view bulletinAFilename() const
std::string bulletinAFilename() const
{
return bulletinAFilename<std::string_view>();
return bulletinAFilename<std::string>();
};
@@ -654,6 +645,34 @@ public:
fst.close();
ec = base_t::fromCharRange(buffer, deserializer);
if (!ec) {
// remove possible spaces in filenames
std::string val = getValue<std::string>("leapSecondFilename").value_or("");
auto fname = mcc::utils::trimSpaces(val);
setValue("leapSecondFilename", fname);
val = getValue<std::string>("bulletinAFilename").value_or("");
fname = mcc::utils::trimSpaces(val);
setValue("bulletinAFilename", fname);
val = getValue<std::string>("MountDevPath").value_or({});
fname = mcc::utils::trimSpaces(val);
setValue("MountDevPath", fname);
val = getValue<std::string>("EncoderDevPath").value_or({});
fname = mcc::utils::trimSpaces(val);
setValue("EncoderDevPath", fname);
val = getValue<std::string>("EncoderXDevPath").value_or({});
fname = mcc::utils::trimSpaces(val);
setValue("EncoderXDevPath", fname);
val = getValue<std::string>("EncoderYDevPath").value_or({});
fname = mcc::utils::trimSpaces(val);
setValue("EncoderYDevPath", fname);
}
} catch (std::ios_base::failure const& ex) {
ec = ex.code();
} catch (std::length_error const& ex) {