From ceb377159454a3486081e6f52ed0dd245a6b8f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blar?= Date: Fri, 17 Nov 2023 11:58:21 +0100 Subject: [PATCH] add portuguese names (#270) --- include/faker-cxx/types/Country.h | 19 ++++++----- src/modules/person/Person.cpp | 3 +- src/modules/person/PersonTest.cpp | 5 +-- .../data/portugal/PortugueseFirstNames.h | 33 +++++++++++++++++++ .../data/portugal/PortugueseLastNames.h | 21 ++++++++++++ .../data/portugal/PortuguesePeopleNames.h | 18 ++++++++++ .../person/data/portugal/PortuguesePrefixes.h | 11 +++++++ 7 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 src/modules/person/data/portugal/PortugueseFirstNames.h create mode 100644 src/modules/person/data/portugal/PortugueseLastNames.h create mode 100644 src/modules/person/data/portugal/PortuguesePeopleNames.h create mode 100644 src/modules/person/data/portugal/PortuguesePrefixes.h diff --git a/include/faker-cxx/types/Country.h b/include/faker-cxx/types/Country.h index b01337ded..3c3ffbffd 100644 --- a/include/faker-cxx/types/Country.h +++ b/include/faker-cxx/types/Country.h @@ -29,25 +29,26 @@ enum class Country Brazil, Norway, Japan, + Portugal, }; const std::vector countries{ Country::Usa, Country::England, Country::Poland, Country::Italy, Country::France, Country::Germany, Country::Russia, Country::Romania, Country::India, Country::Finland, Country::Nepal, Country::Spain, Country::Turkey, Country::Czech, Country::Slovakia, Country::Ukraine, Country::Denmark, Country::Sweden, - Country::Brazil, Country::Norway, Country::Japan, -}; + Country::Brazil, Country::Norway, Country::Japan, Country::Portugal}; inline std::string toString(Country country) { std::map countryToStringMapping{ - {Country::Usa, "Usa"}, {Country::England, "England"}, {Country::Poland, "Poland"}, - {Country::Italy, "Italy"}, {Country::France, "France"}, {Country::Germany, "Germany"}, - {Country::Russia, "Russia"}, {Country::Romania, "Romania"}, {Country::India, "India"}, - {Country::Finland, "Finland"}, {Country::Nepal, "Nepal"}, {Country::Spain, "Spain"}, - {Country::Turkey, "Turkey"}, {Country::Czech, "Czech"}, {Country::Slovakia, "Slovakia"}, - {Country::Ukraine, "Ukraine"}, {Country::Denmark, "Denmark"}, {Country::Sweden, "Sweden"}, - {Country::Brazil, "Brazil"}, {Country::Norway, "Norway"}, {Country::Japan, "Japan"}, + {Country::Usa, "Usa"}, {Country::England, "England"}, {Country::Poland, "Poland"}, + {Country::Italy, "Italy"}, {Country::France, "France"}, {Country::Germany, "Germany"}, + {Country::Russia, "Russia"}, {Country::Romania, "Romania"}, {Country::India, "India"}, + {Country::Finland, "Finland"}, {Country::Nepal, "Nepal"}, {Country::Spain, "Spain"}, + {Country::Turkey, "Turkey"}, {Country::Czech, "Czech"}, {Country::Slovakia, "Slovakia"}, + {Country::Ukraine, "Ukraine"}, {Country::Denmark, "Denmark"}, {Country::Sweden, "Sweden"}, + {Country::Brazil, "Brazil"}, {Country::Norway, "Norway"}, {Country::Japan, "Japan"}, + {Country::Portugal, "Portugal"}, }; return countryToStringMapping.at(country); diff --git a/src/modules/person/Person.cpp b/src/modules/person/Person.cpp index f5b6e937a..927435279 100644 --- a/src/modules/person/Person.cpp +++ b/src/modules/person/Person.cpp @@ -23,6 +23,7 @@ #include "data/nepal/NepalesePeopleNames.h" #include "data/norway/NorwegianPeopleNames.h" #include "data/poland/PolishPeopleNames.h" +#include "data/portugal/PortuguesePeopleNames.h" #include "data/romania/RomanianPeopleNames.h" #include "data/russia/RussianPeopleNames.h" #include "data/slovakia/SlovakPeopleNames.h" @@ -52,7 +53,7 @@ const std::map countryToPeopleNamesMapping{ {Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames}, {Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}, {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}, - {Country::Japan, japanesePeopleNames}, + {Country::Japan, japanesePeopleNames}, {Country::Portugal, portuguesePeopleNames}, }; std::string middleNameForCountry(Country country, std::optional sex); diff --git a/src/modules/person/PersonTest.cpp b/src/modules/person/PersonTest.cpp index dcf95657f..e7846eb1a 100644 --- a/src/modules/person/PersonTest.cpp +++ b/src/modules/person/PersonTest.cpp @@ -22,6 +22,7 @@ #include "data/nepal/NepalesePeopleNames.h" #include "data/norway/NorwegianPeopleNames.h" #include "data/poland/PolishPeopleNames.h" +#include "data/portugal/PortuguesePeopleNames.h" #include "data/romania/RomanianPeopleNames.h" #include "data/russia/RussianPeopleNames.h" #include "data/slovakia/SlovakPeopleNames.h" @@ -52,7 +53,7 @@ const std::map countryToPeopleNamesMapping{ {Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames}, {Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}, {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}, - {Country::Japan, japanesePeopleNames}, + {Country::Japan, japanesePeopleNames}, {Country::Portugal, portuguesePeopleNames}, }; const std::map generatedTestName{ @@ -66,7 +67,7 @@ const std::map generatedTestName{ {Country::Ukraine, "shouldGenerateUkrainianName"}, {Country::Denmark, "shouldGenerateDanishName"}, {Country::Sweden, "shouldGenerateSwedishName"}, {Country::Usa, "shouldGenerateAmericanName"}, {Country::Brazil, "shouldGenerateBrazilianName"}, {Country::Norway, "shouldGenerateNorwegianName"}, - {Country::Japan, "shouldGenerateJapaneseName"}, + {Country::Japan, "shouldGenerateJapaneseName"}, {Country::Portugal, "shouldGeneratePortugueseName"}, }; } diff --git a/src/modules/person/data/portugal/PortugueseFirstNames.h b/src/modules/person/data/portugal/PortugueseFirstNames.h new file mode 100644 index 000000000..301c5df6b --- /dev/null +++ b/src/modules/person/data/portugal/PortugueseFirstNames.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector portugueseMalesFirstNames = { + "Afonso", "Alexandre", "André", "Ângelo", "António", "Artur", "Benjamim", "Bernardo", "Bruno", + "Carlos", "César", "Cristiano", "Daniel", "David", "Dinis", "Diogo", "Duarte", "Edgar", + "Eduardo", "Elias", "Emanuel", "Fábio", "Feliciano", "Fernando", "Filipe", "Francisco", "Frederico", + "Gabriel", "Gaspar", "Gil", "Gonçalo", "Guilherme", "Gustavo", "Hélio", "Henrique", "Hugo", + "Igor", "Ígor", "Isac", "Ivan", "Ivo", "Jaime", "João", "Joaquim", "Jorge", + "José", "Josué", "Júlio", "Leandro", "Leonardo", "Lourenço", "Lucas", "Luís", "Manel", + "Manuel", "Marcelo", "Marco", "Marcos", "Mário", "Martim", "Mateus", "Matias", "Mauro", + "Micael", "Miguel", "Moisés", "Norberto", "Nuno", "Paulo", "Pedro", "Rafael", "Raul", + "Renato", "Ricardo", "Roberto", "Rodrigo", "Romeu", "Rúben", "Rui", "Salvador", "Samuel", + "Sandro", "Santiago", "Sebastião", "Sérgio", "Simão", "Tiago", "Tomás", "Tomé", "Valentim", + "Valter", "Vasco", "Vicente", "Vítor", "Xavier"}; + +const std::vector portugueseFemalesFirstNames = { + "Adriana", "Alexandra", "Alice", "Amélia", "Ana", "Ariana", "Áurea", "Aurora", "Bárbara", + "Beatriz", "Benedita", "Bruna", "Caetana", "Camila", "Carla", "Carlota", "Carminho", "Carmo", + "Carolina", "Catarina", "Cecília", "Célia", "Clara", "Constança", "Daniela", "Débora", "Diana", + "Eduarda", "Elisa", "Ema", "Emília", "Érica", "Eva", "Fabiana", "Filipa", "Flor", + "Francisca", "Frederica", "Gabriela", "Helena", "Inês", "Irina", "Íris", "Isabel", "Jéssica", + "Joana", "Júlia", "Juliana", "Julieta", "Lara", "Laura", "Leonor", "Letícia", "Lia", + "Lorena", "Luana", "Luena", "Luísa", "Luna", "Madalena", "Mafalda", "Mara", "Márcia", + "Margarida", "Maria", "Mariana", "Marta", "Matilde", "Melissa", "Mia", "Miriam", "Natália", + "Nicole", "Núria", "Ofélia", "Olívia", "Paula", "Pilar", "Rafaela", "Raquel", "Rita", + "Rosa", "Safira", "Sara", "Sílvia", "Sofia", "Soraia", "Tatiana", "Teresa", "Valentina", + "Vânia", "Vera", "Vitória"}; +} diff --git a/src/modules/person/data/portugal/PortugueseLastNames.h b/src/modules/person/data/portugal/PortugueseLastNames.h new file mode 100644 index 000000000..6f6d9eb72 --- /dev/null +++ b/src/modules/person/data/portugal/PortugueseLastNames.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector portugueseLastNames = { + "Abreu", "Albuquerque", "Almeida", "Alves", "Amaral", "Amorim", "Andrade", "Anjos", "Antunes", + "Araújo", "Assunção", "Azevedo", "Baptista", "Barbosa", "Barros", "Batista", "Borges", "Braga", + "Branco", "Brito", "Campos", "Cardoso", "Carneiro", "Carvalho", "Castro", "Coelho", "Correia", + "Costa", "Cruz", "Cunha", "Domingues", "Esteves", "Faria", "Fernandes", "Ferreira", "Figueiredo", + "Fonseca", "Freitas", "Garcia", "Gaspar", "Gomes", "Gonçalves", "Guerreiro", "Henriques", "Jesus", + "Leal", "Leite", "Lima", "Lopes", "Loureiro", "Lourenço", "Macedo", "Machado", "Magalhães", + "Maia", "Marques", "Martins", "Matias", "Matos", "Melo", "Mendes", "Miranda", "Monteiro", + "Morais", "Moreira", "Mota", "Moura", "Nascimento", "Neto", "Neves", "Nobre", "Nogueira", + "Nunes", "Oliveira", "Pacheco", "Paiva", "Pereira", "Pinheiro", "Pinho", "Pinto", "Pires", + "Ramos", "Raposo", "Reis", "Ribeiro", "Rocha", "Rodrigues", "Santos", "Saraiva", "Silva", + "Simões", "Soares", "Sousa", "Sá", "Tavares", "Teixeira", "Torres", "Valente", "Vaz", + "Vicente", "Vieira"}; +} diff --git a/src/modules/person/data/portugal/PortuguesePeopleNames.h b/src/modules/person/data/portugal/PortuguesePeopleNames.h new file mode 100644 index 000000000..22ce97a2d --- /dev/null +++ b/src/modules/person/data/portugal/PortuguesePeopleNames.h @@ -0,0 +1,18 @@ +#pragma once + +#include "../NameFormats.h" +#include "../PeopleNames.h" +#include "PortugueseFirstNames.h" +#include "PortugueseLastNames.h" +#include "PortuguesePrefixes.h" + +namespace faker +{ +const NameFormats portuguesePersonNameFormats{{{"{prefix} {firstName} {lastName}", 1}, {"{firstName} {lastName}", 9}}}; + +const PeopleNames portuguesePeopleNames{ + {portugueseMalesFirstNames, {}, portugueseLastNames, portugueseMalesPrefixes, {}}, + {portugueseFemalesFirstNames, {}, portugueseLastNames, portugueseFemalesPrefixes, {}}, + portuguesePersonNameFormats}; + +} diff --git a/src/modules/person/data/portugal/PortuguesePrefixes.h b/src/modules/person/data/portugal/PortuguesePrefixes.h new file mode 100644 index 000000000..927c0c333 --- /dev/null +++ b/src/modules/person/data/portugal/PortuguesePrefixes.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector portugueseMalesPrefixes{"Sr.", "Dr.", "Prof.", "Eng."}; + +const std::vector portugueseFemalesPrefixes{"Sra.", "Dra.", "Prof.", "Eng."}; +}