Skip to content

Commit

Permalink
feat: Added Portugal location data (#968)
Browse files Browse the repository at this point in the history
* Update location.cpp

* Update location_data.h

* Update location_test.cpp

* Run format_code script

* Update location_data.h

fix: misstype

* Update location_test.cpp

add portugal data to switch case

* fix: location_test.cpp

* fix: location_test.cpp
  • Loading branch information
tskxz authored Oct 24, 2024
1 parent a5ae9fa commit e730d22
Show file tree
Hide file tree
Showing 9 changed files with 667 additions and 165 deletions.
30 changes: 15 additions & 15 deletions include/faker-cxx/animal.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace faker::animal
* @brief Returns a random species of bear.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of bear.
*
* @code
Expand All @@ -24,7 +24,7 @@ FAKER_CXX_EXPORT std::string_view bear(Locale locale = Locale::en_US);
* @brief Returns a random species of bird.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of bird.
*
* @code
Expand All @@ -37,7 +37,7 @@ FAKER_CXX_EXPORT std::string_view bird(Locale locale = Locale::en_US);
* @brief Returns a random species of cat.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of cat.
*
* @code
Expand All @@ -50,7 +50,7 @@ FAKER_CXX_EXPORT std::string_view cat(Locale locale = Locale::en_US);
* @brief Returns a random species of cetacean.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of cetacean.
*
* @code
Expand All @@ -63,7 +63,7 @@ FAKER_CXX_EXPORT std::string_view cetacean(Locale locale = Locale::en_US);
* @brief Returns a random species of cow.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of cow.
*
* @code
Expand All @@ -76,7 +76,7 @@ FAKER_CXX_EXPORT std::string_view cow(Locale locale = Locale::en_US);
* @brief Returns a random species of crocodilia.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of crocodilia.
*
* @code
Expand All @@ -89,7 +89,7 @@ FAKER_CXX_EXPORT std::string_view crocodile(Locale locale = Locale::en_US);
* @brief Returns a random species of dog.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of dog.
*
* @code
Expand All @@ -102,7 +102,7 @@ FAKER_CXX_EXPORT std::string_view dog(Locale locale = Locale::en_US);
* @brief Returns a random species of fish.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of fish.
*
* @code
Expand All @@ -115,7 +115,7 @@ FAKER_CXX_EXPORT std::string_view fish(Locale locale = Locale::en_US);
* @brief Returns a random species of horse.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of horse.
*
* @code
Expand All @@ -128,7 +128,7 @@ FAKER_CXX_EXPORT std::string_view horse(Locale locale = Locale::en_US);
* @brief Returns a random species of insect.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of insect.
*
* @code
Expand All @@ -141,7 +141,7 @@ FAKER_CXX_EXPORT std::string_view insect(Locale locale = Locale::en_US);
* @brief Returns a random species of lion.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of lion.
*
* @code
Expand All @@ -154,7 +154,7 @@ FAKER_CXX_EXPORT std::string_view lion(Locale locale = Locale::en_US);
* @brief Returns a random species of rabbit.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of rabbit.
*
* @code
Expand All @@ -167,7 +167,7 @@ FAKER_CXX_EXPORT std::string_view rabbit(Locale locale = Locale::en_US);
* @brief Returns a random species of rodent.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of rodent.
*
* @code
Expand All @@ -180,7 +180,7 @@ FAKER_CXX_EXPORT std::string_view rodent(Locale locale = Locale::en_US);
* @brief Returns a random species of snake.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Species of snake.
*
* @code
Expand All @@ -193,7 +193,7 @@ FAKER_CXX_EXPORT std::string_view snake(Locale locale = Locale::en_US);
* @brief Returns a random type of animal.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Type of animal.
*
* @code
Expand Down
4 changes: 2 additions & 2 deletions include/faker-cxx/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace faker::helper
{

template <typename T>
concept input_range_with_faster_size_compute_than_linear_rng =
std::ranges::input_range<T> && (std::ranges::sized_range<T> || std::ranges::forward_range<T>);
concept input_range_with_faster_size_compute_than_linear_rng = std::ranges::input_range<T> &&
(std::ranges::sized_range<T> || std::ranges::forward_range<T>);

template <input_range_with_faster_size_compute_than_linear_rng Range>
decltype(auto) randomElement(Range&& range)
Expand Down
6 changes: 4 additions & 2 deletions include/faker-cxx/random_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
namespace faker
{
template <typename T>
requires std::uniform_random_bit_generator<T>
requires std::uniform_random_bit_generator<T>

class RandomGenerator
{
public:
Expand All @@ -20,7 +21,8 @@ class RandomGenerator
RandomGenerator& operator=(RandomGenerator&&) = default;

template <typename Dist>
requires std::is_invocable_r_v<int, Dist&, T&>
requires std::is_invocable_r_v<int, Dist&, T&>

int operator()(Dist&& dist)
{
return std::forward<Dist>(dist)(generator_);
Expand Down
1 change: 1 addition & 0 deletions src/modules/animal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const struct AnimalDefinition& getAnimalDefinition(Locale locale)
}
}
}

std::string_view bear(Locale locale)
{
const auto& animalDefinition = getAnimalDefinition(locale);
Expand Down
15 changes: 5 additions & 10 deletions src/modules/esport_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,11 @@ const auto enUSEvents =
"IEM"});

const auto enUSGames = std::to_array<std::string_view>({"Valorant", "League Of Legend", "Rocket League", "Fifa",
"Overwatch", "CSGO", "Fortnite", "Dota 2",
"Street Fighter,"
"Apex Legends",
"TFT", "PUBG", "Call of Duty"});
"Overwatch", "CSGO", "Fortnite", "Dota 2",
"Street Fighter,"
"Apex Legends",
"TFT", "PUBG", "Call of Duty"});

const EsportDefinition enUSEsportDefinition = {
.players = enUSPlayers,
.teams = enUSTeams,
.leagues = enUSLeagues,
.events = enUSEvents,
.games = enUSGames
};
.players = enUSPlayers, .teams = enUSTeams, .leagues = enUSLeagues, .events = enUSEvents, .games = enUSGames};
}
Loading

0 comments on commit e730d22

Please sign in to comment.