Nickname Generator 5.2.2
Gamer-style nickname generation for C++23
Loading...
Searching...
No Matches
dasmig::nickname Class Reference

Return type for nickname generation, holding both the transformed nickname and the original source string. More...

#include <nicknamegen.hpp>

Public Member Functions

std::wstring plain () const
 Return the original word or name used to generate this nickname.
 
std::uint64_t seed () const
 Retrieve the random seed used to generate this nickname.
 
const core::seed_signature & signature () const
 The seed and the data this nickname was generated from.
 
void to_json (core::json_writer &w) const
 Write this nickname as a JSON object {"nickname":…,"source":…,"signature":{…}}.
 
std::string to_json () const
 This nickname as a JSON document.
 
 operator std::wstring () const
 Implicit conversion to std::wstring.
 

Friends

class nng
 Allows nng to construct nicknames.
 
std::wostream & operator<< (std::wostream &wos, const nickname &nickname)
 Stream the nickname to a wide output stream.
 

Detailed Description

Return type for nickname generation, holding both the transformed nickname and the original source string.

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

Definition at line 99 of file nicknamegen.hpp.

Member Function Documentation

◆ operator std::wstring()

dasmig::nickname::operator std::wstring ( ) const
inline

Implicit conversion to std::wstring.

Returns
The transformed nickname string.

Definition at line 149 of file nicknamegen.hpp.

◆ plain()

std::wstring dasmig::nickname::plain ( ) const
inline

Return the original word or name used to generate this nickname.

Returns
Original source string before any transforms.

Definition at line 104 of file nicknamegen.hpp.

◆ seed()

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

Retrieve the random seed used to generate this nickname.

Returns
The per-call seed for replay.
See also
nng::get_nickname(const nickname_request&, std::uint64_t)

Definition at line 112 of file nicknamegen.hpp.

◆ signature()

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

The seed and the data this nickname was generated from.

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

Definition at line 120 of file nicknamegen.hpp.

◆ to_json() [1/2]

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

This nickname as a JSON document.

Returns
Compact JSON.

Definition at line 140 of file nicknamegen.hpp.

◆ to_json() [2/2]

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

Write this nickname as a JSON object {"nickname":…,"source":…,"signature":{…}}.

Parameters
wWriter positioned where a value is allowed.

Definition at line 128 of file nicknamegen.hpp.

Friends And Related Symbol Documentation

◆ nng

friend class nng
friend

Allows nng to construct nicknames.

Definition at line 179 of file nicknamegen.hpp.

◆ operator<<

std::wostream & operator<< ( std::wostream &  wos,
const nickname &  nickname 
)
friend

Stream the nickname to a wide output stream.

Parameters
wosOutput stream.
nicknameNickname to stream.
Returns
Reference to the output stream.

Definition at line 158 of file nicknamegen.hpp.


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