-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1000bb
commit 18f450f
Showing
7 changed files
with
167 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
|
||
namespace faker | ||
{ | ||
enum class SsnCountry | ||
{ | ||
Poland, | ||
UnitedStates, | ||
UnitedKingdom, | ||
Germany, | ||
France, | ||
Italy, | ||
Spain, | ||
India, | ||
}; | ||
|
||
const std::vector<SsnCountry> supportedSsnCountries{ | ||
SsnCountry::Poland, SsnCountry::UnitedStates, SsnCountry::UnitedKingdom, SsnCountry::Germany, | ||
SsnCountry::France, SsnCountry::Italy, SsnCountry::Spain, SsnCountry::India, | ||
}; | ||
|
||
inline std::string toString(SsnCountry country) | ||
{ | ||
std::map<SsnCountry, std::string> countryToStringMapping{ | ||
{SsnCountry::UnitedStates, "UnitedStates"}, | ||
{SsnCountry::UnitedKingdom, "UnitedKingdom"}, | ||
{SsnCountry::Poland, "Poland"}, | ||
{SsnCountry::Italy, "Italy"}, | ||
{SsnCountry::France, "France"}, | ||
{SsnCountry::Germany, "Germany"}, | ||
{SsnCountry::India, "India"}, | ||
{SsnCountry::Spain, "Spain"}, | ||
}; | ||
|
||
return countryToStringMapping.at(country); | ||
} | ||
|
||
inline std::ostream& operator<<(std::ostream& os, SsnCountry country) | ||
{ | ||
return os << toString(country); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "faker-cxx/types/SsnCountry.h" | ||
|
||
namespace faker | ||
{ | ||
const std::map<SsnCountry, std::string> ssnFormats{ | ||
{SsnCountry::Poland, "##[0-1][0-2][0-2]######"}, | ||
{SsnCountry::UnitedStates, "###-##-####"}, | ||
// TODO: handle letters | ||
{SsnCountry::UnitedKingdom, "LL ## ## ## L"}, | ||
// TODO: handle conditional values like if year starts with 2 then second number must be 0-3 | ||
{SsnCountry::Germany, "####[0-2]#[0-1][0-2][1-2][5-9]##"}, | ||
{SsnCountry::France, "## [0-1][0-2] [0-2]# ### ### ##"}, | ||
// TODO: add alfa-numeric support | ||
{SsnCountry::Italy, "FFFF FFFF FFFF FFFF"}, | ||
{SsnCountry::Spain, "X########L"}, | ||
{SsnCountry::India, "LLLLL####L"}, | ||
}; | ||
} |