From 6c298fc2787f176bdadd46a4183a4ea7e5925b90 Mon Sep 17 00:00:00 2001 From: Eric Floyd <101071809+eric-bodhi@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:21:35 -0500 Subject: [PATCH] Feature/airline (#217) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Created Airline headers and source filse, compiles * Added AirlineTests --------- Co-authored-by: Michał Cieślar --- CMakeLists.txt | 2 + include/faker-cxx/Airline.h | 140 +++++++++++++++++++ src/modules/airline/Airline.cpp | 64 +++++++++ src/modules/airline/AirlineTest.cpp | 134 ++++++++++++++++++ src/modules/airline/data/AircraftTypes.h | 8 ++ src/modules/airline/data/Airlines.h | 137 +++++++++++++++++++ src/modules/airline/data/Airplanes.h | 167 +++++++++++++++++++++++ src/modules/airline/data/Airports.h | 148 ++++++++++++++++++++ src/modules/airline/data/Seat.h | 26 ++++ 9 files changed, 826 insertions(+) create mode 100644 include/faker-cxx/Airline.h create mode 100644 src/modules/airline/Airline.cpp create mode 100644 src/modules/airline/AirlineTest.cpp create mode 100644 src/modules/airline/data/AircraftTypes.h create mode 100644 src/modules/airline/data/Airlines.h create mode 100644 src/modules/airline/data/Airplanes.h create mode 100644 src/modules/airline/data/Airports.h create mode 100644 src/modules/airline/data/Seat.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4d0c20..82d7f86b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ set(FAKER_SOURCES src/modules/medicine/Medicine.cpp src/modules/weather/Weather.cpp src/common/WeatherHelper.cpp + src/modules/airline/Airline.cpp ) set(FAKER_UT_SOURCES @@ -82,6 +83,7 @@ set(FAKER_UT_SOURCES src/modules/medicine/MedicineTest.cpp src/modules/weather/WeatherTest.cpp src/common/WeatherHelperTest.cpp + src/modules/airline/AirlineTest.cpp ) add_library(${LIBRARY_NAME} ${FAKER_SOURCES}) diff --git a/include/faker-cxx/Airline.h b/include/faker-cxx/Airline.h new file mode 100644 index 00000000..de268694 --- /dev/null +++ b/include/faker-cxx/Airline.h @@ -0,0 +1,140 @@ +#pragma once + +#include +#include + +namespace faker { +class Airline { +public: + enum class AircraftType + { + Regional, + Narrowbody, + Widebody, + }; + + /* + * @brief Get a random aircraft type + * + * @return a random aircraft type + * + * @code + * Airline::aircraftType // "narrowbody" + */ + static std::string aircraftType(); + + struct Airplane + { + std::string name; + std::string iataTypeCode; + }; + + /* + * @brief Get a random airplane + * + * @return a random airplane and its iataTypeCode + * + * @code + * Airline::airplane() // {"Boeing 737-800", "738"} + * @endcode + */ + static Airplane airplane(); + + struct AirlineStruct + { + std::string name; + std::string iataCode; + }; + + /* + * @brief Get a random airline + * + * @return a random airline and its iataCode + * + * @code + * Airline::airline() // {"Air Canada", "AC"} + * @endcode + */ + static AirlineStruct airline(); + + struct Airport + { + std::string name; + std::string iataCode; + }; + + /* + * @brief Get a random airport + * + * @return a random airport and its iataCode + * + * @code + * Airline::airport() // {"Toronto Pearson International Airport", "YYZ"} + * @endcode + */ + static Airport airport(); + + /* + * @brief Get a random seat by aircraft type + * + * @param aircraftType the aircraft type + * + * @return a random seat + * + * @code + * Airline::seat(AircraftType::Narrowbody) // "1A" + * @endcode + */ + static std::string seat(AircraftType aircraftType); + + /* + * @brief Get a random record location + * + * @return a random record location + * + * @code + * Airline::recordLocator() // "ABCDEF" + * Airline::recordLocator(true) // "ABC123" + * @endcode + */ + static std::string recordLocator(bool allowNumerics = false); + + /* + * @brief Get a random flight number from given length + * + * @param addLeadingZeros whether to add leading zeros + * + * @param length the length of the flight number + * + * @return a random flight number + * + * @code + * Airline::flightNumber() // "1234" + * Airline::flightNumber(true) // "0123" + * Airline::flightNumber(false, 3) // "234" + * @endcode + */ + static std::string flightNumber(bool addLeadingZeros = false, unsigned int length = 4); + + struct Range { + unsigned int min; + unsigned int max; + }; + /* + * @brief Get a random flight number from given length + * + * @param addLeadingZeros whether to add leading zeros + * + * @param length the length of the flight number + * + * @return a random flight number + * + * @code + * Airline::flightNumber() // "1234" + * Airline::flightNumber(true) // "0123" + * Airline::flightNumber(false, {1, 4}) // "234" // "12" // "1234" + * @endcode + */ + static std::string flightNumber(bool addLeadingZeros = false, Range length = {1, 4}); +}; +} \ No newline at end of file diff --git a/src/modules/airline/Airline.cpp b/src/modules/airline/Airline.cpp new file mode 100644 index 00000000..56926c8d --- /dev/null +++ b/src/modules/airline/Airline.cpp @@ -0,0 +1,64 @@ +#include "faker-cxx/Airline.h" +#include "faker-cxx/Helper.h" +#include "faker-cxx/Number.h" +#include "faker-cxx/String.h" + +#include + +#include "data/AircraftTypes.h" +#include "data/Airplanes.h" +#include "data/Airlines.h" +#include "data/Airports.h" +#include "data/Seat.h" + +namespace faker +{ +std::string Airline::aircraftType() +{ + return Helper::arrayElement(aircraftTypes); +} + +Airline::Airplane Airline::airplane() +{ + return Helper::arrayElement(airplanes); +} + +Airline::AirlineStruct Airline::airline() +{ + return Helper::arrayElement(airlines); +} + +Airline::Airport Airline::airport() +{ + return Helper::arrayElement(airports); +} + +std::string Airline::seat(Airline::AircraftType aircraftType) { + return std::to_string(Number::integer(1, aircraftTypeMaxRows.at(aircraftType))) + Helper::arrayElement(aircraftTypeSeatLetters.at(aircraftType)); +} + +std::string Airline::recordLocator(bool allowNumerics) +{ + if (allowNumerics) { + return String::alphanumeric(6, StringCasing::Upper); + } + + return String::alpha(6, StringCasing::Upper); +} + +std::string Airline::flightNumber(bool addLeadingZeros, unsigned int length) { + if (addLeadingZeros) { + return String::numeric(length, true); + } + + return String::numeric(length, false); +} + +std::string Airline::flightNumber(bool addLeadingZeros, Airline::Range length) { + if (addLeadingZeros) { + return String::numeric(Number::integer(length.min, length.max), true); + } + + return String::numeric(Number::integer(length.min, length.max), false); +} +} \ No newline at end of file diff --git a/src/modules/airline/AirlineTest.cpp b/src/modules/airline/AirlineTest.cpp new file mode 100644 index 00000000..88c99eba --- /dev/null +++ b/src/modules/airline/AirlineTest.cpp @@ -0,0 +1,134 @@ +#include "faker-cxx/Airline.h" +#include "gtest/gtest.h" + +#include +#include + +#include "data/AircraftTypes.h" +#include "data/Airplanes.h" +#include "data/Airlines.h" +#include "data/Airports.h" +#include "data/Seat.h" + +using namespace ::testing; +using namespace faker; + +class AirlineTest : public Test +{ +public: +}; + +TEST_F(AirlineTest, shouldGenerateAircraftType) +{ + std::string generatedAircraftType = Airline::aircraftType(); + + ASSERT_TRUE(std::ranges::any_of(aircraftTypes, [generatedAircraftType](const std::string& aircraftType) + { return aircraftType == generatedAircraftType; })); +} + +TEST_F(AirlineTest, shouldGenerateAirline) { + Airline::AirlineStruct generatedAirline = Airline::airline(); + + ASSERT_TRUE(std::ranges::any_of(airlines, [generatedAirline](const Airline::AirlineStruct& airline) + { return airline.name == generatedAirline.name && airline.iataCode == generatedAirline.iataCode; })); +} + +TEST_F(AirlineTest, shouldGenerateAirplane) { + Airline::Airplane generatedAirplane = Airline::airplane(); + + ASSERT_TRUE(std::ranges::any_of(airplanes, [generatedAirplane](const Airline::Airplane& airplane) + { return airplane.name == generatedAirplane.name && airplane.iataTypeCode == generatedAirplane.iataTypeCode; })); +} + +TEST_F(AirlineTest, shouldGenerateAirport) { + Airline::Airport generatedAirport = Airline::airport(); + + ASSERT_TRUE(std::ranges::any_of(airports, [generatedAirport](const Airline::Airport& airport) + { return airport.name == generatedAirport.name && airport.iataCode == generatedAirport.iataCode; })); +} + +TEST_F(AirlineTest, shouldGenerateRecordLocator) { + std::string generatedRecordLocatorWithAlpha = Airline::recordLocator(false); + + ASSERT_EQ(generatedRecordLocatorWithAlpha.length(), 6); + ASSERT_TRUE(std::ranges::all_of(generatedRecordLocatorWithAlpha, [](const char& c) + { return std::isalpha(c); })); + + std::string generatedRecordLocatorWithNumerics = Airline::recordLocator(true); + + ASSERT_EQ(generatedRecordLocatorWithNumerics.length(), 6); + ASSERT_TRUE(std::ranges::all_of(generatedRecordLocatorWithNumerics, [](const char& c) + { return std::isalnum(c); })); +} + +TEST_F(AirlineTest, shouldGenerateSeatNumberRegional) { + std::string generatedSeatNumber = Airline::seat(Airline::AircraftType::Regional); + + ASSERT_TRUE(generatedSeatNumber.length() == 2 || generatedSeatNumber.length() == 3); + + int min = 1; + int max = aircraftTypeMaxRows.at(Airline::AircraftType::Regional); + + bool inRange = false; + for (int i = max; i >= min; --i) { + std::string numberStr = std::to_string(i); + if (generatedSeatNumber.find(numberStr) != std::string::npos) { + inRange = true; + break; + } + } + + ASSERT_TRUE(inRange); + ASSERT_TRUE(std::ranges::any_of( + aircraftTypeSeatLetters.at(Airline::AircraftType::Regional), + [generatedSeatNumber](char letter) { return generatedSeatNumber.back() == letter; } + )); +} + +TEST_F(AirlineTest, shouldGenerateSeatNumberNarrowbody) { + std::string generatedSeatNumber = Airline::seat(Airline::AircraftType::Narrowbody); + + ASSERT_TRUE(generatedSeatNumber.length() == 2 || generatedSeatNumber.length() == 3); + + int min = 1; + int max = aircraftTypeMaxRows.at(Airline::AircraftType::Narrowbody); + + bool inRange = false; + for (int i = max; i >= min; --i) { + std::string numberStr = std::to_string(i); + if (generatedSeatNumber.find(numberStr) != std::string::npos) { + inRange = true; + break; + } + } + + ASSERT_TRUE(inRange); + ASSERT_TRUE(std::ranges::any_of( + aircraftTypeSeatLetters.at(Airline::AircraftType::Narrowbody), + [generatedSeatNumber](char letter) { return generatedSeatNumber.back() == letter; } + )); +} + +TEST_F(AirlineTest, shouldGenerateSeatNumberWidebody) { + std::string generatedSeatNumber = Airline::seat(Airline::AircraftType::Widebody); + + ASSERT_TRUE(generatedSeatNumber.length() == 2 || generatedSeatNumber.length() == 3); + + int min = 1; + int max = aircraftTypeMaxRows.at(Airline::AircraftType::Widebody); + + bool inRange = false; + for (int i = max; i >= min; --i) { + std::string numberStr = std::to_string(i); + if (generatedSeatNumber.find(numberStr) != std::string::npos) { + inRange = true; + break; + } + } + + ASSERT_TRUE(inRange); + ASSERT_TRUE(std::ranges::any_of( + aircraftTypeSeatLetters.at(Airline::AircraftType::Widebody), + [generatedSeatNumber](char letter) { return generatedSeatNumber.back() == letter; } + )); +} \ No newline at end of file diff --git a/src/modules/airline/data/AircraftTypes.h b/src/modules/airline/data/AircraftTypes.h new file mode 100644 index 00000000..9ce0dc1c --- /dev/null +++ b/src/modules/airline/data/AircraftTypes.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include + +namespace faker { +const std::vector aircraftTypes = {"regional", "narrowbody", "widebody"}; +} \ No newline at end of file diff --git a/src/modules/airline/data/Airlines.h b/src/modules/airline/data/Airlines.h new file mode 100644 index 00000000..5f3503d2 --- /dev/null +++ b/src/modules/airline/data/Airlines.h @@ -0,0 +1,137 @@ +#pragma once + +#include "faker-cxx/Airline.h" + +#include +#include + +namespace faker +{ +const std::vector airlines{ + {.name = "Aegean Airlines", .iataCode = "A3"}, + {.name = "Aeroflot", .iataCode = "SU"}, + {.name = "Aerolineas Argentinas", .iataCode = "AR"}, + {.name = "Aeromexico", .iataCode = "AM"}, + {.name = "Air Algerie", .iataCode = "AH"}, + {.name = "Air Arabia", .iataCode = "G9"}, + {.name = "Air Canada", .iataCode = "AC"}, + {.name = "Air China", .iataCode = "CA"}, + {.name = "Air Europa", .iataCode = "UX"}, + {.name = "Air France-KLM", .iataCode = "AF"}, + {.name = "Air India", .iataCode = "AI"}, + {.name = "Air Mauritius", .iataCode = "MK"}, + {.name = "Air New Zealand", .iataCode = "NZ"}, + {.name = "Air Niugini", .iataCode = "PX"}, + {.name = "Air Tahiti", .iataCode = "VT"}, + {.name = "Air Tahiti Nui", .iataCode = "TN"}, + {.name = "Air Transat", .iataCode = "TS"}, + {.name = "AirAsia X", .iataCode = "D7"}, + {.name = "AirAsia", .iataCode = "AK"}, + {.name = "Aircalin", .iataCode = "SB"}, + {.name = "Alaska Airlines", .iataCode = "AS"}, + {.name = "Alitalia", .iataCode = "AZ"}, + {.name = "All Nippon Airways", .iataCode = "NH"}, + {.name = "Allegiant Air", .iataCode = "G4"}, + {.name = "American Airlines", .iataCode = "AA"}, + {.name = "Asiana Airlines", .iataCode = "OZ"}, + {.name = "Avianca", .iataCode = "AV"}, + {.name = "Azul Linhas Aereas Brasileiras", .iataCode = "AD"}, + {.name = "Azur Air", .iataCode = "ZF"}, + {.name = "Beijing Capital Airlines", .iataCode = "JD"}, + {.name = "Boliviana de Aviacion", .iataCode = "OB"}, + {.name = "British Airways", .iataCode = "BA"}, + {.name = "Cathay Pacific", .iataCode = "CX"}, + {.name = "Cebu Pacific Air", .iataCode = "5J"}, + {.name = "China Airlines", .iataCode = "CI"}, + {.name = "China Eastern Airlines", .iataCode = "MU"}, + {.name = "China Southern Airlines", .iataCode = "CZ"}, + {.name = "Condor", .iataCode = "DE"}, + {.name = "Copa Airlines", .iataCode = "CM"}, + {.name = "Delta Air Lines", .iataCode = "DL"}, + {.name = "Easyfly", .iataCode = "VE"}, + {.name = "EasyJet", .iataCode = "U2"}, + {.name = "EcoJet", .iataCode = "8J"}, + {.name = "Egyptair", .iataCode = "MS"}, + {.name = "El Al", .iataCode = "LY"}, + {.name = "Emirates Airlines", .iataCode = "EK"}, + {.name = "Ethiopian Airlines", .iataCode = "ET"}, + {.name = "Etihad Airways", .iataCode = "EY"}, + {.name = "EVA Air", .iataCode = "BR"}, + {.name = "Fiji Airways", .iataCode = "FJ"}, + {.name = "Finnair", .iataCode = "AY"}, + {.name = "Flybondi", .iataCode = "FO"}, + {.name = "Flydubai", .iataCode = "FZ"}, + {.name = "FlySafair", .iataCode = "FA"}, + {.name = "Frontier Airlines", .iataCode = "F9"}, + {.name = "Garuda Indonesia", .iataCode = "GA"}, + {.name = "Go First", .iataCode = "G8"}, + {.name = "Gol Linhas Aereas Inteligentes", .iataCode = "G3"}, + {.name = "Hainan Airlines", .iataCode = "HU"}, + {.name = "Hawaiian Airlines", .iataCode = "HA"}, + {.name = "IndiGo Airlines", .iataCode = "6E"}, + {.name = "Japan Airlines", .iataCode = "JL"}, + {.name = "Jeju Air", .iataCode = "7C"}, + {.name = "Jet2", .iataCode = "LS"}, + {.name = "JetBlue Airways", .iataCode = "B6"}, + {.name = "JetSMART", .iataCode = "JA"}, + {.name = "Juneyao Airlines", .iataCode = "HO"}, + {.name = "Kenya Airways", .iataCode = "KQ"}, + {.name = "Korean Air", .iataCode = "KE"}, + {.name = "Kulula.com", .iataCode = "MN"}, + {.name = "LATAM Airlines", .iataCode = "LA"}, + {.name = "Lion Air", .iataCode = "JT"}, + {.name = "LOT Polish Airlines", .iataCode = "LO"}, + {.name = "Lufthansa", .iataCode = "LH"}, + {.name = "Libyan Airlines", .iataCode = "LN"}, + {.name = "Linea Aerea Amaszonas", .iataCode = "Z8"}, + {.name = "Malaysia Airlines", .iataCode = "MH"}, + {.name = "Nordwind Airlines", .iataCode = "N4"}, + {.name = "Norwegian Air Shuttle", .iataCode = "DY"}, + {.name = "Oman Air", .iataCode = "WY"}, + {.name = "Pakistan International Airlines", .iataCode = "PK"}, + {.name = "Pegasus Airlines", .iataCode = "PC"}, + {.name = "Philippine Airlines", .iataCode = "PR"}, + {.name = "Qantas Group", .iataCode = "QF"}, + {.name = "Qatar Airways", .iataCode = "QR"}, + {.name = "Republic Airways", .iataCode = "YX"}, + {.name = "Royal Air Maroc", .iataCode = "AT"}, + {.name = "Ryanair", .iataCode = "FR"}, + {.name = "S7 Airlines", .iataCode = "S7"}, + {.name = "SAS", .iataCode = "SK"}, + {.name = "Satena", .iataCode = "9R"}, + {.name = "Saudia", .iataCode = "SV"}, + {.name = "Shandong Airlines", .iataCode = "SC"}, + {.name = "Sichuan Airlines", .iataCode = "3U"}, + {.name = "Singapore Airlines", .iataCode = "SQ"}, + {.name = "Sky Airline", .iataCode = "H2"}, + {.name = "SkyWest Airlines", .iataCode = "OO"}, + {.name = "South African Airways", .iataCode = "SA"}, + {.name = "Southwest Airlines", .iataCode = "WN"}, + {.name = "SpiceJet", .iataCode = "SG"}, + {.name = "Spirit Airlines", .iataCode = "NK"}, + {.name = "Spring Airlines", .iataCode = "9S"}, + {.name = "SriLankan Airlines", .iataCode = "UL"}, + {.name = "Star Peru", .iataCode = "2I"}, + {.name = "Sun Country Airlines", .iataCode = "SY"}, + {.name = "SunExpress", .iataCode = "XQ"}, + {.name = "TAP Air Portugal", .iataCode = "TP"}, + {.name = "Thai AirAsia", .iataCode = "FD"}, + {.name = "Thai Airways", .iataCode = "TG"}, + {.name = "TUI Airways", .iataCode = "BY"}, + {.name = "Tunisair", .iataCode = "TU"}, + {.name = "Turkish Airlines", .iataCode = "TK"}, + {.name = "Ukraine International", .iataCode = "PS"}, + {.name = "United Airlines", .iataCode = "UA"}, + {.name = "Ural Airlines", .iataCode = "U6"}, + {.name = "VietJet Air", .iataCode = "VJ"}, + {.name = "Vietnam Airlines", .iataCode = "VN"}, + {.name = "Virgin Atlantic Airways", .iataCode = "VS"}, + {.name = "Virgin Australia", .iataCode = "VA"}, + {.name = "VivaAerobus", .iataCode = "VB"}, + {.name = "VOEPASS Linhas Aereas", .iataCode = "2Z"}, + {.name = "Volaris", .iataCode = "Y4"}, + {.name = "WestJet", .iataCode = "WS"}, + {.name = "Wingo", .iataCode = "P5"}, + {.name = "Wizz Air", .iataCode = "W6"}, +}; +} \ No newline at end of file diff --git a/src/modules/airline/data/Airplanes.h b/src/modules/airline/data/Airplanes.h new file mode 100644 index 00000000..80cf2743 --- /dev/null +++ b/src/modules/airline/data/Airplanes.h @@ -0,0 +1,167 @@ +#pragma once + +#include "faker-cxx/Airline.h" + +#include +#include + +namespace faker +{ +const std::vector airplanes { + { .name = "Aerospatiale/BAC Concorde", .iataTypeCode = "SSC" }, + { .name = "Airbus A300", .iataTypeCode = "AB3" }, + { .name = "Airbus A310", .iataTypeCode = "310" }, + { .name = "Airbus A310-200", .iataTypeCode = "312" }, + { .name = "Airbus A310-300", .iataTypeCode = "313" }, + { .name = "Airbus A318", .iataTypeCode = "318" }, + { .name = "Airbus A319", .iataTypeCode = "319" }, + { .name = "Airbus A319neo", .iataTypeCode = "31N" }, + { .name = "Airbus A320", .iataTypeCode = "320" }, + { .name = "Airbus A320neo", .iataTypeCode = "32N" }, + { .name = "Airbus A321", .iataTypeCode = "321" }, + { .name = "Airbus A321neo", .iataTypeCode = "32Q" }, + { .name = "Airbus A330", .iataTypeCode = "330" }, + { .name = "Airbus A330-200", .iataTypeCode = "332" }, + { .name = "Airbus A330-300", .iataTypeCode = "333" }, + { .name = "Airbus A330-800neo", .iataTypeCode = "338" }, + { .name = "Airbus A330-900neo", .iataTypeCode = "339" }, + { .name = "Airbus A340", .iataTypeCode = "340" }, + { .name = "Airbus A340-200", .iataTypeCode = "342" }, + { .name = "Airbus A340-300", .iataTypeCode = "343" }, + { .name = "Airbus A340-500", .iataTypeCode = "345" }, + { .name = "Airbus A340-600", .iataTypeCode = "346" }, + { .name = "Airbus A350", .iataTypeCode = "350" }, + { .name = "Airbus A350-900", .iataTypeCode = "359" }, + { .name = "Airbus A350-1000", .iataTypeCode = "351" }, + { .name = "Airbus A380", .iataTypeCode = "380" }, + { .name = "Airbus A380-800", .iataTypeCode = "388" }, + { .name = "Antonov An-12", .iataTypeCode = "ANF" }, + { .name = "Antonov An-24", .iataTypeCode = "AN4" }, + { .name = "Antonov An-26", .iataTypeCode = "A26" }, + { .name = "Antonov An-28", .iataTypeCode = "A28" }, + { .name = "Antonov An-30", .iataTypeCode = "A30" }, + { .name = "Antonov An-32", .iataTypeCode = "A32" }, + { .name = "Antonov An-72", .iataTypeCode = "AN7" }, + { .name = "Antonov An-124 Ruslan", .iataTypeCode = "A4F" }, + { .name = "Antonov An-140", .iataTypeCode = "A40" }, + { .name = "Antonov An-148", .iataTypeCode = "A81" }, + { .name = "Antonov An-158", .iataTypeCode = "A58" }, + { .name = "Antonov An-225 Mriya", .iataTypeCode = "A5F" }, + { .name = "Boeing 707", .iataTypeCode = "703" }, + { .name = "Boeing 717", .iataTypeCode = "717" }, + { .name = "Boeing 720B", .iataTypeCode = "B72" }, + { .name = "Boeing 727", .iataTypeCode = "727" }, + { .name = "Boeing 727-100", .iataTypeCode = "721" }, + { .name = "Boeing 727-200", .iataTypeCode = "722" }, + { .name = "Boeing 737 MAX 7", .iataTypeCode = "7M7" }, + { .name = "Boeing 737 MAX 8", .iataTypeCode = "7M8" }, + { .name = "Boeing 737 MAX 9", .iataTypeCode = "7M9" }, + { .name = "Boeing 737 MAX 10", .iataTypeCode = "7MJ" }, + { .name = "Boeing 737", .iataTypeCode = "737" }, + { .name = "Boeing 737-100", .iataTypeCode = "731" }, + { .name = "Boeing 737-200", .iataTypeCode = "732" }, + { .name = "Boeing 737-300", .iataTypeCode = "733" }, + { .name = "Boeing 737-400", .iataTypeCode = "734" }, + { .name = "Boeing 737-500", .iataTypeCode = "735" }, + { .name = "Boeing 737-600", .iataTypeCode = "736" }, + { .name = "Boeing 737-700", .iataTypeCode = "73G" }, + { .name = "Boeing 737-800", .iataTypeCode = "738" }, + { .name = "Boeing 737-900", .iataTypeCode = "739" }, + { .name = "Boeing 747", .iataTypeCode = "747" }, + { .name = "Boeing 747-100", .iataTypeCode = "741" }, + { .name = "Boeing 747-200", .iataTypeCode = "742" }, + { .name = "Boeing 747-300", .iataTypeCode = "743" }, + { .name = "Boeing 747-400", .iataTypeCode = "744" }, + { .name = "Boeing 747-400D", .iataTypeCode = "74J" }, + { .name = "Boeing 747-8", .iataTypeCode = "748" }, + { .name = "Boeing 747SP", .iataTypeCode = "74L" }, + { .name = "Boeing 747SR", .iataTypeCode = "74R" }, + { .name = "Boeing 757", .iataTypeCode = "757" }, + { .name = "Boeing 757-200", .iataTypeCode = "752" }, + { .name = "Boeing 757-300", .iataTypeCode = "753" }, + { .name = "Boeing 767", .iataTypeCode = "767" }, + { .name = "Boeing 767-200", .iataTypeCode = "762" }, + { .name = "Boeing 767-300", .iataTypeCode = "763" }, + { .name = "Boeing 767-400", .iataTypeCode = "764" }, + { .name = "Boeing 777", .iataTypeCode = "777" }, + { .name = "Boeing 777-200", .iataTypeCode = "772" }, + { .name = "Boeing 777-200LR", .iataTypeCode = "77L" }, + { .name = "Boeing 777-300", .iataTypeCode = "773" }, + { .name = "Boeing 777-300ER", .iataTypeCode = "77W" }, + { .name = "Boeing 787", .iataTypeCode = "787" }, + { .name = "Boeing 787-8", .iataTypeCode = "788" }, + { .name = "Boeing 787-9", .iataTypeCode = "789" }, + { .name = "Boeing 787-10", .iataTypeCode = "781" }, + { .name = "Canadair Challenger", .iataTypeCode = "CCJ" }, + { .name = "Canadair CL-44", .iataTypeCode = "CL4" }, + { .name = "Canadair Regional Jet 100", .iataTypeCode = "CR1" }, + { .name = "Canadair Regional Jet 200", .iataTypeCode = "CR2" }, + { .name = "Canadair Regional Jet 700", .iataTypeCode = "CR7" }, + { .name = "Canadair Regional Jet 705", .iataTypeCode = "CRA" }, + { .name = "Canadair Regional Jet 900", .iataTypeCode = "CR9" }, + { .name = "Canadair Regional Jet 1000", .iataTypeCode = "CRK" }, + { .name = "De Havilland Canada DHC-2 Beaver", .iataTypeCode = "DHP" }, + { .name = "De Havilland Canada DHC-2 Turbo-Beaver", .iataTypeCode = "DHR" }, + { .name = "De Havilland Canada DHC-3 Otter", .iataTypeCode = "DHL" }, + { .name = "De Havilland Canada DHC-4 Caribou", .iataTypeCode = "DHC" }, + { .name = "De Havilland Canada DHC-6 Twin Otter", .iataTypeCode = "DHT" }, + { .name = "De Havilland Canada DHC-7 Dash 7", .iataTypeCode = "DH7" }, + { .name = "De Havilland Canada DHC-8-100 Dash 8 / 8Q", .iataTypeCode = "DH1" }, + { .name = "De Havilland Canada DHC-8-200 Dash 8 / 8Q", .iataTypeCode = "DH2" }, + { .name = "De Havilland Canada DHC-8-300 Dash 8 / 8Q", .iataTypeCode = "DH3" }, + { .name = "De Havilland Canada DHC-8-400 Dash 8Q", .iataTypeCode = "DH4" }, + { .name = "De Havilland DH.104 Dove", .iataTypeCode = "DHD" }, + { .name = "De Havilland DH.114 Heron", .iataTypeCode = "DHH" }, + { .name = "Douglas DC-3", .iataTypeCode = "D3F" }, + { .name = "Douglas DC-6", .iataTypeCode = "D6F" }, + { .name = "Douglas DC-8-50", .iataTypeCode = "D8T" }, + { .name = "Douglas DC-8-62", .iataTypeCode = "D8L" }, + { .name = "Douglas DC-8-72", .iataTypeCode = "D8Q" }, + { .name = "Douglas DC-9-10", .iataTypeCode = "D91" }, + { .name = "Douglas DC-9-20", .iataTypeCode = "D92" }, + { .name = "Douglas DC-9-30", .iataTypeCode = "D93" }, + { .name = "Douglas DC-9-40", .iataTypeCode = "D94" }, + { .name = "Douglas DC-9-50", .iataTypeCode = "D95" }, + { .name = "Douglas DC-10", .iataTypeCode = "D10" }, + { .name = "Douglas DC-10-10", .iataTypeCode = "D1X" }, + { .name = "Douglas DC-10-30", .iataTypeCode = "D1Y" }, + { .name = "Embraer 170", .iataTypeCode = "E70" }, + { .name = "Embraer 175", .iataTypeCode = "E75" }, + { .name = "Embraer 190", .iataTypeCode = "E90" }, + { .name = "Embraer 195", .iataTypeCode = "E95" }, + { .name = "Embraer E190-E2", .iataTypeCode = "290" }, + { .name = "Embraer E195-E2", .iataTypeCode = "295" }, + { .name = "Embraer EMB.110 Bandeirante", .iataTypeCode = "EMB" }, + { .name = "Embraer EMB.120 Brasilia", .iataTypeCode = "EM2" }, + { .name = "Embraer Legacy 600", .iataTypeCode = "ER3" }, + { .name = "Embraer Phenom 100", .iataTypeCode = "EP1" }, + { .name = "Embraer Phenom 300", .iataTypeCode = "EP3" }, + { .name = "Embraer RJ135", .iataTypeCode = "ER3" }, + { .name = "Embraer RJ140", .iataTypeCode = "ERD" }, + { .name = "Embraer RJ145 Amazon", .iataTypeCode = "ER4" }, + { .name = "Ilyushin IL18", .iataTypeCode = "IL8" }, + { .name = "Ilyushin IL62", .iataTypeCode = "IL6" }, + { .name = "Ilyushin IL76", .iataTypeCode = "IL7" }, + { .name = "Ilyushin IL86", .iataTypeCode = "ILW" }, + { .name = "Ilyushin IL96-300", .iataTypeCode = "I93" }, + { .name = "Ilyushin IL114", .iataTypeCode = "I14" }, + { .name = "Lockheed L-182 / 282 / 382 (L-100) Hercules", .iataTypeCode = "LOH" }, + { .name = "Lockheed L-188 Electra", .iataTypeCode = "LOE" }, + { .name = "Lockheed L-1011 Tristar", .iataTypeCode = "L10" }, + { .name = "Lockheed L-1049 Super Constellation", .iataTypeCode = "L49" }, + { .name = "McDonnell Douglas MD11", .iataTypeCode = "M11" }, + { .name = "McDonnell Douglas MD80", .iataTypeCode = "M80" }, + { .name = "McDonnell Douglas MD81", .iataTypeCode = "M81" }, + { .name = "McDonnell Douglas MD82", .iataTypeCode = "M82" }, + { .name = "McDonnell Douglas MD83", .iataTypeCode = "M83" }, + { .name = "McDonnell Douglas MD87", .iataTypeCode = "M87" }, + { .name = "McDonnell Douglas MD88", .iataTypeCode = "M88" }, + { .name = "McDonnell Douglas MD90", .iataTypeCode = "M90" }, + { .name = "Sukhoi Superjet 100-95", .iataTypeCode = "SU9" }, + { .name = "Tupolev Tu-134", .iataTypeCode = "TU3" }, + { .name = "Tupolev Tu-154", .iataTypeCode = "TU5" }, + { .name = "Tupolev Tu-204", .iataTypeCode = "T20" }, + { .name = "Yakovlev Yak-40", .iataTypeCode = "YK4" }, + { .name = "Yakovlev Yak-42", .iataTypeCode = "YK2" }, +}; +} \ No newline at end of file diff --git a/src/modules/airline/data/Airports.h b/src/modules/airline/data/Airports.h new file mode 100644 index 00000000..7d18a7ad --- /dev/null +++ b/src/modules/airline/data/Airports.h @@ -0,0 +1,148 @@ +#pragma once + +#include "faker-cxx/Airline.h" + +#include +#include + +namespace faker +{ +const std::vector airports = { + { .name = "Adelaide International Airport", .iataCode = "ADL" }, + { .name = "Adolfo Suarez Madrid-Barajas Airport", .iataCode = "MAD" }, + { .name = "Aeroparque Jorge Newbery Airport", .iataCode = "AEP" }, + { .name = "Afonso Pena International Airport", .iataCode = "CWB" }, + { .name = "Alfonso Bonilla Aragon International Airport", .iataCode = "CLO" }, + { .name = "Amsterdam Airport Schiphol", .iataCode = "AMS" }, + { .name = "Arturo Merino Benitez International Airport", .iataCode = "SCL" }, + { .name = "Auckland International Airport", .iataCode = "AKL" }, + { .name = "Beijing Capital International Airport", .iataCode = "PEK" }, + { .name = "Belem Val de Cans International Airport", .iataCode = "BEL" }, + { + .name = "Belo Horizonte Tancredo Neves International Airport", + .iataCode = "CNF", + }, + { .name = "Berlin-Tegel Airport", .iataCode = "TXL" }, + { .name = "Bole International Airport", .iataCode = "ADD" }, + { + .name = "Brasilia-Presidente Juscelino Kubitschek International Airport", + .iataCode = "BSB", + }, + { .name = "Brisbane International Airport", .iataCode = "BNE" }, + { .name = "Brussels Airport", .iataCode = "BRU" }, + { .name = "Cairns Airport", .iataCode = "CNS" }, + { .name = "Cairo International Airport", .iataCode = "CAI" }, + { .name = "Canberra Airport", .iataCode = "CBR" }, + { .name = "Capetown International Airport", .iataCode = "CPT" }, + { .name = "Charles de Gaulle International Airport", .iataCode = "CDG" }, + { .name = "Charlotte Douglas International Airport", .iataCode = "CLT" }, + { .name = "Chengdu Shuangliu International Airport", .iataCode = "CTU" }, + { .name = "Chhatrapati Shivaji International Airport", .iataCode = "BOM" }, + { .name = "Chicago O'Hare International Airport", .iataCode = "ORD" }, + { .name = "Chongqing Jiangbei International Airport", .iataCode = "CKG" }, + { .name = "Christchurch International Airport", .iataCode = "CHC" }, + { .name = "Copenhagen Kastrup Airport", .iataCode = "CPH" }, + { .name = "Dallas Fort Worth International Airport", .iataCode = "DFW" }, + { .name = "Daniel K. Inouye International Airport", .iataCode = "HNL" }, + { .name = "Denver International Airport", .iataCode = "DEN" }, + { .name = "Don Mueang International Airport", .iataCode = "DMK" }, + { .name = "Dubai International Airport", .iataCode = "DXB" }, + { .name = "Dublin Airport", .iataCode = "DUB" }, + { .name = "Dusseldorf Airport", .iataCode = "DUS" }, + { .name = "El Dorado International Airport", .iataCode = "BOG" }, + { .name = "Eleftherios Venizelos International Airport", .iataCode = "ATH" }, + { .name = "Faa'a International Airport", .iataCode = "PPT" }, + { .name = "Fort Lauderdale Hollywood International Airport", .iataCode = "FLL" }, + { .name = "Fortaleza Pinto Martins International Airport", .iataCode = "FOR" }, + { .name = "Frankfurt am Main Airport", .iataCode = "FRA" }, + { .name = "George Bush Intercontinental Houston Airport", .iataCode = "IAH" }, + { .name = "Gold Coast Airport", .iataCode = "OOL" }, + { + .name = "Guarulhos - Governador Andre Franco Montoro International Airport", + .iataCode = "GRU", + }, + { .name = "Hartsfield-Jackson Atlanta International Airport", .iataCode = "ATL" }, + { .name = "Helsinki Vantaa Airport", .iataCode = "HEL" }, + { .name = "Hobart International Airport", .iataCode = "HBA" }, + { .name = "Hong Kong International Airport", .iataCode = "HKG" }, + { .name = "Houari Boumediene Airport", .iataCode = "ALG" }, + { .name = "Hurgada International Airport", .iataCode = "HRG" }, + { .name = "Incheon International Airport", .iataCode = "ICN" }, + { .name = "Indira Gandhi International Airport", .iataCode = "DEL" }, + { .name = "Istanbul Airport", .iataCode = "IST" }, + { .name = "Jacksons International Airport", .iataCode = "POM" }, + { .name = "Jeju International Airport", .iataCode = "CJU" }, + { .name = "John F Kennedy International Airport", .iataCode = "JFK" }, + { .name = "Jorge Chavez International Airport", .iataCode = "LIM" }, + { .name = "Jose Maria Cordova International Airport", .iataCode = "MDE" }, + { .name = "Josep Tarradellas Barcelona-El Prat Airport", .iataCode = "BCN" }, + { .name = "Kahului Airport", .iataCode = "OGG" }, + { .name = "King Abdulaziz International Airport", .iataCode = "JED" }, + { .name = "Kuala Lumpur International Airport", .iataCode = "KUL" }, + { .name = "Kunming Changshui International Airport", .iataCode = "KMG" }, + { .name = "La Tontouta International Airport", .iataCode = "NOU" }, + { .name = "Leonardo da Vinci-Fiumicino Airport", .iataCode = "FCO" }, + { .name = "London Heathrow Airport", .iataCode = "LHR" }, + { .name = "Los Angeles International Airport", .iataCode = "LAX" }, + { .name = "McCarran International Airport", .iataCode = "LAS" }, + { .name = "Melbourne International Airport", .iataCode = "MEL" }, + { .name = "Mexico City International Airport", .iataCode = "MEX" }, + { .name = "Miami International Airport", .iataCode = "MIA" }, + { .name = "Ministro Pistarini International Airport", .iataCode = "EZE" }, + { + .name = "Minneapolis-St Paul International/Wold-Chamberlain Airport", + .iataCode = "MSP", + }, + { .name = "Mohammed V International Airport", .iataCode = "CMN" }, + { .name = "Moscow Domodedovo Airport", .iataCode = "DME" }, + { .name = "Munich Airport", .iataCode = "MUC" }, + { .name = "Murtala Muhammed International Airport", .iataCode = "LOS" }, + { .name = "Nadi International Airport", .iataCode = "NAN" }, + { .name = "Nairobi Jomo Kenyatta International Airport", .iataCode = "NBO" }, + { .name = "Narita International Airport", .iataCode = "NRT" }, + { .name = "Newark Liberty International Airport", .iataCode = "EWR" }, + { .name = "Ninoy Aquino International Airport", .iataCode = "MNL" }, + { .name = "Noumea Magenta Airport", .iataCode = "GEA" }, + { .name = "O. R. Tambo International Airport", .iataCode = "JNB" }, + { .name = "Orlando International Airport", .iataCode = "MCO" }, + { .name = "Oslo Lufthavn", .iataCode = "OSL" }, + { .name = "Perth Airport", .iataCode = "PER" }, + { .name = "Phoenix Sky Harbor International Airport", .iataCode = "PHX" }, + { + .name = "Recife Guararapes-Gilberto Freyre International Airport", + .iataCode = "REC", + }, + { .name = "Rio de Janeiro Galeao International Airport", .iataCode = "GIG" }, + { .name = "Salgado Filho International Airport", .iataCode = "POA" }, + { + .name = "Salvador Deputado Luis Eduardo Magalhaes International Airport", + .iataCode = "SSA", + }, + { .name = "San Francisco International Airport", .iataCode = "SFO" }, + { .name = "Santos Dumont Airport", .iataCode = "SDU" }, + { .name = "Sao Paulo-Congonhas Airport", .iataCode = "CGH" }, + { .name = "Seattle Tacoma International Airport", .iataCode = "SEA" }, + { .name = "Shanghai Hongqiao International Airport", .iataCode = "SHA" }, + { .name = "Shanghai Pudong International Airport", .iataCode = "PVG" }, + { .name = "Shenzhen Bao'an International Airport", .iataCode = "SZX" }, + { .name = "Sheremetyevo International Airport", .iataCode = "SVO" }, + { .name = "Singapore Changi Airport", .iataCode = "SIN" }, + { .name = "Soekarno-Hatta International Airport", .iataCode = "CGK" }, + { .name = "Stockholm-Arlanda Airport", .iataCode = "ARN" }, + { .name = "Suvarnabhumi Airport", .iataCode = "BKK" }, + { .name = "Sydney Kingsford Smith International Airport", .iataCode = "SYD" }, + { .name = "Taiwan Taoyuan International Airport", .iataCode = "TPE" }, + { .name = "Tan Son Nhat International Airport", .iataCode = "SGN" }, + { .name = "Tokyo Haneda International Airport", .iataCode = "HND" }, + { .name = "Toronto Pearson International Airport", .iataCode = "YYZ" }, + { .name = "Tunis Carthage International Airport", .iataCode = "TUN" }, + { .name = "Vancouver International Airport", .iataCode = "YVR" }, + { .name = "Vienna International Airport", .iataCode = "VIE" }, + { .name = "Viracopos International Airport", .iataCode = "VCP" }, + { .name = "Vnukovo International Airport", .iataCode = "VKO" }, + { .name = "Wellington International Airport", .iataCode = "WLG" }, + { .name = "Xi'an Xianyang International Airport", .iataCode = "XIY" }, + { .name = "Zhukovsky International Airport", .iataCode = "ZIA" }, + { .name = "Zurich Airport", .iataCode = "ZRH" }, +}; +} \ No newline at end of file diff --git a/src/modules/airline/data/Seat.h b/src/modules/airline/data/Seat.h new file mode 100644 index 00000000..9f2824a5 --- /dev/null +++ b/src/modules/airline/data/Seat.h @@ -0,0 +1,26 @@ +#pragma once + +#include "faker-cxx/Airline.h" + +#include +#include +#include + +namespace faker +{ + +const std::unordered_map aircraftTypeMaxRows = + { + {Airline::AircraftType::Regional, 20}, + {Airline::AircraftType::Narrowbody, 40}, + {Airline::AircraftType::Widebody, 60}, +}; + +const std::unordered_map> aircraftTypeSeatLetters = { + {Airline::AircraftType::Regional, {'A', 'B', 'C', 'D'}}, + {Airline::AircraftType::Narrowbody, {'A', 'B', 'C', 'D', 'E', 'F'}}, + {Airline::AircraftType::Widebody, {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K'}}, +}; +} + +// upon picking an aircraft type we can just generate one randomly by aircraft type, vector[aircraft_type] \ No newline at end of file