Email Generator 2.1.3
Email addresses in each country's style for C++23
Loading...
Searching...
No Matches
dasmig::email Class Reference

Return type for email generation. More...

#include <emailgen.hpp>

Public Member Functions

std::string address () const
 The address.
 
std::uint64_t seed () const
 Retrieve the random seed used to generate this address.
 
const core::seed_signature & signature () const
 The seed and the data this address was generated from.
 
std::string to_string () const
 Human-readable summary string.
 
void to_json (core::json_writer &w) const
 Write this address as a JSON object.
 
std::string to_json () const
 This address as a JSON document.
 
 operator std::string () const
 Implicit conversion to std::string.
 

Public Attributes

std::string country_code
 ISO 3166-1 alpha-2 of the country whose style the address follows.
 
std::string local
 The part before the @: [a-z0-9._-], at most 64 characters.
 
std::string domain
 The part after the @.
 
std::string kind
 free (webmail) or isp (a provider of the country); empty for a reserved domain.
 
bool reserved {false}
 True when the domain is one RFC 2606 reserves (example.com, .net, .org): the safe option.
 

Friends

class emg
 
std::ostream & operator<< (std::ostream &os, const email &v)
 Stream the address to an output stream.
 

Detailed Description

Return type for email generation.

Supports implicit conversion to std::string (the address), streaming via operator<< and JSON output via to_json().

Definition at line 74 of file emailgen.hpp.

Member Function Documentation

◆ address()

std::string dasmig::email::address ( ) const
inline

The address.

Returns
local@domain.

Definition at line 85 of file emailgen.hpp.

◆ operator std::string()

dasmig::email::operator std::string ( ) const
inline

Implicit conversion to std::string.

Returns
The address.

Definition at line 128 of file emailgen.hpp.

◆ seed()

std::uint64_t dasmig::email::seed ( ) const
inline

Retrieve the random seed used to generate this address.

Returns
The call seed; pass it to get_email(request, seed) with the same request and data to replay it.

Definition at line 90 of file emailgen.hpp.

◆ signature()

const core::seed_signature & dasmig::email::signature ( ) const
inline

The seed and the data this address was generated from.

Returns
The replay signature; data is emg::data_hash() at the time of generation.

Definition at line 95 of file emailgen.hpp.

◆ to_json() [1/2]

std::string dasmig::email::to_json ( ) const
inline

This address as a JSON document.

Returns
Compact JSON, for example {"country_code":"DE","address":"...",...}.

Definition at line 119 of file emailgen.hpp.

◆ to_json() [2/2]

void dasmig::email::to_json ( core::json_writer &  w) const
inline

Write this address as a JSON object.

Parameters
wWriter positioned where a value is allowed.

Definition at line 103 of file emailgen.hpp.

◆ to_string()

std::string dasmig::email::to_string ( ) const
inline

Human-readable summary string.

Returns
The address.

Definition at line 99 of file emailgen.hpp.

Friends And Related Symbol Documentation

◆ emg

friend class emg
friend

Definition at line 145 of file emailgen.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const email &  v 
)
friend

Stream the address to an output stream.

Parameters
osOutput stream.
vThe address to stream.
Returns
The stream.

Definition at line 137 of file emailgen.hpp.

Member Data Documentation

◆ country_code

std::string dasmig::email::country_code

ISO 3166-1 alpha-2 of the country whose style the address follows.

Definition at line 77 of file emailgen.hpp.

◆ domain

std::string dasmig::email::domain

The part after the @.

Definition at line 79 of file emailgen.hpp.

◆ kind

std::string dasmig::email::kind

free (webmail) or isp (a provider of the country); empty for a reserved domain.

Definition at line 80 of file emailgen.hpp.

◆ local

std::string dasmig::email::local

The part before the @: [a-z0-9._-], at most 64 characters.

Definition at line 78 of file emailgen.hpp.

◆ reserved

bool dasmig::email::reserved {false}

True when the domain is one RFC 2606 reserves (example.com, .net, .org): the safe option.

Definition at line 81 of file emailgen.hpp.


The documentation for this class was generated from the following file: