|
1 | 1 | #ifndef BOOST_NETWORK_URL_BASIC_URL_ |
2 | 2 | #defineBOOST_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 | voidswap(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_typeprotocol()const { |
| 53 | + string_typescheme()const { |
54 | 54 | return parts_.scheme; |
55 | 55 | } |
56 | 56 |
|
57 | | - string_typerest()const { |
58 | | -return parts_.scheme_specific_part; |
| 57 | + string_typeuser_info()const { |
| 58 | +return parts_.user_info ? *parts_.user_info :string_type(); |
| 59 | + } |
| 60 | + |
| 61 | + string_typehost()const { |
| 62 | +return parts_.host ? *parts_.host :string_type(); |
| 63 | + } |
| 64 | + |
| 65 | +uint16_tport()const { |
| 66 | +return parts_.port ? *parts_.port :0; |
| 67 | + } |
| 68 | + |
| 69 | + string_typepath()const { |
| 70 | +return parts_.path; |
| 71 | + } |
| 72 | + |
| 73 | + string_typequery()const { |
| 74 | +return parts_.query ? *parts_.query :string_type(); |
| 75 | + } |
| 76 | + |
| 77 | + string_typefragment()const { |
| 78 | +return parts_.fragment ? *parts_.fragment :string_type(); |
59 | 79 | } |
60 | 80 |
|
61 | 81 | boolvalid()const { |
@@ -97,15 +117,50 @@ namespace boost { namespace network { namespace uri { |
97 | 117 | template<classTag> |
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<classTag> |
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<classTag> |
| 132 | +inline |
| 133 | +typename string<Tag>::type |
| 134 | +host(basic_uri<Tag>const & uri) { |
| 135 | +return uri.host(); |
| 136 | + } |
| 137 | + |
| 138 | +template<classTag> |
| 139 | +inline |
| 140 | +uint16_t |
| 141 | +port(basic_uri<Tag>const & uri) { |
| 142 | +return uri.port(); |
| 143 | + } |
| 144 | + |
| 145 | +template<classTag> |
| 146 | +inline |
| 147 | +typename string<Tag>::type |
| 148 | +path(basic_uri<Tag>const & uri) { |
| 149 | +return uri.path(); |
| 150 | + } |
| 151 | + |
| 152 | +template<classTag> |
| 153 | +inline |
| 154 | +typename string<Tag>::type |
| 155 | +query(basic_uri<Tag>const & uri) { |
| 156 | +return uri.query(); |
| 157 | + } |
| 158 | + |
| 159 | +template<classTag> |
| 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<classTag> |
|