Commit 3c890632 authored by Volker Krause's avatar Volker Krause
Browse files

Implement decoding of uPER sequences of UTF-8 strings

This also completes the FCB decoder definition.
parent 869dfc16
Pipeline #252611 passed with stage
in 11 minutes and 10 seconds
......@@ -139,3 +139,14 @@ QList<QByteArray> UPERDecoder::readSequenceOfIA5String()
}
return result;
}
QList<QString> UPERDecoder::readSequenceOfUtf8String()
{
const auto size = readLengthDeterminant();
QList<QString> result;
result.reserve(size);
for (size_type i = 0; i < size; ++i) {
result.push_back(readUtf8String());
}
return result;
}
......@@ -88,6 +88,7 @@ public:
QList<int> readSequenceOfConstrainedWholeNumber(int64_t minimum, int64_t maximum);
QList<int> readSequenceOfUnconstrainedWholeNumber();
QList<QByteArray> readSequenceOfIA5String();
QList<QString> readSequenceOfUtf8String();
/** Read enumerated value.
* @see X.691 §14
......
......@@ -58,6 +58,10 @@
if (Name ## IsSet()) \
Name = decoder.readSequenceOfIA5String()
#define FCB_READ_SEQUENCE_OF_UTF8STRING(Name) \
if (Name ## IsSet()) \
Name = decoder.readSequenceOfUtf8String()
#define FCB_READ_SEQUENCE_OF_CUSTOM(Name) \
if (Name ## IsSet()) \
Name = decoder.readSequenceOf<decltype(Name)::value_type>();
......@@ -673,10 +677,10 @@ void Fcb::StationPassageData::decode(UPERDecoder &decoder)
FCB_READ_ENUM(stationCodeTable);
FCB_READ_SEQUENCE_OF_UNCONTRAINED_INT(stationNum);
FCB_READ_SEQUENCE_OF_IA5STRING(stationIA5);
// TODO stationNameUTF8 SEQUENCE OF UTF8String OPTIONAL,
FCB_READ_SEQUENCE_OF_UTF8STRING(stationNameUTF8);
FCB_READ_SEQUENCE_OF_UNCONTRAINED_INT(areaCodeNum);
FCB_READ_SEQUENCE_OF_IA5STRING(areaCodeIA5);
// TODO areaNameUTF8 SEQUENCE OF UTF8String OPTIONAL,
FCB_READ_SEQUENCE_OF_UTF8STRING(areaNameUTF8);
validFromDay = decoder.readConstrainedWholeNumber(-1, 700);
FCB_READ_CONSTRAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validFromUTCOffset, -60, 60);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment