forked from glynos/url
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathexample_11.cpp
More file actions
25 lines (18 loc) · 796 Bytes
/
example_11.cpp
File metadata and controls
25 lines (18 loc) · 796 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
// Copyright 2020 Glyn Matthews.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt of copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include <string_view>
#include <skyr/core/host.hpp>
using namespace std::string_view_literals;
int main() {
auto host_domain = skyr::parse_host("example.com"sv);
std::cout << host_domain.value().serialize() << std::endl;
auto host_ipv4 = skyr::parse_host("192.168.0.1"sv);
std::cout << host_ipv4.value().serialize() << std::endl;
auto host_ipv6 = skyr::parse_host("[2001:0db8:0:0::1428:57ab]"sv);
std::cout << host_ipv6.value().serialize() << std::endl;
auto localhost = skyr::parse_host("localhost"sv);
std::cout << localhost.value().serialize() << std::endl;
}