|
1 | 1 | #ifndef BOOST_NETWORK_URL_BASIC_URL_
|
2 | 2 | #define BOOST_NETWORK_URL_BASIC_URL_
|
3 | 3 |
|
4 |
| -// Copyright 2009 Dean Michael Berris. |
| 4 | +// Copyright 2009 Dean Michael Berris, Jeroen Habraken. |
5 | 5 | // Distributed under the Boost Software License, Version 1.0.
|
6 | 6 | // (See accompanying file LICENSE_1_0.txt or copy at
|
7 | 7 | // http://www.boost.org/LICENSE_1_0.txt)
|
8 | 8 |
|
9 |
| -#include <boost/fusion/adapted/std_pair.hpp> |
10 | 9 | #include <boost/range.hpp>
|
11 | 10 |
|
12 | 11 | #include <boost/network/tags.hpp>
|
@@ -45,17 +44,38 @@ namespace boost { namespace network { namespace uri {
|
45 | 44 |
|
46 | 45 | void swap(uri_base & other) {
|
47 | 46 | using std::swap;
|
| 47 | + |
48 | 48 | swap(other.raw_, raw_);
|
49 | 49 | swap(other.parts_, parts_);
|
50 | 50 | swap(other.valid_, valid_);
|
51 | 51 | }
|
52 | 52 |
|
53 |
| - string_type protocol() const { |
| 53 | + string_type scheme() const { |
54 | 54 | return parts_.scheme;
|
55 | 55 | }
|
56 | 56 |
|
57 |
| - string_type rest() const { |
58 |
| - return parts_.scheme_specific_part; |
| 57 | + string_type user_info() const { |
| 58 | + return parts_.user_info ? *parts_.user_info : string_type(); |
| 59 | + } |
| 60 | + |
| 61 | + string_type host() const { |
| 62 | + return parts_.host ? *parts_.host : string_type(); |
| 63 | + } |
| 64 | + |
| 65 | + uint16_t port() const { |
| 66 | + return parts_.port ? *parts_.port : 0; |
| 67 | + } |
| 68 | + |
| 69 | + string_type path() const { |
| 70 | + return parts_.path; |
| 71 | + } |
| 72 | + |
| 73 | + string_type query() const { |
| 74 | + return parts_.query ? *parts_.query : string_type(); |
| 75 | + } |
| 76 | + |
| 77 | + string_type fragment() const { |
| 78 | + return parts_.fragment ? *parts_.fragment : string_type(); |
59 | 79 | }
|
60 | 80 |
|
61 | 81 | bool valid() const {
|
@@ -97,15 +117,50 @@ namespace boost { namespace network { namespace uri {
|
97 | 117 | template <class Tag>
|
98 | 118 | inline
|
99 | 119 | typename string<Tag>::type
|
100 |
| - protocol(basic_uri<Tag> const & uri) { |
101 |
| - return uri.protocol(); |
| 120 | + scheme(basic_uri<Tag> const & uri) { |
| 121 | + return uri.scheme(); |
102 | 122 | }
|
103 | 123 |
|
104 | 124 | template <class Tag>
|
105 |
| - inline |
106 |
| - typename string<Tag>::type |
107 |
| - rest(basic_uri<Tag> const & uri) { |
108 |
| - return uri.rest(); |
| 125 | + inline |
| 126 | + typename string<Tag>::type |
| 127 | + user_info(basic_uri<Tag> const & uri) { |
| 128 | + return uri.user_info(); |
| 129 | + } |
| 130 | + |
| 131 | + template <class Tag> |
| 132 | + inline |
| 133 | + typename string<Tag>::type |
| 134 | + host(basic_uri<Tag> const & uri) { |
| 135 | + return uri.host(); |
| 136 | + } |
| 137 | + |
| 138 | + template <class Tag> |
| 139 | + inline |
| 140 | + uint16_t |
| 141 | + port(basic_uri<Tag> const & uri) { |
| 142 | + return uri.port(); |
| 143 | + } |
| 144 | + |
| 145 | + template <class Tag> |
| 146 | + inline |
| 147 | + typename string<Tag>::type |
| 148 | + path(basic_uri<Tag> const & uri) { |
| 149 | + return uri.path(); |
| 150 | + } |
| 151 | + |
| 152 | + template <class Tag> |
| 153 | + inline |
| 154 | + typename string<Tag>::type |
| 155 | + query(basic_uri<Tag> const & uri) { |
| 156 | + return uri.query(); |
| 157 | + } |
| 158 | + |
| 159 | + template <class Tag> |
| 160 | + inline |
| 161 | + typename string<Tag>::type |
| 162 | + fragment(basic_uri<Tag> const & uri) { |
| 163 | + return uri.fragment(); |
109 | 164 | }
|
110 | 165 |
|
111 | 166 | template <class Tag>
|
|
0 commit comments