forked from boostorg/url
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
1,183 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
// Official repository: https://github.com/CPPAlliance/url | ||
// | ||
|
||
#ifndef BOOST_URL_DETAIL_IMPL_REMOVE_DOT_SEGMENTS_HPP | ||
#define BOOST_URL_DETAIL_IMPL_REMOVE_DOT_SEGMENTS_HPP | ||
|
||
namespace boost { | ||
namespace urls { | ||
namespace detail { | ||
|
||
template<class Allocator> | ||
std::basic_string<char, | ||
std::char_traits<char>, | ||
Allocator> | ||
remove_dot_segments( | ||
string_view s, | ||
Allocator const& a, | ||
bool remove_leading_dot_dot) | ||
{ | ||
using string_type = std::basic_string< | ||
char, | ||
std::char_traits<char>, | ||
Allocator>; | ||
string_type output(s.size(), '_', a); | ||
char* it = &output[0]; | ||
char* end = it + output.size(); | ||
std::size_t n = remove_dot_segments( | ||
it, end, s, remove_leading_dot_dot); | ||
output.resize(n); | ||
return output; | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
#endif |
Oops, something went wrong.