Faker C++
Loading...
Searching...
No Matches
internet.h File Reference
#include <array>
#include <ctime>
#include <map>
#include <optional>
#include <string>
#include <string_view>
#include "faker-cxx/export.h"
#include "faker-cxx/types/locale.h"
Include dependency graph for internet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  faker::internet::PasswordOptions
 

Namespaces

namespace  faker
 
namespace  faker::internet
 

Enumerations

enum class  faker::internet::HttpResponseType {
  faker::internet::ClientError , faker::internet::Informational , faker::internet::Redirection , faker::internet::ServerError ,
  faker::internet::Success
}
 
enum class  faker::internet::WebProtocol { faker::internet::Http , faker::internet::Https }
 
enum class  faker::internet::IPv4Class { faker::internet::A , faker::internet::B , faker::internet::C }
 
enum class  faker::internet::EmojiType {
  faker::internet::Activity , faker::internet::Body , faker::internet::Flag , faker::internet::Food ,
  faker::internet::Nature , faker::internet::Object , faker::internet::Person , faker::internet::Smiley ,
  faker::internet::Symbol , faker::internet::Travel
}
 

Functions

FAKER_CXX_EXPORT std::string faker::internet::username (std::optional< std::string > firstName=std::nullopt, std::optional< std::string > lastName=std::nullopt, Locale locale=Locale::en_US)
 Generates a username using the given person's name as base.
 
FAKER_CXX_EXPORT std::string faker::internet::email (std::optional< std::string > firstName=std::nullopt, std::optional< std::string > lastName=std::nullopt, std::optional< std::string > emailHost=std::nullopt, Locale locale=Locale::en_US)
 Generates an email address using the given person's name as base.
 
FAKER_CXX_EXPORT std::string faker::internet::exampleEmail (std::optional< std::string > firstName=std::nullopt, std::optional< std::string > lastName=std::nullopt, Locale locale=Locale::en_US)
 Generates an email address using the given person's name as base with example domain.
 
FAKER_CXX_EXPORT std::string faker::internet::password (int length=16, const PasswordOptions &options={})
 Generates a random password-like string. Do not use this method for generating actual passwords for users. Since the source of the randomness is not cryptographically secure, neither is this generator.
 
FAKER_CXX_EXPORT std::string_view faker::internet::emoji (std::optional< EmojiType > type=std::nullopt)
 Returns a random emoji.
 
FAKER_CXX_EXPORT bool faker::internet::checkIfEmojiIsValid (const std::string &emojiToCheck)
 Verify that a given emoji is valid.
 
FAKER_CXX_EXPORT std::string_view faker::internet::protocol ()
 Returns a random web protocol. Either `http` or `https`.
 
FAKER_CXX_EXPORT std::string_view faker::internet::httpMethod ()
 Generates a random http method name.
 
FAKER_CXX_EXPORT unsigned faker::internet::httpStatusCode (std::optional< HttpResponseType > responseType=std::nullopt)
 Returns a random http status code.
 
FAKER_CXX_EXPORT std::string_view faker::internet::httpRequestHeader (Locale locale=Locale::en_US)
 Generates a random http request header.
 
FAKER_CXX_EXPORT std::string_view faker::internet::httpResponseHeader (Locale locale=Locale::en_US)
 Generates a random http response header.
 
FAKER_CXX_EXPORT std::string_view faker::internet::httpMediaType (Locale locale=Locale::en_US)
 Generates a random http media type.
 
FAKER_CXX_EXPORT std::string faker::internet::ipv4 (const IPv4Class &ipv4class=IPv4Class::C)
 Returns a string containing randomized ipv4 address of the given class.
 
FAKER_CXX_EXPORT std::string faker::internet::ipv4 (const std::array< unsigned int, 4 > &baseIpv4Address, const std::array< unsigned int, 4 > &generationMask)
 Returns a string containing randomized ipv4 address based on given base address and mask.
 
FAKER_CXX_EXPORT std::string faker::internet::ipv6 ()
 Returns a string containing randomized ipv6 address.
 
FAKER_CXX_EXPORT std::string faker::internet::mac (const std::string &sep=":")
 Returns a generated random mac address.
 
FAKER_CXX_EXPORT unsigned faker::internet::port ()
 Generates a random port.
 
FAKER_CXX_EXPORT std::string faker::internet::url (const WebProtocol &webProtocol=WebProtocol::Https, Locale locale=Locale::en_US)
 Generates a random url.
 
FAKER_CXX_EXPORT std::string faker::internet::domainName (Locale locale=Locale::en_US)
 Generates a random domain name.
 
FAKER_CXX_EXPORT std::string faker::internet::domainWord ()
 Generates a random domain word.
 
FAKER_CXX_EXPORT std::string_view faker::internet::domainSuffix (Locale locale=Locale::en_US)
 Generates a random domain suffix.
 
FAKER_CXX_EXPORT std::string faker::internet::anonymousUsername (unsigned maxLength)
 Generates a random username.
 
FAKER_CXX_EXPORT std::string faker::internet::getJWTToken (const std::optional< std::map< std::string, std::string > > &header=std::nullopt, const std::optional< std::map< std::string, std::string > > &payload=std::nullopt, const std::optional< std::string > &refDate=std::nullopt)
 Generates a JSON Web Token (JWT).
 
FAKER_CXX_EXPORT std::string_view faker::internet::getJWTAlgorithm (Locale locale=Locale::en_US)
 Returns the algorithm used for signing the JWT.