8 #include <opentrep/Travel.pb.h>
15 const std::string IATAType::_labels[
LAST_VALUE] =
16 {
"CTY_AIRP",
"CTY_HPT",
"CTY_RSTN",
"CTY_BSTN",
"CTY_FERRY",
17 "CITY",
"AIRP",
"HPT",
"RSTN",
"BSTN",
"FERRY",
"OFF" };
21 {
'a',
'h',
'r',
'b',
'p',
'C',
'A',
'H',
'R',
'B',
'P',
'O' };
30 : _type (iIATAType._type) {
43 case 'h': oType =
CTY_HPT;
break;
47 case 'C': oType =
CITY;
break;
48 case 'A': oType =
AIRP;
break;
49 case 'H': oType =
HPT;
break;
50 case 'R': oType =
RSTN;
break;
51 case 'B': oType =
BSTN;
break;
52 case 'P': oType =
FERRY;
break;
53 case 'O': oType =
OFF;
break;
59 std::ostringstream oMessage;
60 oMessage <<
"The output type '" << iTypeChar
61 <<
"' is not known. Known output types: " << lLabels;
69 IATAType::IATAType (
const char iTypeChar)
70 : _type (getType (iTypeChar)) {
74 IATAType::IATAType (
const std::string& iTypeStr) : _type (
LAST_VALUE) {
75 if (iTypeStr ==
"CA") {
77 }
else if (iTypeStr ==
"CH") {
79 }
else if (iTypeStr ==
"CR") {
81 }
else if (iTypeStr ==
"CB") {
83 }
else if (iTypeStr ==
"CP") {
85 }
else if (iTypeStr ==
"C") {
87 }
else if (iTypeStr ==
"A") {
89 }
else if (iTypeStr ==
"H") {
91 }
else if (iTypeStr ==
"R") {
93 }
else if (iTypeStr ==
"B") {
95 }
else if (iTypeStr ==
"P") {
97 }
else if (iTypeStr ==
"O") {
105 std::ostringstream oMessage;
106 oMessage <<
"The output type '" << iTypeStr
107 <<
"' is not known. Known output types: " << lLabels;
114 return _labels[iType];
119 return _typeLabels[iType];
124 std::ostringstream oStr;
125 oStr << _typeLabels[iType];
131 treppb::PlaceType oLocationType;
133 case CTY_AIRP: oLocationType.set_type (treppb::PlaceType::CTY_AIRP);
break;
134 case CTY_HPT: oLocationType.set_type (treppb::PlaceType::CTY_HPT);
break;
135 case CTY_RSTN: oLocationType.set_type (treppb::PlaceType::CTY_RSTN);
break;
136 case CTY_BSTN: oLocationType.set_type (treppb::PlaceType::CTY_BSTN);
break;
137 case CTY_FERRY: oLocationType.set_type (treppb::PlaceType::CTY_FERRY);
break;
138 case CITY: oLocationType.set_type (treppb::PlaceType::CITY);
break;
139 case AIRP: oLocationType.set_type (treppb::PlaceType::AIRP);
break;
140 case HPT: oLocationType.set_type (treppb::PlaceType::HPT);
break;
141 case RSTN: oLocationType.set_type (treppb::PlaceType::RSTN);
break;
142 case BSTN: oLocationType.set_type (treppb::PlaceType::BSTN);
break;
143 case FERRY: oLocationType.set_type (treppb::PlaceType::FERRY);
break;
144 case OFF: oLocationType.set_type (treppb::PlaceType::OFF);
break;
145 default: oLocationType.set_type (treppb::PlaceType::UNKNOWN);
break;
147 return oLocationType;
152 std::ostringstream ostr;
153 for (
unsigned short idx = 0; idx !=
LAST_VALUE; ++idx) {
157 ostr << _labels[idx];
169 const char oTypeChar = _typeLabels[_type];
175 std::ostringstream oStr;
176 oStr << _typeLabels[_type];
187 std::ostringstream ostr;
188 ostr << _labels[_type];
194 return (_type == iType);
199 return (_type == iIATAType._type);
static treppb::PlaceType getTypeLabelAsPB(const EN_IATAType &)
treppb::PlaceType getTypeAsPB() const
bool operator==(const EN_IATAType &) const
static std::string describeLabels()
char getTypeAsChar() const
static const std::string & getLabel(const EN_IATAType &)
EN_IATAType getType() const
std::string getTypeAsString() const
static char getTypeLabel(const EN_IATAType &)
static std::string getTypeLabelAsString(const EN_IATAType &)
const std::string describe() const
Enumeration of output types.