Commit 673d3451 authored by Volker Krause's avatar Volker Krause
Browse files

Encode ASN.1 enum extension markers with the enum declaration

This avoids the error prone repetition of that on each decoding call.
parent b241585f
Pipeline #249550 passed with stage
in 8 minutes and 12 seconds
......@@ -31,6 +31,14 @@ template <> struct num<0> { static constexpr int value = 0; };
static constexpr detail::num<0> _uper_optional_counter(detail::num<0>) { return {}; } \
static constexpr bool _uper_ExtensionMarker = true;
// ASN.1 ENUMERATED definitions, with or without extension marker
#define UPER_ENUM(Name) \
Q_ENUM_NS(Name) \
constexpr bool uperHasExtensionMarker(Name) { return false; }
#define UPER_EXTENABLE_ENUM(Name) \
Q_ENUM_NS(Name) \
constexpr bool uperHasExtensionMarker(Name) { return true; }
#define UPER_ELEMENT(Type, Name) \
public: \
Type Name = {}; \
......
......@@ -9,7 +9,7 @@
#include <QDebug>
#define FCB_READ_CONSTAINED_INT(Name, Min, Max) \
#define FCB_READ_CONSTRAINED_INT(Name, Min, Max) \
if (Name ## IsSet()) \
Name = decoder.readConstrainedWholeNumber(Min, Max)
......@@ -25,9 +25,14 @@
if (Name ## IsSet()) \
Name = decoder.readUtf8String()
#define FCB_READ_EXTENDED_ENUM(Name) \
if (Name ## IsSet()) \
Name = decoder.readEnumeratedWithExtensionMarker<decltype(Name)>()
#define FCB_READ_ENUM(Name) \
do { if (Name ## IsSet()) { \
if constexpr (uperHasExtensionMarker(decltype(Name){})) { \
Name = decoder.readEnumeratedWithExtensionMarker<decltype(Name)>(); \
} else { \
Name = decoder.readEnumerated<decltype(Name)>(); \
} \
} } while(false)
#define FCB_READ_CUSTOM(Name) \
if (Name ## IsSet()) \
......@@ -42,7 +47,7 @@
Name = decoder.readSequenceOf<decltype(Name)::value_type>();
#define FCB_READ_INT_IA5_PAIR(Name, Min, Max) \
FCB_READ_CONSTAINED_INT(Name ## Num, Min, Max); \
FCB_READ_CONSTRAINED_INT(Name ## Num, Min, Max); \
FCB_READ_IA5STRING(Name ## IA5)
#define FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(Name) \
......@@ -58,6 +63,18 @@ void Fcb::ExtensionData::decode(KItinerary::UPERDecoder &decoder)
// extensionData = TODO
}
void Fcb::GeoCoordinateType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_ENUM(geoUnit);
FCB_READ_ENUM(coordinateSystem);
FCB_READ_ENUM(hemisphereLongitude);
FCB_READ_ENUM(hemisphereLongitude);
longitude = decoder.readUnconstrainedWholeNumber();
latitude = decoder.readUnconstrainedWholeNumber();
FCB_READ_ENUM(accuracy);
}
void Fcb::IssuingData::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
......@@ -65,7 +82,7 @@ void Fcb::IssuingData::decode(UPERDecoder &decoder)
FCB_READ_INT_IA5_PAIR(issuer, 1, 32000);
issuingYear = decoder.readConstrainedWholeNumber(2016, 2269);
issuingDay = decoder.readConstrainedWholeNumber(1, 366);
FCB_READ_CONSTAINED_INT(issuingTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(issuingTime, 0, 1440);
FCB_READ_UTF8STRING(issuerName);
specimen = decoder.readBoolean();
securePaperTicket = decoder.readBoolean();
......@@ -73,12 +90,20 @@ void Fcb::IssuingData::decode(UPERDecoder &decoder)
if (currencyIsSet()) {
currency = decoder.readIA5String(3, 3);
}
FCB_READ_CONSTAINED_INT(currencyFract, 1, 3);
FCB_READ_CONSTRAINED_INT(currencyFract, 1, 3);
FCB_READ_IA5STRING(issuerPNR);
FCB_READ_CUSTOM(extension);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(issuedOnTrain);
FCB_READ_UNCONSTRAINED_INT(issuedOnLine);
assert(!m_optionals[0]); // TODO GeoCoordinateType
FCB_READ_CUSTOM(pointOfSale);
}
void Fcb::CustomerStatusType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(statusProvider);
FCB_READ_UNCONSTRAINED_INT(customerStatus);
FCB_READ_IA5STRING(customerStatusDescr);
}
void Fcb::TravelerType::decode(UPERDecoder &decoder)
......@@ -90,20 +115,20 @@ void Fcb::TravelerType::decode(UPERDecoder &decoder)
FCB_READ_IA5STRING(idCard);
FCB_READ_IA5STRING(passportId);
FCB_READ_IA5STRING(title);
FCB_READ_EXTENDED_ENUM(gender);
FCB_READ_ENUM(gender);
FCB_READ_IA5STRING(customerIdIA5);
FCB_READ_UNCONSTRAINED_INT(customerIdNum);
FCB_READ_CONSTAINED_INT(yearOfBirth, 1901, 2155);
FCB_READ_CONSTAINED_INT(dayOfBirth, 0, 370);
FCB_READ_CONSTRAINED_INT(yearOfBirth, 1901, 2155);
FCB_READ_CONSTRAINED_INT(dayOfBirth, 0, 370);
ticketHolder = decoder.readBoolean();
FCB_READ_EXTENDED_ENUM(passengerType);
FCB_READ_ENUM(passengerType);
if (passengerWithReducedMobilityIsSet()) {
passengerWithReducedMobility = decoder.readBoolean();
}
FCB_READ_CONSTAINED_INT(countryOfResidence, 1, 999);
FCB_READ_CONSTAINED_INT(countryOfPassport, 1, 999);
FCB_READ_CONSTAINED_INT(countryOfIdCard, 1, 999);
assert(!m_optionals[0]); // TODO status
FCB_READ_CONSTRAINED_INT(countryOfResidence, 1, 999);
FCB_READ_CONSTRAINED_INT(countryOfPassport, 1, 999);
FCB_READ_CONSTRAINED_INT(countryOfIdCard, 1, 999);
FCB_READ_SEQUENCE_OF_CUSTOM(status);
}
void Fcb::TravelerData::decode(UPERDecoder &decoder)
......@@ -122,7 +147,7 @@ void Fcb::TrainLinkType::decode(UPERDecoder &decoder)
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(train);
travelDate = decoder.readConstrainedWholeNumber(-1, 370);
departureTime = decoder.readConstrainedWholeNumber(0, 1440);
FCB_READ_CONSTAINED_INT(departureUTCOffset, -60, 60);
FCB_READ_CONSTRAINED_INT(departureUTCOffset, -60, 60);
FCB_READ_INT_IA5_PAIR(fromStation, 1, 9999999);
FCB_READ_INT_IA5_PAIR(toStation, 1, 9999999);
FCB_READ_UTF8STRING(fromStationNameUTF8);
......@@ -149,8 +174,31 @@ void Fcb::RegionalValidityType::decode(UPERDecoder &decoder)
void Fcb::ReturnRouteDescriptionType::decode(UPERDecoder &decoder)
{
// TODO
assert(false);
decodeSequence(decoder);
FCB_READ_INT_IA5_PAIR(fromStation, 1, 9999999);
FCB_READ_INT_IA5_PAIR(toStation, 1, 9999999);
FCB_READ_UTF8STRING(fromStationNameUTF8);
FCB_READ_UTF8STRING(toStationNameUTF8);
FCB_READ_UTF8STRING(validReturnRegionDesc);
FCB_READ_SEQUENCE_OF_CUSTOM(validReturnRegion);
}
void Fcb::RouteSectionType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_ENUM(stationCodeTable);
FCB_READ_INT_IA5_PAIR(fromStation, 1, 9999999);
FCB_READ_INT_IA5_PAIR(toStation, 1, 9999999);
FCB_READ_UTF8STRING(fromStationNameUTF8);
FCB_READ_UTF8STRING(toStationNameUTF8);
}
void Fcb::SeriesDetailType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_CONSTRAINED_INT(supplyingCarrier, 1, 32000);
FCB_READ_CONSTRAINED_INT(offerIdentification, 1, 99);
FCB_READ_UNCONSTRAINED_INT(series);
}
void Fcb::CardReferenceType::decode(UPERDecoder &decoder)
......@@ -167,19 +215,70 @@ void Fcb::CardReferenceType::decode(UPERDecoder &decoder)
void Fcb::TariffType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_CONSTAINED_INT(numberOfPassengers, 1, 200);
FCB_READ_EXTENDED_ENUM(passengerType);
FCB_READ_CONSTAINED_INT(ageBelow, 1, 64);
FCB_READ_CONSTAINED_INT(ageAbove, 1, 128);
FCB_READ_CONSTRAINED_INT(numberOfPassengers, 1, 200);
FCB_READ_ENUM(passengerType);
FCB_READ_CONSTRAINED_INT(ageBelow, 1, 64);
FCB_READ_CONSTRAINED_INT(ageAbove, 1, 128);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(travelerid, 0, 254);
restrictedToCountryOfResidence = decoder.readBoolean();
// FCB_READ_CUSTOM(restrictedToRouteSection); TODO
// FCB_READ_CUSTOM(seriesDataDetails); TODO
FCB_READ_CUSTOM(restrictedToRouteSection);
FCB_READ_CUSTOM(seriesDataDetails);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(tariffId);
FCB_READ_UTF8STRING(tariffDesc);
FCB_READ_SEQUENCE_OF_CUSTOM(reductionCard);
}
void Fcb::VatDetailType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
country = decoder.readConstrainedWholeNumber(1, 999);
percentage = decoder.readConstrainedWholeNumber(0, 999);
FCB_READ_UNCONSTRAINED_INT(amount);
FCB_READ_IA5STRING(vatId);
}
void Fcb::IncludedOpenTicketType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_INT_IA5_PAIR(productOwner, 1, 32000);
FCB_READ_INT_IA5_PAIR(productId, 0, 32000);
FCB_READ_UNCONSTRAINED_INT(externalIssuerId);
FCB_READ_UNCONSTRAINED_INT(issuerAutorizationId);
FCB_READ_ENUM(stationCodeTable);
FCB_READ_SEQUENCE_OF_CUSTOM(validRegion);
FCB_READ_CONSTRAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTRAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTRAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTRAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validUntilUTCOffset, -60, 60);
FCB_READ_ENUM(classCode);
// TODO serviceLevel
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(carrierNum, 1, 32000);
// TODO carrierIA5
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(includedServiceBrands, 1, 32000);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(excludedServiceBrands, 1, 32000);
FCB_READ_SEQUENCE_OF_CUSTOM(tariffs);
FCB_READ_UTF8STRING(infoText);
FCB_READ_CUSTOM(extension);
}
void Fcb::RegisteredLuggageType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_IA5STRING(registrationId);
FCB_READ_CONSTRAINED_INT(maxWeight, 1, 99);
FCB_READ_CONSTRAINED_INT(maxSize, 1, 300);
}
void Fcb::LuggageRestrictionType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_CONSTRAINED_INT(maxHandLuggagePieces, 0, 99);
FCB_READ_CONSTRAINED_INT(maxNonHandLuggagePieces, 0, 99);
FCB_READ_SEQUENCE_OF_CUSTOM(registeredLuggage);
}
void Fcb::OpenTicketData::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
......@@ -189,9 +288,7 @@ void Fcb::OpenTicketData::decode(UPERDecoder &decoder)
FCB_READ_UNCONSTRAINED_INT(extIssuerId);
FCB_READ_UNCONSTRAINED_INT(issuerAutorizationId);
returnIncluded = decoder.readBoolean();
if (stationCodeTableIsSet()) {
stationCodeTable = decoder.readEnumerated<CodeTableType>();
}
FCB_READ_ENUM(stationCodeTable);
FCB_READ_INT_IA5_PAIR(fromStation, 1, 9999999);
FCB_READ_INT_IA5_PAIR(toStation, 1, 9999999);
FCB_READ_UTF8STRING(fromStationNameUTF8);
......@@ -199,46 +296,72 @@ void Fcb::OpenTicketData::decode(UPERDecoder &decoder)
FCB_READ_UTF8STRING(validRegionDesc);
FCB_READ_SEQUENCE_OF_CUSTOM(validRegion);
FCB_READ_CUSTOM(returnDescription);
FCB_READ_CONSTAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTAINED_INT(validUntilUTCOffset, -60, 60);
FCB_READ_CONSTRAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTRAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTRAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTRAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validUntilUTCOffset, -60, 60);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(activatedDay, 0, 370);
FCB_READ_EXTENDED_ENUM(classCode);
FCB_READ_IA5STRING(serviceLevel);
FCB_READ_ENUM(classCode);
FCB_READ_IA5STRING(serviceLevel); // TODO this is size constrained!
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(carrierNum, 1, 32000);
// TODO carrierIA5
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(includedServiceBrands, 1, 32000);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(excludedServiceBrands, 1, 32000);
FCB_READ_SEQUENCE_OF_CUSTOM(tariffs);
FCB_READ_UNCONSTRAINED_INT(price);
// FCB_READ_SEQUENCE_OF_CUSTOM(vatDetail); TODO
FCB_READ_SEQUENCE_OF_CUSTOM(vatDetail);
FCB_READ_UTF8STRING(infoText);
// TODO
FCB_READ_SEQUENCE_OF_CUSTOM(includedAddOns);
FCB_READ_CUSTOM(luggage);
FCB_READ_CUSTOM(extension);
}
void Fcb::TimeRangeType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
fromTime = decoder.readConstrainedWholeNumber(0, 1440);
untilTime = decoder.readConstrainedWholeNumber(0, 1440);
}
void Fcb::ValidityPeriodType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_CONSTRAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTRAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTRAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTRAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validUntilUTCOffset, -60, 60);
}
void Fcb::ValidityPeriodDetailType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_SEQUENCE_OF_CUSTOM(validityPeriod);
FCB_READ_SEQUENCE_OF_CUSTOM(excludedTimeRange);
}
void Fcb::PassData::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(reference);
FCB_READ_INT_IA5_PAIR(productOwner, 1, 32000);
FCB_READ_INT_IA5_PAIR(productId, 0, 32000);
FCB_READ_CONSTAINED_INT(passType, 1, 250);
FCB_READ_CONSTRAINED_INT(passType, 1, 250);
FCB_READ_UTF8STRING(passDescription);
FCB_READ_EXTENDED_ENUM(classCode);
FCB_READ_CONSTAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTAINED_INT(validUntilUTCOffset, -60, 60);
// FCB_READ_CUSTOM(validityPeriodDetails); TODO
FCB_READ_CONSTAINED_INT(numberOfValidityDays, 0, 370);
FCB_READ_CONSTAINED_INT(numberOfPossibleTrips, 1, 250);
FCB_READ_CONSTAINED_INT(numberOfDaysOfTravel, 1, 250);
FCB_READ_ENUM(classCode);
FCB_READ_CONSTRAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTRAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTRAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTRAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTRAINED_INT(validUntilUTCOffset, -60, 60);
FCB_READ_CUSTOM(validityPeriodDetails);
FCB_READ_CONSTRAINED_INT(numberOfValidityDays, 0, 370);
FCB_READ_CONSTRAINED_INT(numberOfPossibleTrips, 1, 250);
FCB_READ_CONSTRAINED_INT(numberOfDaysOfTravel, 1, 250);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(activatedDay, 0, 370);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(countries, 1, 250);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(includedCarrierNum, 1, 32000);
......@@ -247,10 +370,10 @@ void Fcb::PassData::decode(UPERDecoder &decoder)
// TODO excludedCarrierIA5 SEQUENCE OF IA5String OPTIONAL,
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(includedServiceBrands, 1, 32000);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(excludedServiceBrands, 1, 32000);
// FCB_READ_SEQUENCE_OF_CUSTOM(validRegion); TOODO
FCB_READ_SEQUENCE_OF_CUSTOM(validRegion);
FCB_READ_SEQUENCE_OF_CUSTOM(tariffs);
FCB_READ_UNCONSTRAINED_INT(price);
// FCB_READ_SEQUENCE_OF_CUSTOM(vatDetail); TODO
FCB_READ_SEQUENCE_OF_CUSTOM(vatDetail);
FCB_READ_UTF8STRING(infoText);
FCB_READ_CUSTOM(extension);
}
......@@ -288,7 +411,7 @@ void Fcb::ControlData::decode(UPERDecoder &decoder)
FCB_READ_UNCONSTRAINED_INT(identificationItem);
passportValidationRequired = decoder.readBoolean();
onlineValidationRequired = decoder.readBoolean();
FCB_READ_CONSTAINED_INT(randomDetailedValidationRequired, 0, 99);
FCB_READ_CONSTRAINED_INT(randomDetailedValidationRequired, 0, 99);
ageCheckRequired = decoder.readBoolean();
reductionCardCheckRequired = decoder.readBoolean();
FCB_READ_UTF8STRING(infoText);
......
......@@ -33,9 +33,43 @@ class ExtensionData {
UPER_GADGET_FINALIZE
};
enum GeoUnitType {
microDegree = 0,
tenthmilliDegree = 1,
milliDegree = 2,
centiDegree = 3,
deciDegree = 4,
};
UPER_ENUM(GeoUnitType)
enum GeoCoordinateSystemType {
wgs84 = 0,
grs80 = 1,
};
UPER_ENUM(GeoCoordinateSystemType)
enum HemisphereLongitudeType {
north = 0,
south = 1,
};
UPER_ENUM(HemisphereLongitudeType)
enum HemisphereLatitudeType {
east = 0,
west = 1,
};
UPER_ENUM(HemisphereLatitudeType)
class GeoCoordinateType {
UPER_GADGET
// TODO
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::GeoUnitType, geoUnit, milliDegree)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::GeoCoordinateSystemType, coordinateSystem, wgs84)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::HemisphereLongitudeType, hemisphereLongitude, north)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::HemisphereLatitudeType, hemisphereLatitude, east)
UPER_ELEMENT(int, longitude)
UPER_ELEMENT(int, latitude)
UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::GeoUnitType, accuracy)
UPER_GADGET_FINALIZE
};
class IssuingData {
......@@ -68,7 +102,7 @@ enum GenderType {
male = 2,
other = 3,
};
Q_ENUM_NS(GenderType)
UPER_EXTENABLE_ENUM(GenderType)
enum PassengerType {
adult = 0,
......@@ -80,13 +114,13 @@ enum PassengerType {
freeAddonPassenger = 6,
freeAddonChild = 7,
};
Q_ENUM_NS(PassengerType)
UPER_EXTENABLE_ENUM(PassengerType)
class CustomerStatusType {
UPER_GADGET
UPER_ELEMENT_OPTIONAL(int, statusProviderNum)
UPER_ELEMENT_OPTIONAL(QByteArray, statusProviderIA5)
UPER_ELEMENT_OPTIONAL(int, customStatus)
UPER_ELEMENT_OPTIONAL(int, customerStatus)
UPER_ELEMENT_OPTIONAL(QByteArray, customerStatusDescr)
UPER_GADGET_FINALIZE
};
......@@ -129,7 +163,7 @@ enum CodeTableType {
localCarrierStationCodeTable = 3,
proprietaryIssuerStationCodeTable = 4,
};
Q_ENUM_NS(CodeTableType)
UPER_ENUM(CodeTableType)
class TrainLinkType {
UPER_GADGET
......@@ -156,9 +190,15 @@ public:
class ReturnRouteDescriptionType {
UPER_EXTENDABLE_GADGET
// TODO
public:
void decode(UPERDecoder &decoder);
UPER_ELEMENT_OPTIONAL(int, fromStationNum)
UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
UPER_ELEMENT_OPTIONAL(int, toStationNum)
UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
UPER_ELEMENT_OPTIONAL(QString, validReturnRegionDesc)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validReturnRegion)
UPER_GADGET_FINALIZE
};
enum TravelClassType {
......@@ -171,15 +211,26 @@ enum TravelClassType {
business = 6,
all = 7
};
Q_ENUM_NS(TravelClassType)
UPER_EXTENABLE_ENUM(TravelClassType)
class RouteSectionType {
UPER_GADGET
// TODO
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
UPER_ELEMENT_OPTIONAL(int, fromStationNum)
UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
UPER_ELEMENT_OPTIONAL(int, toStationNum)
UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
UPER_GADGET_FINALIZE
};
class SeriesDetailType {
UPER_GADGET
UPER_ELEMENT_OPTIONAL(int, supplyingCarrier)
UPER_ELEMENT_OPTIONAL(int, offerIdentification)
UPER_ELEMENT_OPTIONAL(int, series)
UPER_GADGET_FINALIZE
};
class CardReferenceType {
......@@ -197,6 +248,34 @@ class CardReferenceType {
UPER_GADGET_FINALIZE
};
enum ServiceType {
seat = 0,
couchette = 1,
berth = 2,
carcarriage = 3,
};
UPER_ENUM(ServiceType)
class PlacesType {
UPER_GADGET
UPER_ELEMENT_OPTIONAL(QByteArray, coach)
UPER_ELEMENT_OPTIONAL(QByteArray, placeString)
UPER_ELEMENT_OPTIONAL(QString, placeDescription)
UPER_ELEMENT_OPTIONAL(QList<QByteArray>, placeIA5)
UPER_ELEMENT_OPTIONAL(QList<int>, placeNum)
UPER_GADGET_FINALIZE
};
class CompartmentDetailsType {
UPER_EXTENDABLE_GADGET
// TODO
};
class BerthDetailData {
UPER_EXTENDABLE_GADGET
// TODO
};
class TariffType {
UPER_EXTENDABLE_GADGET
UPER_ELEMENT_DEFAULT(int, numberOfPassengers, 1)
......@@ -214,18 +293,117 @@ class TariffType {
UPER_GADGET_FINALIZE
};
enum PriceTypeType {
noPrice = 0,
reservationFee = 1,
supplement = 2,
travelPrice = 3,
};
UPER_ENUM(PriceTypeType)
class VatDetailType {
UPER_GADGET
// TODO
UPER_ELEMENT(int, country)
UPER_ELEMENT(int, percentage)
UPER_ELEMENT_OPTIONAL(int, amount)
UPER_ELEMENT_OPTIONAL(QByteArray, vatId)
UPER_GADGET_FINALIZE
};
class IncludedOpenTicketType {
UPER_EXTENDABLE_GADGET
// TODO
UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
UPER_ELEMENT_OPTIONAL(int, productIdNum)
UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
UPER_ELEMENT_OPTIONAL(int, externalIssuerId)
UPER_ELEMENT_OPTIONAL(int, issuerAutorizationId)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validRegion)
UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
UPER_ELEMENT_OPTIONAL(int, validFromTime)
UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
UPER_ELEMENT_OPTIONAL(int, validUntilTime)
UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::TravelClassType, classCode)
UPER_ELEMENT_OPTIONAL(QByteArray, serviceLevel)
UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
UPER_ELEMENT_OPTIONAL(QList<int>, includedServiceBrands)
UPER_ELEMENT_OPTIONAL(QList<int>, excludedServiceBrands)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TariffType>, tariffs)
UPER_ELEMENT_OPTIONAL(QString, infoText)
UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
UPER_GADGET_FINALIZE
};
class RegisteredLuggageType {
UPER_EXTENDABLE_GADGET
UPER_ELEMENT_OPTIONAL(QByteArray, registrationId)
UPER_ELEMENT_OPTIONAL(int, maxWeight)
UPER_ELEMENT_OPTIONAL(int, maxSize)
UPER_GADGET_FINALIZE
};
class LuggageRestrictionType {
UPER_EXTENDABLE_GADGET
UPER_ELEMENT_DEFAULT(int, maxHandLuggagePieces, 3)
UPER_ELEMENT_DEFAULT(int, maxNonHandLuggagePieces, 1)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegisteredLuggageType>, registeredLuggage)
UPER_GADGET_FINALIZE
};
class ReservationData {
UPER_EXTENDABLE_GADGET
UPER_ELEMENT_OPTIONAL(int, trainNum)
UPER_ELEMENT_OPTIONAL(QByteArray, trainIA5)
UPER_ELEMENT_DEFAULT(int, departureDate, 0)
UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
UPER_ELEMENT_OPTIONAL(int, referenceNum)
UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
UPER_ELEMENT_OPTIONAL(int, productIdNum)
UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
UPER_ELEMENT_OPTIONAL(int, serviceBrand)
UPER_ELEMENT_OPTIONAL(QString, serviceBrandAbrUTF8)
UPER_ELEMENT_OPTIONAL(QString, serviceBrandNameUTF8)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::ServiceType, service, seat)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUICReservation)
UPER_ELEMENT_OPTIONAL(int, fromStationNum)
UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
UPER_ELEMENT_OPTIONAL(int, toStationNum)