Skip to content

Commit

Permalink
chore: remove county location function
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal committed Jun 27, 2024
1 parent 260a1a8 commit f43a203
Show file tree
Hide file tree
Showing 5 changed files with 380 additions and 453 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file

## v2.1.0 (TBD)

### ⚠ BREAKING CHANGES

* removed `location.county` method

## v2.0.0 (27.06.2024)

### ⚠ BREAKING CHANGES
Expand Down
337 changes: 162 additions & 175 deletions include/faker-cxx/Location.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,179 +25,166 @@ enum class AddressCountry
Usa,
};

/**
* @brief Returns a random country name.
*
* @returns Country name.
*
* @code
* faker::location::country() // "Poland"
* @endcode
*/
std::string_view country();

/**
* @brief Returns a random country code.
*
* @returns Country code consisting two letters.
*
* @code
* faker::location::countryCode() // "PL"
* @endcode
*/
std::string_view countryCode();

/**
* @brief Returns a random state for a given country.
*
* @param country The country to generate state from. Defaults to `Country::Usa`.
*
* @returns State.
*
* @code
* faker::location::state() // "Arizona"
* @endcode
*/
std::string_view state(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random county for a given country.
*
* @param country The country to generate county from. Defaults to `Country::Usa`.
*
* @returns County.
*
* @code
* faker::location::county() // "Adams County"
* @endcode
*/
std::string_view county(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random city for given country.
*
* @param country The country to generate city from. Defaults to `Country::Usa`.
*
* @returns City.
*
* @code
* faker::location::city() // "Boston"
* @endcode
*/
std::string city(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random zip code for given country.
*
* @param country The country to generate zip code from. Defaults to `Country::Usa`.
*
* @returns Zip code.
*
* @code
* faker::location::zipCode() // "47683-9880"
* faker::location::zipCode(Country::Poland) // "31-881"
* @endcode
*/
std::string zipCode(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random street address for given country.
*
* @param country The country to generate street address from. Defaults to `Country::Usa`.
*
* @returns Street address including building number and street name.
*
* @code
* faker::location::streetAddress() // "34830 Erdman Hollow"
* @endcode
*/
std::string streetAddress(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random street for given country.
*
* @param country The country to generate street from. Defaults to `Country::Usa`.
*
* @returns Street name.
*
* @code
* faker::location::street() // "Schroeder Isle"
* @endcode
*/
std::string street(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random building number for given country.
*
* @param country The country to generate building number from. Defaults to `Country::Usa`.
*
* @returns Building number.
*
* @code
* faker::location::buildingNumber() // "505"
* @endcode
*/
std::string buildingNumber(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random secondary address number for given country.
* This refers to a specific location at a given address such as an apartment or room number
*
* @param country The country to generate building number from. Defaults to `Country::Usa`.
*
* @returns Secondary address.
*
* @code
* faker::location::secondaryAddress() // "Apt. 861"
* @endcode
*/
std::string secondaryAddress(AddressCountry country = AddressCountry::Usa);

/**
* @brief Generates a random latitude.
*
* @param precision The number of decimal points of precision for the latitude. Defaults to `Precision::FourDp`.
*
* @returns Latitude within -90 to 90 range.
*
* @code
* faker::location::latitude() // "-30.9501"
* @endcode
*/
std::string latitude(Precision precision = Precision::FourDp);

/**
* @brief Generates a random longitude.
*
* @param precision The number of decimal points of precision for the longitude. Defaults to `Precision::FourDp`.
*
* @returns Longitude within -180 to 180 range.
*
* @code
* faker::location::longitude() // "-30.9501"
* @endcode
*/
std::string longitude(Precision precision = Precision::FourDp);

/**
* @brief Generates a random direction from cardinal and ordinal directions.
*
* @returns Direction.
*
* @code
* faker::location::direction() // "North"
* @endcode
*/
std::string_view direction();

/**
* @brief Generates a random time zone.
*
* @returns Time zone.
*
* @code
* faker::location::timeZone() // "Europe/Warsaw"
* @endcode
*/
std::string_view timeZone();
/**
* @brief Returns a random country name.
*
* @returns Country name.
*
* @code
* faker::location::country() // "Poland"
* @endcode
*/
std::string_view country();

/**
* @brief Returns a random country code.
*
* @returns Country code consisting two letters.
*
* @code
* faker::location::countryCode() // "PL"
* @endcode
*/
std::string_view countryCode();

/**
* @brief Returns a random state for a given country.
*
* @param country The country to generate state from. Defaults to `Country::Usa`.
*
* @returns State.
*
* @code
* faker::location::state() // "Arizona"
* @endcode
*/
std::string_view state(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random city for given country.
*
* @param country The country to generate city from. Defaults to `Country::Usa`.
*
* @returns City.
*
* @code
* faker::location::city() // "Boston"
* @endcode
*/
std::string city(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random zip code for given country.
*
* @param country The country to generate zip code from. Defaults to `Country::Usa`.
*
* @returns Zip code.
*
* @code
* faker::location::zipCode() // "47683-9880"
* faker::location::zipCode(Country::Poland) // "31-881"
* @endcode
*/
std::string zipCode(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random street address for given country.
*
* @param country The country to generate street address from. Defaults to `Country::Usa`.
*
* @returns Street address including building number and street name.
*
* @code
* faker::location::streetAddress() // "34830 Erdman Hollow"
* @endcode
*/
std::string streetAddress(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random street for given country.
*
* @param country The country to generate street from. Defaults to `Country::Usa`.
*
* @returns Street name.
*
* @code
* faker::location::street() // "Schroeder Isle"
* @endcode
*/
std::string street(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random building number for given country.
*
* @param country The country to generate building number from. Defaults to `Country::Usa`.
*
* @returns Building number.
*
* @code
* faker::location::buildingNumber() // "505"
* @endcode
*/
std::string buildingNumber(AddressCountry country = AddressCountry::Usa);

/**
* @brief Returns a random secondary address number for given country.
* This refers to a specific location at a given address such as an apartment or room number
*
* @param country The country to generate building number from. Defaults to `Country::Usa`.
*
* @returns Secondary address.
*
* @code
* faker::location::secondaryAddress() // "Apt. 861"
* @endcode
*/
std::string secondaryAddress(AddressCountry country = AddressCountry::Usa);

/**
* @brief Generates a random latitude.
*
* @param precision The number of decimal points of precision for the latitude. Defaults to `Precision::FourDp`.
*
* @returns Latitude within -90 to 90 range.
*
* @code
* faker::location::latitude() // "-30.9501"
* @endcode
*/
std::string latitude(Precision precision = Precision::FourDp);

/**
* @brief Generates a random longitude.
*
* @param precision The number of decimal points of precision for the longitude. Defaults to `Precision::FourDp`.
*
* @returns Longitude within -180 to 180 range.
*
* @code
* faker::location::longitude() // "-30.9501"
* @endcode
*/
std::string longitude(Precision precision = Precision::FourDp);

/**
* @brief Generates a random direction from cardinal and ordinal directions.
*
* @returns Direction.
*
* @code
* faker::location::direction() // "North"
* @endcode
*/
std::string_view direction();

/**
* @brief Generates a random time zone.
*
* @returns Time zone.
*
* @code
* faker::location::timeZone() // "Europe/Warsaw"
* @endcode
*/
std::string_view timeZone();
}
12 changes: 0 additions & 12 deletions src/modules/location/Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,6 @@ std::string_view countryCode()
return helper::arrayElement(countryCodes);
}

std::string_view county(AddressCountry country)
{
const auto& countryAddresses = getAddresses(country);

if (countryAddresses.counties.empty())
{
return "";
}

return helper::arrayElement(countryAddresses.counties);
}

std::string_view state(AddressCountry country)
{
const auto& countryAddresses = getAddresses(country);
Expand Down
Loading

0 comments on commit f43a203

Please sign in to comment.