Faker C++
|
Classes | |
struct | CharCount |
Typedefs | |
using | GuaranteeMap = std::map<char, CharCount> |
Enumerations | |
enum class | StringCasing { Mixed , Lower , Upper } |
Functions | |
FAKER_CXX_EXPORT bool | isValidGuarantee (GuaranteeMap &guarantee, std::set< char > &targetCharacters, unsigned length) |
Checks if the given guarantee map is valid for given targetCharacters and length. | |
FAKER_CXX_EXPORT std::string | generateAtLeastString (const GuaranteeMap &guarantee) |
Generates the least required string for a given guarantee map. | |
template<typename T = std::mt19937> | |
std::string | uuid (RandomGenerator< T > gen=RandomGenerator< std::mt19937 >{}) |
Generates an Universally Unique Identifier with version 4. | |
FAKER_CXX_EXPORT std::string | sample (unsigned length=10) |
Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`). | |
FAKER_CXX_EXPORT std::string | sample (GuaranteeMap &&guarantee, unsigned length=10) |
Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`). | |
FAKER_CXX_EXPORT std::string | symbol (unsigned minLength=1, unsigned maxLength=10) |
Returns a string containing "~`!@#$%^&*()_-+={[}]|:;\"'<,>.?/". | |
FAKER_CXX_EXPORT std::string | fromCharacters (const std::string &characters, unsigned length=1) |
Generates a string consisting of given characters. | |
FAKER_CXX_EXPORT std::string | fromCharacters (GuaranteeMap &&guarantee, const std::string &characters, unsigned length=1) |
Generates a string consisting of given characters. | |
FAKER_CXX_EXPORT std::string | alpha (unsigned length=1, StringCasing casing=StringCasing::Mixed, const std::string &excludeCharacters="") |
Generates a string consisting of letters in the English alphabet. | |
FAKER_CXX_EXPORT std::string | alpha (GuaranteeMap &&guarantee, unsigned length=1, StringCasing casing=StringCasing::Mixed) |
Generates a string consisting of letters in the English alphabet. | |
FAKER_CXX_EXPORT std::string | alphanumeric (unsigned length=1, StringCasing casing=StringCasing::Mixed, const std::string &excludeCharacters="") |
Generates a string consisting of alpha characters and digits. | |
FAKER_CXX_EXPORT std::string | alphanumeric (GuaranteeMap &&guarantee, unsigned length=1, StringCasing casing=StringCasing::Mixed) |
Generates a string consisting of alpha characters and digits. | |
FAKER_CXX_EXPORT std::string | numeric (unsigned length=1, bool allowLeadingZeros=true) |
Generates a given length string of digits. | |
FAKER_CXX_EXPORT std::string | numeric (GuaranteeMap &&guarantee, unsigned length=1, bool allowLeadingZeros=true) |
Generates a given length string of digits. | |
FAKER_CXX_EXPORT std::string | nanoId (int length) |
Generates a unique, URL-safe string identifier of the specified length. | |
FAKER_CXX_EXPORT std::string | nanoId () |
Generates a unique, URL-safe string identifier of default length. | |
FAKER_CXX_EXPORT std::string | nanoId (int minLength, int maxLength) |
Generates a unique, URL-safe string identifier of random length within a specified range. | |
using faker::string::GuaranteeMap = std::map<char, CharCount> |
Specify the count required for specific chars
|
strong |
FAKER_CXX_EXPORT std::string faker::string::alpha | ( | GuaranteeMap && | guarantee, |
unsigned | length = 1, | ||
StringCasing | casing = StringCasing::Mixed ) |
Generates a string consisting of letters in the English alphabet.
guarantee | A map specifying char count constraints if any |
length | The number of characters to generate. Defaults to `1`. |
casing | The casing of the characters. Defaults to `StringCasingMixed`. |
FAKER_CXX_EXPORT std::string faker::string::alpha | ( | unsigned | length = 1, |
StringCasing | casing = StringCasing::Mixed, | ||
const std::string & | excludeCharacters = "" ) |
Generates a string consisting of letters in the English alphabet.
length | The number of characters to generate. Defaults to `1`. |
casing | The casing of the characters. Defaults to `StringCasingMixed`. |
excludeCharacters | The characters to be excluded from the string to generate. Defaults to ``. |
FAKER_CXX_EXPORT std::string faker::string::alphanumeric | ( | GuaranteeMap && | guarantee, |
unsigned | length = 1, | ||
StringCasing | casing = StringCasing::Mixed ) |
Generates a string consisting of alpha characters and digits.
guarantee | A map specifying char count constraints if any |
length | The number of characters to generate. Defaults to `1`. |
casing | The casing of the characters. Defaults to `StringCasingMixed`. |
FAKER_CXX_EXPORT std::string faker::string::alphanumeric | ( | unsigned | length = 1, |
StringCasing | casing = StringCasing::Mixed, | ||
const std::string & | excludeCharacters = "" ) |
Generates a string consisting of alpha characters and digits.
length | The number of characters to generate. Defaults to `1`. |
casing | The casing of the characters. Defaults to `StringCasingMixed`. |
excludeCharacters | The characters to be excluded from alphanumeric characters to generate string from. Defaults to ``. |
FAKER_CXX_EXPORT std::string faker::string::fromCharacters | ( | const std::string & | characters, |
unsigned | length = 1 ) |
Generates a string consisting of given characters.
characters | The characters to generate string with. |
length | The number of characters to generate. Defaults to `1`. |
FAKER_CXX_EXPORT std::string faker::string::fromCharacters | ( | GuaranteeMap && | guarantee, |
const std::string & | characters, | ||
unsigned | length = 1 ) |
Generates a string consisting of given characters.
guarantee | A map specifying char count constraints if any |
characters | The characters to generate string with. |
length | The number of characters to generate. Defaults to `1`. |
FAKER_CXX_EXPORT std::string faker::string::generateAtLeastString | ( | const GuaranteeMap & | guarantee | ) |
Generates the least required string for a given guarantee map.
guarantee | A std::map<char,CharCount> which stores the guarantee specified by the user |
FAKER_CXX_EXPORT bool faker::string::isValidGuarantee | ( | GuaranteeMap & | guarantee, |
std::set< char > & | targetCharacters, | ||
unsigned | length ) |
Checks if the given guarantee map is valid for given targetCharacters and length.
guarantee | A std::map that maps the count range of specific characters required |
targetCharacters | A std::string consisting of all chars available for that string generating function |
length | The number of characters to generate. |
FAKER_CXX_EXPORT std::string faker::string::nanoId | ( | ) |
Generates a unique, URL-safe string identifier of default length.
This function generates a unique identifier with a default length of 10 characters. The identifier is URL-safe and created using a cryptographically secure random number generator.
FAKER_CXX_EXPORT std::string faker::string::nanoId | ( | int | length | ) |
Generates a unique, URL-safe string identifier of the specified length.
This function generates a unique identifier using a cryptographically secure random number generator, with the output length set by the `length` parameter.
length | The exact length of the identifier to generate. |
FAKER_CXX_EXPORT std::string faker::string::nanoId | ( | int | minLength, |
int | maxLength ) |
Generates a unique, URL-safe string identifier of random length within a specified range.
This function generates a unique identifier with a length that varies between `minLength` and `maxLength`, inclusive. The identifier is URL-safe and created using a cryptographically secure random number generator.
minLength | The minimum length of the identifier. |
maxLength | The maximum length of the identifier. |
FAKER_CXX_EXPORT std::string faker::string::numeric | ( | GuaranteeMap && | guarantee, |
unsigned | length = 1, | ||
bool | allowLeadingZeros = true ) |
Generates a given length string of digits.
guarantee | A map specifying char count constraints if any |
length | The number of digits to generate. Defaults to `1`. |
allowLeadingZeros | Whether leading zeros are allowed or not. Defaults to `true`. |
FAKER_CXX_EXPORT std::string faker::string::numeric | ( | unsigned | length = 1, |
bool | allowLeadingZeros = true ) |
Generates a given length string of digits.
length | The number of digits to generate. Defaults to `1`. |
allowLeadingZeros | Whether leading zeros are allowed or not. Defaults to `true`. |
FAKER_CXX_EXPORT std::string faker::string::sample | ( | GuaranteeMap && | guarantee, |
unsigned | length = 10 ) |
Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
guarantee | A map specifying char count constraints if any |
length | The number of characters to generate. Defaults to `10`. |
FAKER_CXX_EXPORT std::string faker::string::sample | ( | unsigned | length = 10 | ) |
Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
length | The number of characters to generate. Defaults to `10`. |
FAKER_CXX_EXPORT std::string faker::string::symbol | ( | unsigned | minLength = 1, |
unsigned | maxLength = 10 ) |
Returns a string containing "~`!@#$%^&*()_-+={[}]|:;\"'<,>.?/".
minLength | The number of minimum characters to generate. Defaults to `1`. |
maxLength | The number of maximum characters to generate. Defaults to `10`. |
std::string faker::string::uuid | ( | RandomGenerator< T > | gen = RandomGenerator<std::mt19937>{} | ) |
Generates an Universally Unique Identifier with version 4.
gen | A random number generator (type RandomGenerator) |