2015-11-18 19:59:03 +00:00
|
|
|
#include "Phone.h"
|
|
|
|
|
|
|
|
using std::string;
|
2016-05-02 18:31:59 +00:00
|
|
|
using boost::optional;
|
2015-11-18 19:59:03 +00:00
|
|
|
|
2016-04-14 20:14:20 +00:00
|
|
|
PhoneConverter& PhoneConverter::get() {
|
|
|
|
static PhoneConverter converter;
|
|
|
|
return converter;
|
2015-11-18 19:59:03 +00:00
|
|
|
}
|
|
|
|
|
2016-04-14 20:14:20 +00:00
|
|
|
string PhoneConverter::getTypeName() {
|
|
|
|
return "Phone";
|
|
|
|
}
|
|
|
|
|
|
|
|
EnumConverter<Phone>::member_data PhoneConverter::getMemberData() {
|
|
|
|
return member_data{
|
|
|
|
{ Phone::Unknown, "Unknown" },
|
|
|
|
{ Phone::AO, "AO" },
|
|
|
|
{ Phone::AA, "AA" },
|
|
|
|
{ Phone::IY, "IY" },
|
|
|
|
{ Phone::UW, "UW" },
|
|
|
|
{ Phone::EH, "EH" },
|
|
|
|
{ Phone::IH, "IH" },
|
|
|
|
{ Phone::UH, "UH" },
|
|
|
|
{ Phone::AH, "AH" },
|
|
|
|
{ Phone::AE, "AE" },
|
|
|
|
{ Phone::EY, "EY" },
|
|
|
|
{ Phone::AY, "AY" },
|
|
|
|
{ Phone::OW, "OW" },
|
|
|
|
{ Phone::AW, "AW" },
|
|
|
|
{ Phone::OY, "OY" },
|
|
|
|
{ Phone::ER, "ER" },
|
|
|
|
{ Phone::P, "P" },
|
|
|
|
{ Phone::B, "B" },
|
|
|
|
{ Phone::T, "T" },
|
|
|
|
{ Phone::D, "D" },
|
|
|
|
{ Phone::K, "K" },
|
|
|
|
{ Phone::G, "G" },
|
|
|
|
{ Phone::CH, "CH" },
|
|
|
|
{ Phone::JH, "JH" },
|
|
|
|
{ Phone::F, "F" },
|
|
|
|
{ Phone::V, "V" },
|
|
|
|
{ Phone::TH, "TH" },
|
|
|
|
{ Phone::DH, "DH" },
|
|
|
|
{ Phone::S, "S" },
|
|
|
|
{ Phone::Z, "Z" },
|
|
|
|
{ Phone::SH, "SH" },
|
|
|
|
{ Phone::ZH, "ZH" },
|
|
|
|
{ Phone::HH, "HH" },
|
|
|
|
{ Phone::M, "M" },
|
|
|
|
{ Phone::N, "N" },
|
|
|
|
{ Phone::NG, "NG" },
|
|
|
|
{ Phone::L, "L" },
|
|
|
|
{ Phone::R, "R" },
|
|
|
|
{ Phone::Y, "Y" },
|
|
|
|
{ Phone::W, "W" }
|
2016-03-08 20:44:57 +00:00
|
|
|
};
|
|
|
|
}
|
2015-11-18 19:59:03 +00:00
|
|
|
|
2016-05-02 18:31:59 +00:00
|
|
|
optional<Phone> PhoneConverter::tryParse(const string& s) {
|
2016-04-14 20:14:20 +00:00
|
|
|
auto result = EnumConverter<Phone>::tryParse(s);
|
|
|
|
return result ? result : Phone::Unknown;
|
2015-11-18 19:59:03 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 20:44:57 +00:00
|
|
|
std::ostream& operator<<(std::ostream& stream, Phone value) {
|
2016-04-14 20:14:20 +00:00
|
|
|
return PhoneConverter::get().write(stream, value);
|
2015-11-18 19:59:03 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 20:44:57 +00:00
|
|
|
std::istream& operator>>(std::istream& stream, Phone& value) {
|
2016-04-14 20:14:20 +00:00
|
|
|
return PhoneConverter::get().read(stream, value);
|
2015-11-20 21:20:19 +00:00
|
|
|
}
|