@@ -149,7 +149,7 @@ void uri::initialize(optional<string_type> scheme,
149149 }
150150
151151 if (path) {
152- uri_parts_.hier_part .path = detail::copy_part (*path, it);
152+ uri_parts_.hier_part .path = detail::copy_part (*path, it);
153153 }
154154
155155 if (query) {
@@ -174,9 +174,10 @@ uri::uri(const uri_builder &builder) {
174174 builder.path_ , builder.query_ , builder.fragment_ );
175175}
176176
177- uri::uri (uri &&other) noexcept : uri_(std::move(other.uri_)),
178- uri_view_ (uri_),
179- uri_parts_(std::move(other.uri_parts_)) {
177+ uri::uri (uri &&other) noexcept
178+ : uri_(std::move(other.uri_)),
179+ uri_view_ (uri_),
180+ uri_parts_(std::move(other.uri_parts_)) {
180181 detail::advance_parts (uri_view_, uri_parts_, other.uri_parts_ );
181182 other.uri_ .clear ();
182183 other.uri_view_ = string_view (other.uri_ );
@@ -220,9 +221,8 @@ bool uri::has_user_info() const noexcept {
220221}
221222
222223uri::string_view uri::user_info () const noexcept {
223- return has_user_info ()
224- ? to_string_view (uri_, *uri_parts_.hier_part .user_info )
225- : string_view{};
224+ return has_user_info () ? to_string_view (uri_, *uri_parts_.hier_part .user_info )
225+ : string_view{};
226226}
227227
228228bool uri::has_host () const noexcept {
@@ -263,50 +263,48 @@ uri::string_view uri::query() const noexcept {
263263uri::query_iterator::query_iterator () : query_{}, kvp_{} {}
264264
265265uri::query_iterator::query_iterator (optional<detail::uri_part> query)
266- : query_(query)
267- , kvp_{} {
266+ : query_(query), kvp_{} {
268267 if (query_ && query_->empty ()) {
269268 query_ = nullopt ;
270- }
271- else {
269+ } else {
272270 assign_kvp ();
273271 }
274272}
275273
276274uri::query_iterator::query_iterator (const query_iterator &other)
277- : query_(other.query_)
278- , kvp_(other.kvp_) {}
275+ : query_(other.query_), kvp_(other.kvp_) {}
279276
280- uri::query_iterator &uri::query_iterator::operator = (const query_iterator &other) {
277+ uri::query_iterator &uri::query_iterator::operator =(
278+ const query_iterator &other) {
281279 auto tmp (other);
282280 swap (tmp);
283281 return *this ;
284282}
285283
286- uri::query_iterator::reference uri::query_iterator::operator ++ () noexcept {
284+ uri::query_iterator::reference uri::query_iterator::operator ++ () noexcept {
287285 increment ();
288286 return kvp_;
289287}
290288
291- uri::query_iterator::value_type uri::query_iterator::operator ++ (int ) noexcept {
289+ uri::query_iterator::value_type uri::query_iterator::operator ++ (int ) noexcept {
292290 auto original = kvp_;
293291 increment ();
294292 return original;
295293}
296294
297- uri::query_iterator::reference uri::query_iterator::operator * () const noexcept {
295+ uri::query_iterator::reference uri::query_iterator::operator * () const noexcept {
298296 return kvp_;
299297}
300298
301- uri::query_iterator::pointer uri::query_iterator::operator -> () const noexcept {
299+ uri::query_iterator::pointer uri::query_iterator::operator -> () const noexcept {
302300 return std::addressof (kvp_);
303301}
304302
305- bool uri::query_iterator::operator ==(const query_iterator &other) const noexcept {
303+ bool uri::query_iterator::operator ==(const query_iterator &other) const
304+ noexcept {
306305 if (!query_ && !other.query_ ) {
307306 return true ;
308- }
309- else if (query_ && other.query_ ) {
307+ } else if (query_ && other.query_ ) {
310308 // since we're comparing substrings, the address of the first
311309 // element in each iterator must be the same
312310 return std::addressof (kvp_.first ) == std::addressof (other.kvp_ .first );
@@ -326,7 +324,7 @@ void uri::query_iterator::advance_to_next_kvp() noexcept {
326324 first, last, [](char c) -> bool { return c == ' &' || c == ' ;' ; });
327325
328326 if (sep_it != last) {
329- ++sep_it; // skip next separator
327+ ++sep_it; // skip next separator
330328 }
331329
332330 // reassign query to the next element
@@ -343,9 +341,10 @@ void uri::query_iterator::assign_kvp() noexcept {
343341
344342 kvp_.first = string_view (std::addressof (*first), std::distance (first, eq_it));
345343 if (eq_it != sep_it) {
346- ++eq_it; // skip '=' symbol
344+ ++eq_it; // skip '=' symbol
347345 }
348- kvp_.second = string_view (std::addressof (*eq_it), std::distance (eq_it, sep_it));
346+ kvp_.second =
347+ string_view (std::addressof (*eq_it), std::distance (eq_it, sep_it));
349348}
350349
351350void uri::query_iterator::increment () noexcept {
@@ -362,7 +361,8 @@ void uri::query_iterator::increment() noexcept {
362361}
363362
364363uri::query_iterator uri::query_begin () const noexcept {
365- return has_query ()? uri::query_iterator{uri_parts_.query } : uri::query_iterator{};
364+ return has_query () ? uri::query_iterator{uri_parts_.query }
365+ : uri::query_iterator{};
366366}
367367
368368uri::query_iterator uri::query_end () const noexcept {
@@ -378,9 +378,7 @@ uri::string_view uri::fragment() const noexcept {
378378 : string_view{};
379379}
380380
381- bool uri::has_authority () const noexcept {
382- return has_host ();
383- }
381+ bool uri::has_authority () const noexcept { return has_host (); }
384382
385383uri::string_view uri::authority () const noexcept {
386384 if (!has_host ()) {
@@ -402,26 +400,22 @@ uri::string_view uri::authority() const noexcept {
402400 auto first = std::begin (host), last = std::end (host);
403401 if (has_user_info () && !user_info.empty ()) {
404402 first = std::begin (user_info);
405- }
406- else if (host.empty () && has_port () && !port.empty ()) {
403+ } else if (host.empty () && has_port () && !port.empty ()) {
407404 first = std::begin (port);
408- --first; // include ':' before port
405+ --first; // include ':' before port
409406 }
410407
411408 if (host.empty ()) {
412409 if (has_port () && !port.empty ()) {
413410 last = std::end (port);
414- }
415- else if (has_user_info () && !user_info.empty ()) {
411+ } else if (has_user_info () && !user_info.empty ()) {
416412 last = std::end (user_info);
417- ++last; // include '@'
413+ ++last; // include '@'
418414 }
419- }
420- else if (has_port ()) {
415+ } else if (has_port ()) {
421416 if (port.empty ()) {
422- ++last; // include ':' after host
423- }
424- else {
417+ ++last; // include ':' after host
418+ } else {
425419 last = std::end (port);
426420 }
427421 }
@@ -443,9 +437,7 @@ std::u32string uri::u32string() const {
443437 return std::u32string (std::begin (*this ), std::end (*this ));
444438}
445439
446- uri::string_view uri::view () const noexcept {
447- return uri_view_;
448- }
440+ uri::string_view uri::view () const noexcept { return uri_view_; }
449441
450442bool uri::empty () const noexcept { return uri_.empty (); }
451443
@@ -473,13 +465,15 @@ uri uri::normalize(uri_comparison_level level) const {
473465
474466 // if (parts.hier_part.host) {
475467 // std::string::iterator first, last;
476- // std::tie(first, last) = mutable_part(normalized, *parts.hier_part.host);
477- // std::transform(first, last, first,
478- // [](char ch) { return std::tolower(ch, std::locale()); });
468+ // std::tie(first, last) = mutable_part(normalized,
469+ // *parts.hier_part.host); std::transform(first, last, first,
470+ // [](char ch) { return std::tolower(ch, std::locale());
471+ // });
479472 // }
480473
481474 // ...except when used in percent encoding
482- detail::for_each (normalized, detail::percent_encoded_to_upper<std::string>());
475+ detail::for_each (normalized,
476+ detail::percent_encoded_to_upper<std::string>());
483477
484478 // parts are invalidated here
485479 // there's got to be a better way of doing this that doesn't
@@ -490,7 +484,8 @@ uri uri::normalize(uri_comparison_level level) const {
490484 normalized_view = string_view (normalized);
491485
492486 // need to parse the parts again as the underlying string has changed
493- const_iterator it = std::begin (normalized_view), last = std::end (normalized_view);
487+ const_iterator it = std::begin (normalized_view),
488+ last = std::end (normalized_view);
494489 bool is_valid = detail::parse (it, last, parts);
495490 ignore (is_valid);
496491 assert (is_valid);
@@ -550,9 +545,9 @@ uri uri::make_relative(const uri &other) const {
550545 }
551546
552547 auto path =
553- detail::normalize_path (this ->path (), uri_comparison_level::syntax_based);
554- auto other_path = detail::normalize_path (other. path (),
555- uri_comparison_level::syntax_based);
548+ detail::normalize_path (this ->path (), uri_comparison_level::syntax_based);
549+ auto other_path =
550+ detail::normalize_path (other. path (), uri_comparison_level::syntax_based);
556551
557552 optional<string_type> query, fragment;
558553 if (other.has_query ()) {
0 commit comments