|
Device Generator 1.0.3
Devices, browsers, user agents and IP addresses that fit together for C++23
|
Return type for device generation. More...
#include <devicegen.hpp>
Public Member Functions | |
| std::uint64_t | seed () const |
| Retrieve the random seed used to generate this device. | |
| const core::seed_signature & | signature () const |
| The seed and the data this device was generated from. | |
| std::string | to_string () const |
| Human-readable summary string. | |
| void | to_json (core::json_writer &w) const |
| Write this device as a JSON object. | |
| std::string | to_json () const |
| This device as a JSON document. | |
| operator std::string () const | |
| Implicit conversion to std::string. | |
Static Public Member Functions | |
| static std::string | browser_name (std::string_view key) |
The display name of a browser key (chrome gives Chrome). | |
Public Attributes | |
| std::string | country_code |
| ISO 3166-1 alpha-2 code. | |
| std::string | platform |
Platform key (android-phone, ...). | |
| std::string | platform_label |
| Display label of the platform. | |
| std::string | kind |
phone, tablet, desktop or other. | |
| std::string | maker |
Maker (Samsung, Apple, Lenovo); may be empty. | |
| std::string | model |
Model name (Galaxy A54); empty for most desktops. | |
| std::string | os |
Operating system (Android, iOS, Windows, ...). | |
| std::string | os_version |
OS version (14, 17.5, 10.15); empty where none is modelled. | |
| std::string | browser |
Browser key (chrome, safari, ...); empty for other. | |
| std::string | browser_version |
Browser version (126, 17.5, 25.0). | |
| std::string | engine |
Blink, WebKit or Gecko. | |
| std::string | user_agent |
The User-Agent header this device sends. | |
| std::string | accept_language |
The Accept-Language header; empty without a locale. | |
| std::string | sec_ch_ua |
The Sec-CH-UA client hint (Chrome and Edge 96 and later, not on iOS); empty otherwise. | |
| std::string | sec_ch_ua_mobile |
The Sec-CH-UA-Mobile client hint (?1 on phones, ?0 otherwise); empty when not sent. | |
| std::string | sec_ch_ua_platform |
The Sec-CH-UA-Platform client hint ("Android", "Windows", ...); empty when not sent. | |
| device_screen | screen |
| The screen. | |
| std::string | ip |
| IP address (dotted quad or RFC 5952 text). | |
| int | ip_version {4} |
| 4 or 6. | |
| bool | reserved {false} |
| The address is from a documentation range. | |
Friends | |
| class | dvg |
| std::ostream & | operator<< (std::ostream &os, const device &v) |
| Stream the summary to an output stream. | |
Return type for device generation.
Supports implicit conversion to std::string (a one-line summary), streaming via operator<< and JSON output via to_json().
Definition at line 133 of file devicegen.hpp.
|
inlinestatic |
The display name of a browser key (chrome gives Chrome).
| key | A browser key. |
Definition at line 252 of file devicegen.hpp.
|
inline |
Implicit conversion to std::string.
Definition at line 234 of file devicegen.hpp.
|
inline |
Retrieve the random seed used to generate this device.
Definition at line 160 of file devicegen.hpp.
|
inline |
The seed and the data this device was generated from.
data is dvg::data_hash() at the time of generation. Definition at line 165 of file devicegen.hpp.
|
inline |
|
inline |
Write this device as a JSON object.
| w | Writer positioned where a value is allowed. |
Definition at line 187 of file devicegen.hpp.
|
inline |
Human-readable summary string.
Chrome 126 on Android 14 (Samsung Galaxy A54), 203.0.113.7. Definition at line 169 of file devicegen.hpp.
|
friend |
Definition at line 266 of file devicegen.hpp.
|
friend |
Stream the summary to an output stream.
| os | Output stream. |
| v | The device to stream. |
Definition at line 243 of file devicegen.hpp.
| std::string dasmig::device::accept_language |
The Accept-Language header; empty without a locale.
Definition at line 148 of file devicegen.hpp.
| std::string dasmig::device::browser |
Browser key (chrome, safari, ...); empty for other.
Definition at line 144 of file devicegen.hpp.
| std::string dasmig::device::browser_version |
Browser version (126, 17.5, 25.0).
Definition at line 145 of file devicegen.hpp.
| std::string dasmig::device::country_code |
ISO 3166-1 alpha-2 code.
Definition at line 136 of file devicegen.hpp.
| std::string dasmig::device::engine |
Blink, WebKit or Gecko.
Definition at line 146 of file devicegen.hpp.
| std::string dasmig::device::ip |
IP address (dotted quad or RFC 5952 text).
Definition at line 153 of file devicegen.hpp.
| int dasmig::device::ip_version {4} |
4 or 6.
Definition at line 154 of file devicegen.hpp.
| std::string dasmig::device::kind |
phone, tablet, desktop or other.
Definition at line 139 of file devicegen.hpp.
| std::string dasmig::device::maker |
Maker (Samsung, Apple, Lenovo); may be empty.
Definition at line 140 of file devicegen.hpp.
| std::string dasmig::device::model |
Model name (Galaxy A54); empty for most desktops.
Definition at line 141 of file devicegen.hpp.
| std::string dasmig::device::os |
Operating system (Android, iOS, Windows, ...).
Definition at line 142 of file devicegen.hpp.
| std::string dasmig::device::os_version |
OS version (14, 17.5, 10.15); empty where none is modelled.
Definition at line 143 of file devicegen.hpp.
| std::string dasmig::device::platform |
Platform key (android-phone, ...).
Definition at line 137 of file devicegen.hpp.
| std::string dasmig::device::platform_label |
Display label of the platform.
Definition at line 138 of file devicegen.hpp.
| bool dasmig::device::reserved {false} |
The address is from a documentation range.
Definition at line 155 of file devicegen.hpp.
| device_screen dasmig::device::screen |
The screen.
Definition at line 152 of file devicegen.hpp.
| std::string dasmig::device::sec_ch_ua |
The Sec-CH-UA client hint (Chrome and Edge 96 and later, not on iOS); empty otherwise.
Definition at line 149 of file devicegen.hpp.
| std::string dasmig::device::sec_ch_ua_mobile |
The Sec-CH-UA-Mobile client hint (?1 on phones, ?0 otherwise); empty when not sent.
Definition at line 150 of file devicegen.hpp.
| std::string dasmig::device::sec_ch_ua_platform |
The Sec-CH-UA-Platform client hint ("Android", "Windows", ...); empty when not sent.
Definition at line 151 of file devicegen.hpp.
| std::string dasmig::device::user_agent |
The User-Agent header this device sends.
Definition at line 147 of file devicegen.hpp.