|
Device Generator 1.0.3
Devices, browsers, user agents and IP addresses that fit together for C++23
|
What a device call asks for. More...
#include <devicegen.hpp>
Public Attributes | |
| std::optional< std::string > | country {} |
| ISO 3166-1 alpha-2 code (any case). Unset draws a country by its number of internet users. | |
| std::optional< std::string > | platform {} |
A platform key (android-phone, ios-phone, windows-desktop, ...; user-generator's keys). Fixes the kind and the OS; unset draws one by the country's shares. | |
| std::optional< device_kind > | kind {} |
| Narrow the platform draw to one kind. Ignored when it agrees with a given platform; an error when it does not. | |
| std::optional< std::string > | browser {} |
Force a browser by key (chrome, safari, edge, firefox, samsung, opera, yandex). The platform, when drawn, is one that has it. | |
| std::string | locale {} |
A BCP 47 locale (pt-BR, pt_BR, zh-Hant-TW: a language of 2 to 8 letters, then subtags of 1 to 8 letters or digits, at most 35 characters) for the Accept-Language header; empty leaves the header empty. | |
| std::chrono::year_month_day | reference_date {default_reference_date} |
| The date the device is seen at: models, OS and browser versions are those of that date. Must not be before earliest_reference_date; a date after the data's newest release is seen as that release's date. | |
| ip_version | ip {ip_version::any} |
| The IP family. | |
| bool | safe {false} |
| Give an address from the documentation ranges (RFC 5737, RFC 3849) instead of a registered one. | |
| bool | weighted {true} |
| Draw by the data's shares (true) or uniformly among what is possible (false). | |
Static Public Attributes | |
| static constexpr std::chrono::year_month_day | default_reference_date |
| The default reference date, 2023-07-01 (birth-generator's and user-generator's); the library never reads the clock. | |
| static constexpr std::chrono::year_month_day | earliest_reference_date |
| The earliest reference date the data covers. | |
What a device call asks for.
Every generation call takes one; device_request{} asks for the defaults. Choices are never stored on the generator, so one call cannot change the next.
Definition at line 68 of file devicegen.hpp.
| std::optional<std::string> dasmig::device_request::browser {} |
Force a browser by key (chrome, safari, edge, firefox, samsung, opera, yandex). The platform, when drawn, is one that has it.
Definition at line 95 of file devicegen.hpp.
| std::optional<std::string> dasmig::device_request::country {} |
ISO 3166-1 alpha-2 code (any case). Unset draws a country by its number of internet users.
Definition at line 81 of file devicegen.hpp.
|
staticconstexpr |
The default reference date, 2023-07-01 (birth-generator's and user-generator's); the library never reads the clock.
Definition at line 72 of file devicegen.hpp.
|
staticconstexpr |
The earliest reference date the data covers.
Definition at line 76 of file devicegen.hpp.
| ip_version dasmig::device_request::ip {ip_version::any} |
The IP family.
Definition at line 110 of file devicegen.hpp.
| std::optional<device_kind> dasmig::device_request::kind {} |
Narrow the platform draw to one kind. Ignored when it agrees with a given platform; an error when it does not.
Definition at line 90 of file devicegen.hpp.
| std::string dasmig::device_request::locale {} |
A BCP 47 locale (pt-BR, pt_BR, zh-Hant-TW: a language of 2 to 8 letters, then subtags of 1 to 8 letters or digits, at most 35 characters) for the Accept-Language header; empty leaves the header empty.
Definition at line 101 of file devicegen.hpp.
| std::optional<std::string> dasmig::device_request::platform {} |
A platform key (android-phone, ios-phone, windows-desktop, ...; user-generator's keys). Fixes the kind and the OS; unset draws one by the country's shares.
Definition at line 86 of file devicegen.hpp.
| std::chrono::year_month_day dasmig::device_request::reference_date {default_reference_date} |
The date the device is seen at: models, OS and browser versions are those of that date. Must not be before earliest_reference_date; a date after the data's newest release is seen as that release's date.
Definition at line 107 of file devicegen.hpp.
| bool dasmig::device_request::safe {false} |
Give an address from the documentation ranges (RFC 5737, RFC 3849) instead of a registered one.
Definition at line 114 of file devicegen.hpp.
| bool dasmig::device_request::weighted {true} |
Draw by the data's shares (true) or uniformly among what is possible (false).
Definition at line 118 of file devicegen.hpp.