From 9ffffaa13012079dcd70484d587a748a5050f975 Mon Sep 17 00:00:00 2001 From: Mayank Kumar <103447831+mayank-Pareek@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:57:48 -0500 Subject: [PATCH] Run clang format (#988) --- include/faker-cxx/helper.h | 4 +-- include/faker-cxx/location.h | 3 +- include/faker-cxx/random_generator.h | 4 +-- src/modules/location.cpp | 13 +++----- src/modules/location_data.h | 49 ++++++---------------------- src/modules/person.cpp | 5 ++- src/modules/string.cpp | 1 - 7 files changed, 22 insertions(+), 57 deletions(-) diff --git a/include/faker-cxx/helper.h b/include/faker-cxx/helper.h index f21f25517..cb780e7bc 100644 --- a/include/faker-cxx/helper.h +++ b/include/faker-cxx/helper.h @@ -10,8 +10,8 @@ namespace faker::helper { template -concept input_range_with_faster_size_compute_than_linear_rng = std::ranges::input_range && - (std::ranges::sized_range || std::ranges::forward_range); +concept input_range_with_faster_size_compute_than_linear_rng = + std::ranges::input_range && (std::ranges::sized_range || std::ranges::forward_range); template decltype(auto) randomElement(Range&& range) diff --git a/include/faker-cxx/location.h b/include/faker-cxx/location.h index 8d2f32189..218b0f576 100644 --- a/include/faker-cxx/location.h +++ b/include/faker-cxx/location.h @@ -31,12 +31,11 @@ FAKER_CXX_EXPORT std::string_view country(); * @code * faker::location::continent("Poland") // Europe * faker::location::continent() // Africa - * + * * @endcode */ FAKER_CXX_EXPORT std::string_view continent(std::string_view country = ""); - /** * @brief Returns a random country code. * diff --git a/include/faker-cxx/random_generator.h b/include/faker-cxx/random_generator.h index c5408b18f..71eb196cc 100644 --- a/include/faker-cxx/random_generator.h +++ b/include/faker-cxx/random_generator.h @@ -6,7 +6,7 @@ namespace faker { template -requires std::uniform_random_bit_generator + requires std::uniform_random_bit_generator class RandomGenerator { @@ -21,7 +21,7 @@ class RandomGenerator RandomGenerator& operator=(RandomGenerator&&) = default; template - requires std::is_invocable_r_v + requires std::is_invocable_r_v int operator()(Dist&& dist) { diff --git a/src/modules/location.cpp b/src/modules/location.cpp index ec442e845..d4b4eedf9 100644 --- a/src/modules/location.cpp +++ b/src/modules/location.cpp @@ -1,17 +1,17 @@ #include "faker-cxx/location.h" - +#include #include #include #include #include -#include -#include "faker-cxx/types/locale.h" + #include "common/algo_helper.h" #include "common/format_helper.h" #include "faker-cxx/helper.h" #include "faker-cxx/number.h" #include "faker-cxx/person.h" +#include "faker-cxx/types/locale.h" #include "faker-cxx/types/precision.h" #include "location_data.h" @@ -92,8 +92,8 @@ CountryAddressesInfo getAddresses(const Locale& locale) std::string_view continent(std::string_view country) { - static const std::vector continents = { - "Africa", "Antarctica", "Asia", "Europe", "North America", "Australia", "South America"}; + static const std::vector continents = {"Africa", "Antarctica", "Asia", "Europe", + "North America", "Australia", "South America"}; if (country.empty()) { @@ -109,9 +109,6 @@ std::string_view continent(std::string_view country) return "Unknown"; } - - - std::string_view country() { return helper::randomElement(allCountries); diff --git a/src/modules/location_data.h b/src/modules/location_data.h index 9e2621716..0fbcbb8c8 100644 --- a/src/modules/location_data.h +++ b/src/modules/location_data.h @@ -23,18 +23,11 @@ struct CountryAddressesInfo std::span states; }; -const auto allContinents = std::to_array({ - "Africa", - "Antarctica", - "Asia", - "Europe", - "North America", - "Australia", - "South America" -}); +const auto allContinents = std::to_array( + {"Africa", "Antarctica", "Asia", "Europe", "North America", "Australia", "South America"}); const std::unordered_map countryToContinent = { -{"Afghanistan", "Asia"}, + {"Afghanistan", "Asia"}, {"Aland Islands", "Europe"}, {"Albania", "Europe"}, {"Algeria", "Africa"}, @@ -211,7 +204,7 @@ const std::unordered_map countryToContinent {"Portugal", "Europe"}, {"Puerto Rico", "North America"}, {"Qatar", "Asia"}, - {"Republic of Korea", "Asia"}, + {"Republic of Korea", "Asia"}, {"Reunion", "Africa"}, {"Romania", "Europe"}, {"Russian Federation", "Europe/Asia"}, @@ -279,8 +272,7 @@ const std::unordered_map countryToContinent {"Western Sahara", "Africa"}, {"Yemen", "Asia"}, {"Zambia", "Africa"}, - {"Zimbabwe", "Africa"} -}; + {"Zimbabwe", "Africa"}}; const auto allCountries = std::to_array({ // clang-format off @@ -7659,41 +7651,20 @@ const auto israelStreetNames = std::to_array({ "תשבי", }); -const auto israelStreetPrefixes = std::to_array({ - "רחוב", - "שדרות", - "משעול", - "דרך", - "סמטת" -}); +const auto israelStreetPrefixes = std::to_array({"רחוב", "שדרות", "משעול", "דרך", "סמטת"}); const std::string_view israelZipCodeFormat{"#######"}; -const auto israelAddressFormats = - std::to_array({ +const auto israelAddressFormats = std::to_array({ "{street} {buildingNumber}", "{street} {buildingNumber} {secondaryAddress}", }); -const auto israelSecondaryAddressFormats = std::to_array({ - "דירה #", - "דירה ##", - "חדר ##", - "חדר #" -}); +const auto israelSecondaryAddressFormats = std::to_array({"דירה #", "דירה ##", "חדר ##", "חדר #"}); -const auto israelBuildingNumberFormats = std::to_array({ - "###", - "##", - "#", - "##ב", - "##א", - "#א", - "#ב" -}); +const auto israelBuildingNumberFormats = std::to_array({"###", "##", "#", "##ב", "##א", "#א", "#ב"}); -const auto israelStreetFormats = - std::to_array({ +const auto israelStreetFormats = std::to_array({ "{streetPrefix} {streetName}", }); diff --git a/src/modules/person.cpp b/src/modules/person.cpp index 07cc505b1..418b928c6 100644 --- a/src/modules/person.cpp +++ b/src/modules/person.cpp @@ -237,9 +237,8 @@ std::string fullName(Locale locale, std::optional sex) weightedElements.reserve(peopleNames.nameFormats.size()); std::transform(peopleNames.nameFormats.begin(), peopleNames.nameFormats.end(), std::back_inserter(weightedElements), - [](const NameFormat& nameFormat) { - return helper::WeightedElement{nameFormat.weight, nameFormat.format}; - }); + [](const NameFormat& nameFormat) + { return helper::WeightedElement{nameFormat.weight, nameFormat.format}; }); const auto nameFormat = static_cast(helper::weightedRandomElement(weightedElements)); diff --git a/src/modules/string.cpp b/src/modules/string.cpp index 043700216..62739a54f 100644 --- a/src/modules/string.cpp +++ b/src/modules/string.cpp @@ -358,5 +358,4 @@ std::string nanoId(int minLength, int maxLength) return id; } - }