Skip to content

Commit

Permalink
Merge branch 'main' into feature/music-locale
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtApone117 authored Dec 3, 2024
2 parents db3ad34 + d5f5f31 commit 6fc9d53
Show file tree
Hide file tree
Showing 29 changed files with 1,845 additions and 358 deletions.
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
[submodule "externals/fmt"]
path = externals/fmt
url = https://github.com/fmtlib/fmt.git

21 changes: 20 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,25 @@
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_SHARED_LIBS": "ON"
}
},
{
"name": "Enter\\",
"description": "",
"displayName": "",
"inherits": [
"unixlike-gcc-debug-static"
]
},
{
"name": "Enter",
"description": "",
"displayName": "",
"inherits": [
"unixlike-gcc-debug-static",
"unixlike-gcc-debug-shared",
"unixlike-gcc-release-static",
"unixlike-gcc-release-shared"
]
}
],
"buildPresets": [
Expand Down Expand Up @@ -274,7 +293,7 @@
"configurePreset": "windows-msvc-debug-shared",
"configuration": "Debug"
}
],
],
"testPresets": [
{
"name": "test-common",
Expand Down
24 changes: 24 additions & 0 deletions LICENSES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Third Party Licenses

## suyash/ulid:

MIT License

Copyright (c) 2016 Suyash

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## flexxxxer/Md5Hash:

MIT License
Expand Down
19 changes: 10 additions & 9 deletions include/faker-cxx/internet.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ FAKER_CXX_EXPORT std::string username(std::optional<std::string> firstName = std
*/
FAKER_CXX_EXPORT std::string email(std::optional<std::string> firstName = std::nullopt,
std::optional<std::string> lastName = std::nullopt,
std::optional<std::string> emailHost = std::nullopt);
std::optional<std::string> emailHost = std::nullopt, Locale locale = Locale::en_US);

/**
* @brief Generates an email address using the given person's name as base with example domain.
Expand All @@ -96,7 +96,8 @@ FAKER_CXX_EXPORT std::string email(std::optional<std::string> firstName = std::n
* @endcode
*/
FAKER_CXX_EXPORT std::string exampleEmail(std::optional<std::string> firstName = std::nullopt,
std::optional<std::string> lastName = std::nullopt);
std::optional<std::string> lastName = std::nullopt,
Locale locale = Locale::en_US);

/**
* @brief Generates a random password-like string. Do not use this method for generating actual passwords for users.
Expand Down Expand Up @@ -201,7 +202,7 @@ FAKER_CXX_EXPORT unsigned httpStatusCode(std::optional<HttpResponseType> respons
* faker::internet::httpRequestHeader() // "Authorization"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view httpRequestHeader();
FAKER_CXX_EXPORT std::string_view httpRequestHeader(Locale locale = Locale::en_US);

/**
* @brief Generates a random http response header.
Expand All @@ -212,7 +213,7 @@ FAKER_CXX_EXPORT std::string_view httpRequestHeader();
* faker::internet::httpResponseHeader() // "Location"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view httpResponseHeader();
FAKER_CXX_EXPORT std::string_view httpResponseHeader(Locale locale = Locale::en_US);

/**
* @brief Generates a random http media type.
Expand All @@ -223,7 +224,7 @@ FAKER_CXX_EXPORT std::string_view httpResponseHeader();
* faker::internet::httpMediaType() // "application/json"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view httpMediaType();
FAKER_CXX_EXPORT std::string_view httpMediaType(Locale locale = Locale::en_US);

/**
* @brief Returns a string containing randomized ipv4 address of the given class.
Expand Down Expand Up @@ -305,7 +306,7 @@ FAKER_CXX_EXPORT unsigned port();
* faker::internet::url() // "https://slow-timer.info"
* @endcode
*/
FAKER_CXX_EXPORT std::string url(const WebProtocol& webProtocol = WebProtocol::Https);
FAKER_CXX_EXPORT std::string url(const WebProtocol& webProtocol = WebProtocol::Https, Locale locale = Locale::en_US);

/**
* @brief Generates a random domain name.
Expand All @@ -316,7 +317,7 @@ FAKER_CXX_EXPORT std::string url(const WebProtocol& webProtocol = WebProtocol::H
* faker::internet::domainName() // "slow-timer.info"
* @endcode
*/
FAKER_CXX_EXPORT std::string domainName();
FAKER_CXX_EXPORT std::string domainName(Locale locale = Locale::en_US);

/**
* @brief Generates a random domain word.
Expand All @@ -338,7 +339,7 @@ FAKER_CXX_EXPORT std::string domainWord();
* faker::internet::domainSuffix() // "com"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view domainSuffix();
FAKER_CXX_EXPORT std::string_view domainSuffix(Locale locale = Locale::en_US);

/**
* @brief Generates a random username.
Expand Down Expand Up @@ -388,5 +389,5 @@ getJWTToken(const std::optional<std::map<std::string, std::string>>& header = st
* faker::internet::getJWTAlgorithm(); // "HS256"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view getJWTAlgorithm();
FAKER_CXX_EXPORT std::string_view getJWTAlgorithm(Locale locale = Locale::en_US);
}
10 changes: 7 additions & 3 deletions include/faker-cxx/medicine.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,37 @@
#include <string_view>

#include "faker-cxx/export.h"
#include "faker-cxx/types/locale.h"

namespace faker::medicine
{
/**
* @brief Returns a random medical condition.
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Medical condition.
*
* @code
* faker::medicine::condition() // "AIDS"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view condition();
FAKER_CXX_EXPORT std::string_view condition(Locale locale = Locale::en_US);

/**
* @brief Returns a random medical test
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Medical test.
*
* @code
* faker::medicine::medicalTest() // "pulmonary auscultation"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view medicalTest();
FAKER_CXX_EXPORT std::string_view medicalTest(Locale locale = Locale::en_US);

/**
* @brief Returns a random Medical specialty
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Medical specialty.
*
Expand All @@ -38,5 +42,5 @@ FAKER_CXX_EXPORT std::string_view medicalTest();
* @endcode
*/

FAKER_CXX_EXPORT std::string_view specialty();
FAKER_CXX_EXPORT std::string_view specialty(Locale locale = Locale::en_US);
}
26 changes: 19 additions & 7 deletions include/faker-cxx/movie.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
#include <string_view>

#include "faker-cxx/export.h"
#include "faker-cxx/types/locale.h"

namespace faker::movie
{
/**
* @brief Returns a random movie genre.
* @brief Returns a random movie genre
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Movie genre.
*
* @code
* faker::movie::genre() // "Drama"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view genre();
FAKER_CXX_EXPORT std::string_view genre(Locale locale = Locale::en_US);

/**
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @brief Returns a random movie title.
*
* @returns Movie title.
Expand All @@ -26,9 +31,10 @@ FAKER_CXX_EXPORT std::string_view genre();
* faker::movie::movieTitle() // "Pulp Fiction"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view movieTitle();
FAKER_CXX_EXPORT std::string_view movieTitle(Locale locale = Locale::en_US);

/**
* @param locale The locale. Defaults to `Locale::en_US`.
* @brief Returns a random tv show.
*
* @returns Tv show.
Expand All @@ -37,9 +43,11 @@ FAKER_CXX_EXPORT std::string_view movieTitle();
* faker::movie::tvShow() // "The Sopranos"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view tvShow();
FAKER_CXX_EXPORT std::string_view tvShow(Locale locale = Locale::en_US);

/**
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @brief Returns a random movie director name.
*
* @returns Movie director name.
Expand All @@ -48,9 +56,11 @@ FAKER_CXX_EXPORT std::string_view tvShow();
* faker::movie::director() // "Quentin Tarantino"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view director();
FAKER_CXX_EXPORT std::string_view director(Locale locale = Locale::en_US);

/**
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @brief Returns a random actor name.
*
* @returns Actor name.
Expand All @@ -59,9 +69,11 @@ FAKER_CXX_EXPORT std::string_view director();
* faker::movie::actor() // "John Travolta"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view actor();
FAKER_CXX_EXPORT std::string_view actor(Locale locale = Locale::en_US);

/**
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @brief Returns a random actress name.
*
* @returns Actress name.
Expand All @@ -70,5 +82,5 @@ FAKER_CXX_EXPORT std::string_view actor();
* faker::movie::actress() // "Scarlett Johansson"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view actress();
FAKER_CXX_EXPORT std::string_view actress(Locale locale = Locale::en_US);
}
29 changes: 22 additions & 7 deletions include/faker-cxx/science.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string_view>

#include "faker-cxx/export.h"
#include "faker-cxx/types/locale.h"

namespace faker::science
{
Expand All @@ -16,14 +17,16 @@ struct FAKER_CXX_EXPORT ChemicalElement
/**
* @brief Returns a random chemical element from the periodic table.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Chemical element.
*
* @code
* faker::science::chemicalElement() // Object of ChemicalElement containing info about a random element in the periodic
* table.
* @endcode
*/
FAKER_CXX_EXPORT ChemicalElement chemicalElement();
FAKER_CXX_EXPORT ChemicalElement chemicalElement(Locale locale = Locale::en_US);

struct FAKER_CXX_EXPORT Unit
{
Expand All @@ -35,68 +38,80 @@ struct FAKER_CXX_EXPORT Unit
/**
* @brief Returns a unit of measurement for either distance, mass, time, temp, current.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Unit.
*
* @code
* faker::science::unit() // Object of Unit containing info about a random unit of measurement.
* @endcode
*/
FAKER_CXX_EXPORT Unit unit();
FAKER_CXX_EXPORT Unit unit(Locale locale = Locale::en_US);

/**
* @brief Returns a unit of measurement for either distance.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Distance unit.
*
* @code
* faker::science::distanceUnit() // Object of Unit containing info about a random unit of measurement used to measure
* distance.
* @endcode
*/
FAKER_CXX_EXPORT Unit distanceUnit();
FAKER_CXX_EXPORT Unit distanceUnit(Locale locale = Locale::en_US);

/**
* @brief Returns a unit of measurement for either time.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Time unit.
*
* @code
* faker::science::timeUnit() // Object of Unit containing info about a random unit of measurement used to measure time.
* @endcode
*/
FAKER_CXX_EXPORT Unit timeUnit();
FAKER_CXX_EXPORT Unit timeUnit(Locale locale = Locale::en_US);

/**
* @brief Returns a unit of measurement for either mass.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Mass unit.
*
* @code
* faker::science::massUnit() // Object of Unit containing info about a random unit of measurement used to measure mass.
* @endcode
*/
FAKER_CXX_EXPORT Unit massUnit();
FAKER_CXX_EXPORT Unit massUnit(Locale locale = Locale::en_US);

/**
* @brief Returns a unit of measurement for either temp.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Temperture unit.
*
* @code
* faker::science::tempUnit() // Object of Unit containing info about a random unit of measurement used to measure temp.
* @endcode
*/
FAKER_CXX_EXPORT Unit tempUnit();
FAKER_CXX_EXPORT Unit tempUnit(Locale locale = Locale::en_US);

/**
* @brief Returns a unit of measurement for either current.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
* @returns Current unit.
*
* @code
* faker::science::currentUnit() // Object of Unit containing info about a random unit of measurement used to measure
* current.
* @endcode
*/
FAKER_CXX_EXPORT Unit currentUnit();
FAKER_CXX_EXPORT Unit currentUnit(Locale locale = Locale::en_US);
}
Loading

0 comments on commit 6fc9d53

Please sign in to comment.