Birth Generator 1.1.1
Procedural birth date generation for C++23
Loading...
Searching...
No Matches
dasmig::birth Class Reference

Return type for birth generation, holding all data fields. More...

#include <birthgen.hpp>

Public Member Functions

std::uint64_t seed () const
 Retrieve the random seed used to generate this birth.
 
std::string date_string () const
 ISO 8601 date string (YYYY-MM-DD).
 
 operator std::string () const
 Implicit conversion to std::string.
 

Public Attributes

std::string country_code
 ISO 3166-1 alpha-2 code.
 
std::uint16_t year {0}
 Birth year.
 
std::uint8_t month {0}
 Birth month (1–12).
 
std::uint8_t day {0}
 Birth day (1–31).
 
std::uint8_t age {0}
 Age in completed years.
 
sex bio_sex {sex::male}
 Biological sex.
 
std::uint8_t weekday {0}
 Day of week (0=Sun, 1=Mon, …, 6=Sat).
 
double le_remaining {0.0}
 Estimated years of life remaining.
 
std::string cohort
 Generational cohort label.
 

Friends

class bthg
 
std::ostream & operator<< (std::ostream &os, const birth &b)
 Stream the ISO date to an output stream.
 

Detailed Description

Return type for birth generation, holding all data fields.

Supports implicit conversion to std::string (returns ISO date) and streaming via operator<<.

Definition at line 74 of file birthgen.hpp.

Member Function Documentation

◆ date_string()

std::string dasmig::birth::date_string ( ) const
inline

ISO 8601 date string (YYYY-MM-DD).

Definition at line 91 of file birthgen.hpp.

◆ operator std::string()

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

Implicit conversion to std::string.

Returns
ISO 8601 date string.

Definition at line 101 of file birthgen.hpp.

◆ seed()

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

Retrieve the random seed used to generate this birth.

Definition at line 88 of file birthgen.hpp.

Friends And Related Symbol Documentation

◆ bthg

friend class bthg
friend

Definition at line 115 of file birthgen.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const birth b 
)
friend

Stream the ISO date to an output stream.

Definition at line 107 of file birthgen.hpp.

Member Data Documentation

◆ age

std::uint8_t dasmig::birth::age {0}

Age in completed years.

Definition at line 81 of file birthgen.hpp.

◆ bio_sex

sex dasmig::birth::bio_sex {sex::male}

Biological sex.

Definition at line 82 of file birthgen.hpp.

◆ cohort

std::string dasmig::birth::cohort

Generational cohort label.

Definition at line 85 of file birthgen.hpp.

◆ country_code

std::string dasmig::birth::country_code

ISO 3166-1 alpha-2 code.

Definition at line 77 of file birthgen.hpp.

◆ day

std::uint8_t dasmig::birth::day {0}

Birth day (1–31).

Definition at line 80 of file birthgen.hpp.

◆ le_remaining

double dasmig::birth::le_remaining {0.0}

Estimated years of life remaining.

Definition at line 84 of file birthgen.hpp.

◆ month

std::uint8_t dasmig::birth::month {0}

Birth month (1–12).

Definition at line 79 of file birthgen.hpp.

◆ weekday

std::uint8_t dasmig::birth::weekday {0}

Day of week (0=Sun, 1=Mon, …, 6=Sat).

Definition at line 83 of file birthgen.hpp.

◆ year

std::uint16_t dasmig::birth::year {0}

Birth year.

Definition at line 78 of file birthgen.hpp.


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