Faker C++
|
Enumerations | |
enum class | DateFormat { ISO , Timestamp } |
Functions | |
FAKER_CXX_EXPORT std::string | anytime (DateFormat dateFormat=DateFormat::ISO) |
Generates a random date between UNIX epoch and 200 years from now. | |
FAKER_CXX_EXPORT std::string | pastDate (int years=1, DateFormat dateFormat=DateFormat::ISO) |
Generates a random date in the past. | |
FAKER_CXX_EXPORT std::string | futureDate (int years=1, DateFormat dateFormat=DateFormat::ISO) |
Generates a random date in the future. | |
FAKER_CXX_EXPORT std::string | recentDate (int days=3, DateFormat dateFormat=DateFormat::ISO) |
Generates a random date in the recent past. | |
FAKER_CXX_EXPORT std::string | soonDate (int days=3, DateFormat dateFormat=DateFormat::ISO) |
Generates a random date in the soon future. | |
FAKER_CXX_EXPORT std::string | birthdateByAge (int minAge=18, int maxAge=80, DateFormat dateFormat=DateFormat::ISO) |
Generates a random birthdate by age. | |
FAKER_CXX_EXPORT std::string | birthdateByYear (int minYear=1920, int maxYear=2000, DateFormat dateFormat=DateFormat::ISO) |
Generates a random birthdate by year. | |
FAKER_CXX_EXPORT std::string_view | weekdayName () |
Returns a name of random day of the week. | |
FAKER_CXX_EXPORT std::string_view | weekdayAbbreviatedName () |
Returns an abbreviated name of random day of the week. | |
FAKER_CXX_EXPORT std::string_view | monthName () |
Returns a random name of a month. | |
FAKER_CXX_EXPORT std::string_view | monthAbbreviatedName () |
Returns an abbreviated name of random month. | |
FAKER_CXX_EXPORT unsigned | year () |
Returns random year. | |
FAKER_CXX_EXPORT unsigned | month () |
Returns random month. | |
FAKER_CXX_EXPORT unsigned | hour () |
Returns random hour. | |
FAKER_CXX_EXPORT unsigned | minute () |
Returns random minute. | |
FAKER_CXX_EXPORT unsigned | second () |
Returns random second. | |
FAKER_CXX_EXPORT std::string | time () |
Returns random time string. | |
FAKER_CXX_EXPORT unsigned | dayOfMonth () |
Returns random day of month. | |
FAKER_CXX_EXPORT unsigned | dayOfWeek () |
Returns random day of week. | |
FAKER_CXX_EXPORT std::string_view | timezoneRandom () |
Returns random timezone. | |
FAKER_CXX_EXPORT std::string | between (int64_t from, int64_t to, DateFormat dateFormat=DateFormat::ISO) |
Generates a random date between two given Unix timestamps. | |
FAKER_CXX_EXPORT std::string | between (const std::string &from, const std::string &to, DateFormat dateFormat) |
Generates a random date between two given ISO date strings. | |
|
strong |
FAKER_CXX_EXPORT std::string faker::date::anytime | ( | DateFormat | dateFormat = DateFormat::ISO | ) |
Generates a random date between UNIX epoch and 200 years from now.
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT std::string faker::date::between | ( | const std::string & | from, |
const std::string & | to, | ||
DateFormat | dateFormat ) |
Generates a random date between two given ISO date strings.
from | The starting ISO date string in the format "YYYY-MM-DDTHH:MM:SSZ". |
to | The ending ISO date string in the format "YYYY-MM-DDTHH:MM:SSZ". |
dateFormat | Specifies the format of the output date, either as an ISO string or a Unix timestamp. |
FAKER_CXX_EXPORT std::string faker::date::between | ( | int64_t | from, |
int64_t | to, | ||
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random date between two given Unix timestamps.
from | The starting Unix timestamp (seconds since the Unix epoch). |
to | The ending Unix timestamp (seconds since the Unix epoch). |
dateFormat | Specifies the format of the output date, either as an ISO string or a Unix timestamp. |
FAKER_CXX_EXPORT std::string faker::date::birthdateByAge | ( | int | minAge = 18, |
int | maxAge = 80, | ||
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random birthdate by age.
minAge | The minimum age to generate a birthdate. Defaults to `18`. |
maxAge | The maximum age to generate a birthdate. Defaults to `80`. |
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT std::string faker::date::birthdateByYear | ( | int | minYear = 1920, |
int | maxYear = 2000, | ||
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random birthdate by year.
minYear | The minimum year to generate a birthdate. Defaults to `1920`. |
maxYear | The maximum year to generate a birthdate. Defaults to `2000`. |
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT unsigned faker::date::dayOfMonth | ( | ) |
FAKER_CXX_EXPORT unsigned faker::date::dayOfWeek | ( | ) |
FAKER_CXX_EXPORT std::string faker::date::futureDate | ( | int | years = 1, |
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random date in the future.
years | The range of years the date may be in the future. Defaults to `1`. |
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT unsigned faker::date::hour | ( | ) |
FAKER_CXX_EXPORT unsigned faker::date::minute | ( | ) |
FAKER_CXX_EXPORT unsigned faker::date::month | ( | ) |
FAKER_CXX_EXPORT std::string_view faker::date::monthAbbreviatedName | ( | ) |
Returns an abbreviated name of random month.
FAKER_CXX_EXPORT std::string_view faker::date::monthName | ( | ) |
Returns a random name of a month.
FAKER_CXX_EXPORT std::string faker::date::pastDate | ( | int | years = 1, |
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random date in the past.
years | The range of years the date may be in the past. Defaults to `1`. |
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT std::string faker::date::recentDate | ( | int | days = 3, |
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random date in the recent past.
days | The range of days the date may be in the past. Defaults to `3`. |
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT unsigned faker::date::second | ( | ) |
FAKER_CXX_EXPORT std::string faker::date::soonDate | ( | int | days = 3, |
DateFormat | dateFormat = DateFormat::ISO ) |
Generates a random date in the soon future.
days | The range of days the date may be in the future. Defaults to `3`. |
dateFormat | Specifies the format of the output date. Defaults to `DateFormatISO`. |
FAKER_CXX_EXPORT std::string faker::date::time | ( | ) |
FAKER_CXX_EXPORT std::string_view faker::date::timezoneRandom | ( | ) |
Returns random timezone.
FAKER_CXX_EXPORT std::string_view faker::date::weekdayAbbreviatedName | ( | ) |
Returns an abbreviated name of random day of the week.
FAKER_CXX_EXPORT std::string_view faker::date::weekdayName | ( | ) |
Returns a name of random day of the week.
FAKER_CXX_EXPORT unsigned faker::date::year | ( | ) |