diff --git a/.gitignore b/.gitignore index ac2c42e8..e9178dad 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,5 @@ CMakeSettings.json out/ build-linux-gxx build-linux-clang +#clangd index files +.cache/ diff --git a/include/faker-cxx/types/Country.h b/include/faker-cxx/types/Country.h index 0d69dd8d..b01337de 100644 --- a/include/faker-cxx/types/Country.h +++ b/include/faker-cxx/types/Country.h @@ -27,14 +27,16 @@ enum class Country Denmark, Sweden, Brazil, - Norway + Norway, + Japan, }; -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}; +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, +}; inline std::string toString(Country country) { @@ -45,7 +47,8 @@ inline std::string toString(Country country) {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::Brazil, "Brazil"}, {Country::Norway, "Norway"}, {Country::Japan, "Japan"}, + }; return countryToStringMapping.at(country); } diff --git a/src/modules/person/Person.cpp b/src/modules/person/Person.cpp index 5a1778a3..f5b6e937 100644 --- a/src/modules/person/Person.cpp +++ b/src/modules/person/Person.cpp @@ -16,6 +16,7 @@ #include "data/Hobbies.h" #include "data/india/IndianPeopleNames.h" #include "data/italy/ItalianPeopleNames.h" +#include "data/japan/JapanesePeopleNames.h" #include "data/JobTitles.h" #include "data/Languages.h" #include "data/Nationalities.h" @@ -50,7 +51,9 @@ const std::map countryToPeopleNamesMapping{ {Country::Czech, czechPeopleNames}, {Country::Slovakia, slovakPeopleNames}, {Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames}, {Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}, - {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}}; + {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}, + {Country::Japan, japanesePeopleNames}, +}; std::string middleNameForCountry(Country country, std::optional sex); std::string prefixForCountry(Country country, std::optional sex); diff --git a/src/modules/person/PersonTest.cpp b/src/modules/person/PersonTest.cpp index 5f317217..dcf95657 100644 --- a/src/modules/person/PersonTest.cpp +++ b/src/modules/person/PersonTest.cpp @@ -15,6 +15,7 @@ #include "data/Hobbies.h" #include "data/india/IndianPeopleNames.h" #include "data/italy/ItalianPeopleNames.h" +#include "data/japan/JapanesePeopleNames.h" #include "data/JobTitles.h" #include "data/Languages.h" #include "data/Nationalities.h" @@ -50,7 +51,9 @@ const std::map countryToPeopleNamesMapping{ {Country::Czech, czechPeopleNames}, {Country::Slovakia, slovakPeopleNames}, {Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames}, {Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}, - {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}}; + {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}, + {Country::Japan, japanesePeopleNames}, +}; const std::map generatedTestName{ {Country::England, "shouldGenerateEnglishName"}, {Country::France, "shouldGenerateFrenchName"}, @@ -62,7 +65,9 @@ const std::map generatedTestName{ {Country::Czech, "shouldGenerateCzechName"}, {Country::Slovakia, "shouldGenerateSlovakName"}, {Country::Ukraine, "shouldGenerateUkrainianName"}, {Country::Denmark, "shouldGenerateDanishName"}, {Country::Sweden, "shouldGenerateSwedishName"}, {Country::Usa, "shouldGenerateAmericanName"}, - {Country::Brazil, "shouldGenerateBrazilianName"}, {Country::Norway, "shouldGenerateNorwegianName"}}; + {Country::Brazil, "shouldGenerateBrazilianName"}, {Country::Norway, "shouldGenerateNorwegianName"}, + {Country::Japan, "shouldGenerateJapaneseName"}, +}; } class PersonTest : public TestWithParam diff --git a/src/modules/person/data/japan/JapaneseFirstNames.h b/src/modules/person/data/japan/JapaneseFirstNames.h new file mode 100644 index 00000000..d1855d15 --- /dev/null +++ b/src/modules/person/data/japan/JapaneseFirstNames.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector japaneseMaleFirstNames{ + "正一", "正二", "正三", "清", "辰雄", "三郎", "昭二", "昭三", "茂", "勇", "明", "弘", "勝", "稔", + "博", "隆", "誠", "浩", "健一", "大輔", "達也", "翔太", "拓也", "健太", "大輝", "翔", "駿", "蓮", + "大翔", "陸", "悠真", "蒼", "昭", "実", "進", "和夫", "修", "浩一", "哲也", "剛", "大介", "海斗", + "拓海", "颯太", "悠斗", "陽翔", "湊", "新", "樹", "正雄", "勝利", "豊", "和彦", "学", "直樹", "健太郎", + "大和", "陽向", "瑛太", "陽太", "正", "一郎", "勲", "徹", "浩二", "亮", "大樹", "翼", "義雄", "昭一", + "功", "武", "淳", "和也", "大地", "匠", "悠人", "朝陽", "律", "武雄", "英樹", "秀樹", "祐介", "雄太", + "翔平", "大貴", "太陽", "颯", "陽斗", "颯真", "蒼空", "優斗", "正治", "昇", "竜也", "聡", "貴大", "直人", + "輝", "優太", "悠太", "陸斗", "太一", "悠", "浩之", "健", "博之", "亮太", "一輝", "空", "陽大", "正夫", + "秀雄", "幸雄", "勉", "崇", "洋平", "拓哉", "涼太", "大雅", "海翔", "龍生", "結翔", "悠翔", "葵", "正男", + "辰男", "一男", "優", "雄大", "康平", "智也", "竜", "悠希", "歩夢", +}; +const std::vector japaneseFemaleFirstNames{ + "千代子", "静子", "文子", "キヨ", "千代", "ハル", "キミ", "久子", "ヨシ", "清子", "正子", "貞子", + "八重子", "きよ", "フミ", "ハナ", "和子", "愛子", "きみ", "トミ", "はる", "マサ", "美代子", "光子", + "幸子", "照子", "芳子", "節子", "昭子", "信子", "敏子", "典子", "君子", "弘子", "洋子", "美智子", + "京子", "悦子", "栄子", "孝子", "良子", "恵子", "勝子", "紀子", "恵美子", "啓子", "久美子", "由美子", + "裕子", "順子", "智子", "明美", "愛", "恵", "麻衣", "麻美", "香織", "美穂", "彩", "沙織", + "愛美", "絵美", "舞", "恵美", "陽子", "成美", "あゆみ", "美香", "理恵", "友美", "智美", "明日香", + "由佳", "瞳", "麻衣子", "彩香", "真由美", "純子", "直美", "優子", "裕美", "由美", "直子", "めぐみ", + "美紀", "浩子", "ゆかり", "さくら", "美咲", "陽菜", "葵", "七海", "美羽", "結衣", "美月", "凛", + "美優", "未来", "優奈", "萌", "優花", "美桜", "莉子", "菜月", "結愛", "結菜", "花音", "心優", + "真央", "玲奈", "ひなた", "彩乃", "彩花", "優衣", "琴音", "百花", "遥", "里奈", "茜", "千尋", + "楓", "亜美", "佳奈", "真由", "桃子", "菜々子", "千夏", "菜摘", "奈々", "早紀", "杏", "陽葵", + "芽依", "結月", "咲良", "凜", "紬", "心愛", "花", "心春", "愛莉", "愛菜", "桜", "心結", + "美結", +}; +} diff --git a/src/modules/person/data/japan/JapaneseLastNames.h b/src/modules/person/data/japan/JapaneseLastNames.h new file mode 100644 index 00000000..adb62595 --- /dev/null +++ b/src/modules/person/data/japan/JapaneseLastNames.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector japaneseLastNames{ + "佐藤", "鈴木", "高橋", "田中", "渡辺", "伊藤", "山本", "中村", "小林", "加藤", + "吉田", "山田", "佐々木", "山口", "斎藤", "松本", "井上", "木村", "林", "清水", +}; +} diff --git a/src/modules/person/data/japan/JapanesePeopleNames.h b/src/modules/person/data/japan/JapanesePeopleNames.h new file mode 100644 index 00000000..c58eaf26 --- /dev/null +++ b/src/modules/person/data/japan/JapanesePeopleNames.h @@ -0,0 +1,14 @@ +#pragma once + +#include "../NameFormats.h" +#include "../PeopleNames.h" +#include "JapaneseFirstNames.h" +#include "JapaneseLastNames.h" + +namespace faker +{ +const NameFormats japanesePeopleNameFormats{{"{lastName} {firstName}", 1}}; +const PeopleNames japanesePeopleNames{{japaneseMaleFirstNames, {}, japaneseLastNames, {}, {}}, + {japaneseFemaleFirstNames, {}, japaneseLastNames, {}, {}}, + japanesePeopleNameFormats}; +}