The sex enum shared by every generator library, and its text form.
More...
#include <cstdint>
#include <optional>
#include <string_view>
Go to the source code of this file.
The sex enum shared by every generator library, and its text form.
- Author
- Diego Dasso Migotto (diegomigotto at hotmail dot com)
Definition in file sex.hpp.
◆ DASMIG_SEX_DEFINED
| #define DASMIG_SEX_DEFINED |
◆ sex
Biological sex.
| Enumerator |
|---|
| male | Male.
|
| female | Female.
|
Definition at line 24 of file sex.hpp.
◆ parse_sex()
| constexpr std::optional< sex > dasmig::core::parse_sex |
( |
std::string_view |
text | ) |
|
|
constexprnoexcept |
Reads the name written by sex_name().
Exact and case-sensitive: only "male" and "female" are accepted.
- Parameters
-
- Returns
- The sex, or an empty optional for any other text.
Definition at line 56 of file sex.hpp.
◆ sex_name()
| constexpr std::string_view dasmig::core::sex_name |
( |
sex |
s | ) |
|
|
constexprnoexcept |
The lower-case name of a sex, as written in data files and JSON.
- Parameters
-
- Returns
"male" or "female"; "unknown" for a value outside the enum.
Definition at line 40 of file sex.hpp.