Skip to content

Commit

Permalink
move types to modules (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal authored Apr 6, 2024
1 parent 8aefdab commit 42b0664
Show file tree
Hide file tree
Showing 27 changed files with 880 additions and 949 deletions.
8 changes: 7 additions & 1 deletion include/faker-cxx/Finance.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
#include <string>

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

namespace faker
{
struct Currency
{
std::string name;
std::string code;
std::string symbol;
};

class Finance
{
public:
Expand Down
86 changes: 76 additions & 10 deletions include/faker-cxx/Person.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
#include <optional>
#include <string>

#include "faker-cxx/types/Country.h"
#include "faker-cxx/types/PassportType.h"
#include "faker-cxx/types/Sex.h"
#include "faker-cxx/types/SsnCountry.h"
#include "types/Country.h"

namespace faker
{
enum class PassportCountry;
enum class Sex;
enum class SsnCountry;
enum class Language;

class Person
{
public:
Expand All @@ -27,7 +29,7 @@ class Person
* Person::firstName(Country::England, Sex::Male) // "Arthur"
* @endcode
*/
static std::string firstName(Country country = Country::England, std::optional<Sex> sex = std::nullopt);
static std::string firstName(std::optional<Country> country = std::nullopt, std::optional<Sex> sex = std::nullopt);

/**
* @brief Returns a random last name.
Expand All @@ -41,7 +43,7 @@ class Person
* Person::lastName() // "Peterson"
* @endcode
*/
static std::string lastName(Country country = Country::England, std::optional<Sex> sex = std::nullopt);
static std::string lastName(std::optional<Country> country = std::nullopt, std::optional<Sex> sex = std::nullopt);

/**
* @brief Returns a random middle name.
Expand Down Expand Up @@ -70,7 +72,7 @@ class Person
* Person::fullName(Country::England, Sex::Male) // "Samuel Walker"
* @endcode
*/
static std::string fullName(Country country = Country::England, std::optional<Sex> sex = std::nullopt);
static std::string fullName(std::optional<Country> country = std::nullopt, std::optional<Sex> sex = std::nullopt);

/**
* @brief Returns a random name prefix.
Expand Down Expand Up @@ -118,7 +120,7 @@ class Person
* Person::sex() // "Male"
* @endcode
*/
static std::string sex(Language language = Language::English);
static std::string sex(std::optional<Language> language = std::nullopt);

/**
* @brief Returns a random gender.
Expand Down Expand Up @@ -220,7 +222,7 @@ class Person
* Person::ssn(SsnCountry::Polish) // "95111901567"
* @endcode
*/
static std::string ssn(std::optional<SsnCountry> country);
static std::string ssn(std::optional<SsnCountry> country = std::nullopt);

/**
* @brief Returns a random Western Zodiac
Expand Down Expand Up @@ -253,6 +255,70 @@ class Person
* Person::passport(PassportCountry::Romania) // "12345678"
* @endcode
*/
static std::string passport(PassportCountry country = PassportCountry::Usa);
static std::string passport(std::optional<PassportCountry> country = std::nullopt);
};

enum class PassportCountry
{
Usa,
Poland,
France,
Romania,
};

enum class Sex
{
Male,
Female,
};

enum class SsnCountry
{
Poland,
UnitedStates,
UnitedKingdom,
Germany,
France,
Italy,
Spain,
India,
};

enum class Language
{
English,
Polish,
French,
German,
Italian,
Russian,
Romanian,
Hindi,
Finnish,
Nepali,
Spanish,
Turkish,
Czech,
Slovak,
Ukrainian,
Danish,
Swedish,
Portuguese,
Norwegian,
Japanese,
Hungarian,
Croatian,
Greek,
Slovene,
Dutch,
Mandarin,
Korean,
Serbian,
Macedonian,
Albanian,
Latvian,
Irish,
Belarusian,
Estonian
};
}
Loading

0 comments on commit 42b0664

Please sign in to comment.