Faker C++
Loading...
Searching...
No Matches
String.h File Reference
#include <limits>
#include <map>
#include <optional>
#include <random>
#include <set>
#include <string>
#include "faker-cxx/Export.h"
#include "RandomGenerator.h"
#include "types/Hex.h"
Include dependency graph for String.h:

Go to the source code of this file.

Classes

struct  faker::string::CharCount
 

Namespaces

namespace  faker
 
namespace  faker::string
 

Typedefs

using faker::string::GuaranteeMap = std::map<char, CharCount>
 

Enumerations

enum class  faker::string::StringCasing { faker::string::Mixed , faker::string::Lower , faker::string::Upper }
 

Functions

FAKER_CXX_EXPORT bool faker::string::isValidGuarantee (GuaranteeMap &guarantee, std::set< char > &targetCharacters, unsigned int length)
 Checks if the given guarantee map is valid for given targetCharacters and length.
 
FAKER_CXX_EXPORT std::string faker::string::generateAtLeastString (const GuaranteeMap &guarantee)
 Generates the least required string for a given guarantee map.
 
template<typename T = std::mt19937>
std::string faker::string::uuid (RandomGenerator< T > gen=RandomGenerator< std::mt19937 >{})
 Generates an Universally Unique Identifier with version 4.
 
FAKER_CXX_EXPORT std::string faker::string::sample (unsigned length=10)
 Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
 
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 `}`).
 
FAKER_CXX_EXPORT std::string faker::string::fromCharacters (const std::string &characters, unsigned length=1)
 Generates a string consisting of given characters.
 
FAKER_CXX_EXPORT std::string faker::string::fromCharacters (GuaranteeMap &&guarantee, const std::string &characters, unsigned length=1)
 Generates a string consisting of given characters.
 
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.
 
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.
 
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.
 
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.
 
FAKER_CXX_EXPORT std::string faker::string::numeric (unsigned length=1, bool allowLeadingZeros=true)
 Generates a given length string of digits.
 
FAKER_CXX_EXPORT std::string faker::string::numeric (GuaranteeMap &&guarantee, unsigned length=1, bool allowLeadingZeros=true)
 Generates a given length string of digits.
 
FAKER_CXX_EXPORT std::string faker::string::hexadecimal (unsigned length=1, HexCasing casing=HexCasing::Lower, HexPrefix prefix=HexPrefix::ZeroX)
 Generates a hexadecimal string.
 
FAKER_CXX_EXPORT std::string faker::string::hexadecimal (std::optional< int > min=std::nullopt, std::optional< int > max=std::nullopt)
 Returns a lowercase hexadecimal number.
 
FAKER_CXX_EXPORT std::string faker::string::hexadecimal (GuaranteeMap &&guarantee, unsigned length=1, HexCasing casing=HexCasing::Lower, HexPrefix prefix=HexPrefix::ZeroX)
 Generates a hexadecimal string.
 
FAKER_CXX_EXPORT std::string faker::string::binary (unsigned length=1)
 Generates a binary string.
 
FAKER_CXX_EXPORT std::string faker::string::binary (GuaranteeMap &&guarantee, unsigned length=1)
 Generates a binary string.
 
FAKER_CXX_EXPORT std::string faker::string::octal (unsigned length=1)
 Generates an octal string.
 
FAKER_CXX_EXPORT std::string faker::string::octal (GuaranteeMap &&guarantee, unsigned length=1)
 Generates an octal string.