...
This commit is contained in:
@@ -197,7 +197,7 @@ struct MccDeserializer : MccDeserializerBase {
|
||||
static_assert(std::ranges::output_range<VT, el_t>, "INVALID RANGE TYPE!!!");
|
||||
|
||||
// no reference or constants allowed
|
||||
static_assert(std::is_reference_v<el_t> || std::is_const_v<el_t>, "INVALID RANGE ELEMENT TYPE!!!");
|
||||
static_assert(!(std::is_reference_v<el_t> || std::is_const_v<el_t>), "INVALID RANGE ELEMENT TYPE!!!");
|
||||
|
||||
MccDeserializer<el_t> dsr;
|
||||
return deserializingRange<el_t>(dsr, input, value, params);
|
||||
@@ -206,7 +206,7 @@ struct MccDeserializer : MccDeserializerBase {
|
||||
|
||||
MccDeserializer<typename VT::rep> dsr;
|
||||
|
||||
auto err = dsr(trimSpaces(input), vd, params);
|
||||
auto err = dsr(utils::trimSpaces(input), vd, params);
|
||||
if (err) {
|
||||
return mcc_deduced_err(err, MccDeserializerErrorCode::ERROR_UNDERLYING_DESERIALIZER);
|
||||
}
|
||||
@@ -370,4 +370,59 @@ struct MccDeserializer<VT> : MccDeserializerBase {
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
struct MccDeserializer<MccSerializedAngleFormatPrec> : MccDeserializerBase {
|
||||
static constexpr std::string_view deserializerName{"MCC-ANGLE-FORMAT-PREC-DESERIALIZER"};
|
||||
|
||||
template <mcc_serialization_params_c ParamsT = mcc_serialization_params_t>
|
||||
error_t operator()(traits::mcc_input_char_range auto const& input,
|
||||
MccSerializedAngleFormatPrec& value,
|
||||
ParamsT const& params = mcc_serialization_params_t{})
|
||||
{
|
||||
// valid format: hour_prec[<params.elem_delim>deg_prec<params.elem_delim>decimals]
|
||||
|
||||
std::vector<uint8_t> v;
|
||||
|
||||
auto err = MccDeserializer<decltype(v)>{}(input, v);
|
||||
if (err) {
|
||||
return MccDeserializerErrorCode::ERROR_UNDERLYING_DESERIALIZER;
|
||||
}
|
||||
|
||||
if (v.size() > 0) {
|
||||
value.hour_prec = v[0];
|
||||
}
|
||||
|
||||
if (v.size() > 1) {
|
||||
value.deg_prec = v[1];
|
||||
}
|
||||
|
||||
if (v.size() > 2) {
|
||||
value.decimals = v[2];
|
||||
}
|
||||
|
||||
return MccDeserializerErrorCode::ERROR_OK;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <>
|
||||
struct MccDeserializer<MccSerializedCoordPairFormat> : MccDeserializerBase {
|
||||
static constexpr std::string_view deserializerName{"MCC-COORD-PAIR-FORMAT-DESERIALIZER"};
|
||||
|
||||
template <mcc_serialization_params_c ParamsT = mcc_serialization_params_t>
|
||||
error_t operator()(traits::mcc_input_char_range auto const& input,
|
||||
MccSerializedCoordPairFormat& value,
|
||||
ParamsT const& params = mcc_serialization_params_t{})
|
||||
{
|
||||
value = MccSerializedCoordPairFormatStrToValue(input);
|
||||
|
||||
if (value != MccSerializedCoordPairFormat::MCC_SERIALIZED_FORMAT_UNKNOWN){
|
||||
return MccDeserializerErrorCode::ERROR_OK;
|
||||
} else {
|
||||
return MccDeserializerErrorCode::ERROR_INVALID_SERIALIZED_VALUE;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mcc::impl
|
||||
|
||||
Reference in New Issue
Block a user