Skip to content

Commit

Permalink
move types to module files (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal authored Apr 5, 2024
1 parent 8d37101 commit 8aefdab
Show file tree
Hide file tree
Showing 64 changed files with 774 additions and 1,123 deletions.
35 changes: 32 additions & 3 deletions include/faker-cxx/Airline.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <string>

#include "./types/AirlineTypes.h"

namespace faker
{
class Airline
Expand All @@ -20,6 +18,12 @@ class Airline
*/
static std::string aircraftType();

struct Airplane
{
std::string name;
std::string iataTypeCode;
};

/**
* @brief Get a random airplane
*
Expand All @@ -31,6 +35,12 @@ class Airline
*/
static Airplane airplane();

struct AirlineInfo
{
std::string name;
std::string iataCode;
};

/**
* @brief Get a random airline
*
Expand All @@ -40,7 +50,13 @@ class Airline
* Airline::airline() // {"Air Canada", "AC"}
* @endcode
*/
static AirlineStruct airline();
static AirlineInfo airline();

struct Airport
{
std::string name;
std::string iataCode;
};

/**
* @brief Get a random airport
Expand All @@ -53,6 +69,13 @@ class Airline
*/
static Airport airport();

enum class AircraftType
{
Regional,
Narrowbody,
Widebody,
};

/**
* @brief Get a random seat by aircraft type
*
Expand Down Expand Up @@ -95,6 +118,12 @@ class Airline
*/
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
*
Expand Down
63 changes: 53 additions & 10 deletions include/faker-cxx/Finance.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
#include <optional>
#include <string>

#include "types/BicCountry.h"
#include "types/Country.h"
#include "types/Currency.h"
#include "types/IbanCountry.h"
#include "types/Precision.h"

namespace faker
{
enum class CreditCardType
{
AmericanExpress,
Discover,
MasterCard,
Visa
};

class Finance
{
public:
Expand Down Expand Up @@ -97,6 +87,37 @@ class Finance
static std::string amount(double min = 0, double max = 1000, Precision precision = Precision::TwoDp,
const std::string& symbol = "");

enum class IbanCountry
{
Austria,
Belgium,
Bulgaria,
Croatia,
Cyprus,
Czechia,
Denmark,
Estonia,
Finland,
France,
Germany,
Greece,
Hungary,
Ireland,
Italy,
Latvia,
Lithuania,
Luxembourg,
Malta,
Netherlands,
Poland,
Portugal,
Romania,
Slovakia,
Slovenia,
Spain,
Sweden
};

/**
* Generates a random iban.
*
Expand All @@ -111,6 +132,20 @@ class Finance
*/
static std::string iban(std::optional<IbanCountry> country = std::nullopt);

enum class BicCountry
{
Poland,
UnitedStates,
UnitedKingdom,
Germany,
Romania,
France,
Italy,
Spain,
Netherlands,
India,
};

/**
* Generates a random bic.
*
Expand Down Expand Up @@ -164,6 +199,14 @@ class Finance
*/
static std::string routingNumber();

enum class CreditCardType
{
AmericanExpress,
Discover,
MasterCard,
Visa
};

/**
* Generates a random credit card number.
*
Expand Down
18 changes: 16 additions & 2 deletions include/faker-cxx/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
#include <optional>
#include <string>

#include "types/ImageCategory.h"

namespace faker
{
class Image
{
public:
enum class ImageCategory
{
Animals,
Business,
Cats,
City,
Food,
Nightlife,
Fashion,
People,
Nature,
Sports,
Technics,
Transport
};

/**
* @brief Generates a real image url with `https://loremflickr.com/`.
*
Expand Down
15 changes: 14 additions & 1 deletion include/faker-cxx/Internet.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <string>

#include "types/Country.h"
#include "types/EmojiType.h"

namespace faker
{
Expand Down Expand Up @@ -111,6 +110,20 @@ class Internet
*/
static std::string password(int length = 15, PasswordOptions options = {});

enum class EmojiType
{
Smiley,
Body,
Person,
Nature,
Food,
Travel,
Activity,
Object,
Symbol,
Flag
};

/**
* @brief Returns a random emoji.
*
Expand Down
22 changes: 21 additions & 1 deletion include/faker-cxx/Location.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,31 @@

#include <string>

#include "faker-cxx/types/AddressCountry.h"
#include "types/Precision.h"

namespace faker
{
enum class AddressCountry
{
Usa,
Poland,
France,
Russia,
Ukraine,
Italy,
Germany,
Czech,
Australia,
India,
Denmark,
Spain,
Brazil,
Finland,
Estonia,
Romania,
Latvia
};

class Location
{
public:
Expand Down
17 changes: 15 additions & 2 deletions include/faker-cxx/Science.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#pragma once

#include "types/ChemicalElement.h"
#include "types/Unit.h"
#include <string>

namespace faker
{
class Science
{
public:
struct ChemicalElement
{
std::string name;
std::string symbol;
int atomicNumber;
};

/**
* @brief Returns a random chemical element from the periodic table.
*
Expand All @@ -20,6 +26,13 @@ class Science
*/
static ChemicalElement chemicalElement();

struct Unit
{
std::string name;
std::string symbol;
std::string usedToMeasure;
};

/**
* @brief Returns a unit of measurement for either distance, mass, time, temp, current.
*
Expand Down
67 changes: 0 additions & 67 deletions include/faker-cxx/types/AddressCountry.h

This file was deleted.

Loading

0 comments on commit 8aefdab

Please sign in to comment.