Occupation Generator 3.0.1
Employment status and occupation by country, age, sex and education for C++23
Loading...
Searching...
No Matches
dasmig::occupation Class Reference

Return type for occupation generation. More...

#include <occupationgen.hpp>

Public Member Functions

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

Public Attributes

std::string country_code
 ISO 3166-1 alpha-2 code of the country drawn from.
 
sex person_sex {sex::male}
 Sex (given or drawn).
 
std::uint8_t age {0}
 Age in completed years.
 
employment_status status {employment_status::employed}
 Employment status.
 
std::optional< education_level > education
 Education; unknown under 15 when not given.
 
std::optional< job_info > job
 

Friends

class ocg
 
std::ostream & operator<< (std::ostream &os, const occupation &v)
 Stream the summary to an output stream.
 

Detailed Description

Return type for occupation generation.

Supports implicit conversion to std::string (the job label, or the status when there is no job), streaming via operator<< and JSON output via to_json().

Definition at line 122 of file occupationgen.hpp.

Member Function Documentation

◆ operator std::string()

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

Implicit conversion to std::string.

Returns
Summary string.

Definition at line 199 of file occupationgen.hpp.

◆ seed()

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

Retrieve the random seed used to generate this occupation.

Returns
The call seed; pass it, with the same request, to the seeded get_occupation(request, seed) overload to generate the same occupation again.

Definition at line 137 of file occupationgen.hpp.

◆ signature()

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

The seed and the data this occupation was generated from.

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

Definition at line 142 of file occupationgen.hpp.

◆ to_json() [1/2]

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

This occupation as a JSON document.

Returns
Compact JSON, for example {"country_code":"BR","sex":"male","age":30,"status":"employed","education":"intermediate","job":{...},"signature":{...}}.

Definition at line 190 of file occupationgen.hpp.

◆ to_json() [2/2]

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

Write this occupation as a JSON object.

Parameters
wWriter positioned where a value is allowed.

Definition at line 153 of file occupationgen.hpp.

◆ to_string()

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

Human-readable summary string.

Returns
The job label, or the status when there is no job.

Definition at line 146 of file occupationgen.hpp.

Friends And Related Symbol Documentation

◆ ocg

friend class ocg
friend

Definition at line 223 of file occupationgen.hpp.

◆ operator<<

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

Stream the summary to an output stream.

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

Definition at line 208 of file occupationgen.hpp.

Member Data Documentation

◆ age

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

Age in completed years.

Definition at line 127 of file occupationgen.hpp.

◆ country_code

std::string dasmig::occupation::country_code

ISO 3166-1 alpha-2 code of the country drawn from.

Definition at line 125 of file occupationgen.hpp.

◆ education

std::optional<education_level> dasmig::occupation::education

Education; unknown under 15 when not given.

Definition at line 129 of file occupationgen.hpp.

◆ job

std::optional<job_info> dasmig::occupation::job

The job: the current one when employed, the last or usual one when unemployed, retired or inactive; none for students and for the inactive under 6.

Definition at line 130 of file occupationgen.hpp.

◆ person_sex

sex dasmig::occupation::person_sex {sex::male}

Sex (given or drawn).

Definition at line 126 of file occupationgen.hpp.

◆ status

employment_status dasmig::occupation::status {employment_status::employed}

Employment status.

Definition at line 128 of file occupationgen.hpp.


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