forked from ua-parser/uap-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_ua_simple.cpp
More file actions
31 lines (27 loc) · 920 Bytes
/
parse_ua_simple.cpp
File metadata and controls
31 lines (27 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "UaParser.h"
using namespace uap_cpp;
#include <iostream>
#include <string>
using namespace std;
int main(void) {
UserAgentParser p("uap-core/regexes.yaml");
for (string line; getline(cin, line);) {
UserAgent ua = p.parse(line);
cout
<< ua.browser.family << "\t"
<< ua.browser.major << "\t"
<< ua.browser.minor << "\t"
<< ua.browser.patch << "\t"
<< ua.browser.patch_minor << "\t"
<< ua.os.family << "\t"
<< ua.os.major << "\t"
<< ua.os.minor << "\t"
<< ua.os.patch << "\t"
<< ua.os.patch_minor << "\t"
<< ua.device.family << "\t"
<< ua.device.brand << "\t"
<< ua.device.model << "\t"
<< "\n";
}
return 0;
}