Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main(ctx):
return generate(
# Compilers
[
'gcc >=4.8',
'gcc >=5.0',
'clang >=3.8',
'msvc >=14.1',
'arm64-gcc latest',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
id: cpp-matrix
with:
compilers: |
gcc >=4.8
gcc >=5.0
clang >=3.8
msvc >=14.20
apple-clang *
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ set(BOOST_URL_DEPENDENCIES
Boost::core
Boost::mp11
Boost::optional
Boost::static_assert
Boost::system
Boost::throw_exception
Boost::type_traits
Expand All @@ -76,7 +75,7 @@ if (NOT BOOST_URL_MRDOCS_BUILD)
set(BOOST_URL_UNIT_TEST_LIBRARIES container filesystem unordered)
endif()
if (BOOST_URL_BUILD_EXAMPLES)
set(BOOST_URL_EXAMPLE_LIBRARIES json regex beast)
set(BOOST_URL_EXAMPLE_LIBRARIES json regex beast filesystem)
endif()
endif()
# Complete dependency list
Expand Down
1 change: 0 additions & 1 deletion build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ constant boost_dependencies :
/boost/core//boost_core
/boost/mp11//boost_mp11
/boost/optional//boost_optional
/boost/static_assert//boost_static_assert
/boost/system//boost_system
/boost/type_traits//boost_type_traits
/boost/variant2//boost_variant2 ;
Expand Down
6 changes: 3 additions & 3 deletions doc/library-detail.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ work without exceptions if desired.

Boost.URL is tested with the following compilers:

* clang: 3.8, 4, 5, 6, 7, 8, 9, 10, 11, 12
* gcc: 4.8, 4.9, 5, 6, 7, 8, 9, 10, 11
* msvc: 14.0, 14.1, 14.2, 14.3
* clang: >=3.8
* gcc: >=5
* msvc: >=14

and these architectures: x86, x64, ARM64, S390x

Expand Down
2 changes: 1 addition & 1 deletion example/router/impl/router.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void
router<T>::
insert(core::string_view pattern, U&& v)
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
std::is_same<T, U>::value ||
std::is_convertible<U, T>::value ||
std::is_base_of<T, U>::value);
Expand Down
6 changes: 3 additions & 3 deletions include/boost/url/detail/any_params_iter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <boost/url/param.hpp>
#include <boost/url/pct_string_view.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <cstddef>
#include <iterator>
#include <type_traits>
Expand Down Expand Up @@ -177,7 +177,7 @@ struct params_iter
: any_params_iter
, private params_iter_base
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
std::is_convertible<
typename std::iterator_traits<
FwdIt>::reference,
Expand Down Expand Up @@ -288,7 +288,7 @@ struct params_encoded_iter
: any_params_iter
, private params_encoded_iter_base
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
std::is_convertible<
typename std::iterator_traits<
FwdIt>::reference,
Expand Down
6 changes: 3 additions & 3 deletions include/boost/url/detail/any_segments_iter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define BOOST_URL_DETAIL_ANY_SEGMENTS_ITER_HPP

#include <boost/url/pct_string_view.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <cstddef>
#include <iterator>
#include <type_traits>
Expand Down Expand Up @@ -120,7 +120,7 @@ struct segments_iter
: any_segments_iter
, segments_iter_base
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
std::is_convertible<
typename std::iterator_traits<
FwdIt>::reference,
Expand Down Expand Up @@ -234,7 +234,7 @@ struct segments_encoded_iter
: public any_segments_iter
, public segments_encoded_iter_base
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
std::is_convertible<
typename std::iterator_traits<
FwdIt>::reference,
Expand Down
163 changes: 163 additions & 0 deletions include/boost/url/detail/segments_range.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
//
// Copyright (c) 2025 Alan de Freitas (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/boostorg/url
//

#ifndef BOOST_URL_DETAIL_SEGMENTS_RANGE_HPP
#define BOOST_URL_DETAIL_SEGMENTS_RANGE_HPP

#include <boost/url/detail/config.hpp>
#include <boost/url/detail/url_impl.hpp>
#include <boost/url/segments_base.hpp>
#include <boost/url/segments_encoded_base.hpp>
#include <boost/core/detail/string_view.hpp>
#include <boost/assert.hpp>

namespace boost {
namespace urls {
namespace detail {

struct segments_iter_access
{
static
segments_iter_impl const&
impl(segments_base::iterator const& it) noexcept
{
return it.it_;
}

static
segments_iter_impl const&
impl(segments_encoded_base::iterator const& it) noexcept
{
return it.it_;
}
};

inline
path_ref
make_subref_from_impls(
segments_iter_impl const& first,
segments_iter_impl const& last) noexcept
{
BOOST_ASSERT(first.ref.alias_of(last.ref));
path_ref const& ref = first.ref;

std::size_t const i0 = first.index;
std::size_t const i1 = last.index;
BOOST_ASSERT(i0 <= i1);
std::size_t const nseg = i1 - i0;

bool const absolute = ref.buffer().starts_with('/');

// Empty range
if (nseg == 0)
{
std::size_t off0;
if (i0 == 0)
{
// [begin, begin): don't include the leading '/'
// for absolute, start right after the leading '/';
if (absolute)
{
off0 = 1;
}
// for relative, start at the first segment character.
else
{
off0 = first.pos;
}
}
else
{
// [it, it) in the middle:
// skip the separator before segment i0
off0 = first.pos + 1;
}

core::string_view const sub(ref.data() + off0, 0);
return {sub, 0, 0};
}

// General case: non-empty range
// Start offset
std::size_t off0;
bool include_leading_slash = false;
if (i0 == 0)
{
if (absolute)
{
// include leading '/'
off0 = 0;
include_leading_slash = true;
}
else
{
// relative: start at first segment
off0 = first.pos;
}
}
else
{
// skip slash before segment i0
off0 = first.pos + 1;
}

// End offset
std::size_t off1;
if(i1 == ref.nseg())
{
off1 = ref.size();
}
else
{
// stop before the slash preceding i1
off1 = last.pos;
}

BOOST_ASSERT(off1 >= off0);
core::string_view const sub(ref.data() + off0, off1 - off0);

// Decoded-length:
// sum per-segment decoded lengths + internal '/' + the leading '/'.
std::size_t dn_sum = 0;
{
// copy to iterate
segments_iter_impl cur = first;
for (std::size_t k = 0; k < nseg; ++k)
{
// per-segment decoded length
dn_sum += cur.dn;
cur.increment();
}
// internal '/'s
dn_sum += (nseg - 1);
// leading '/'
if (include_leading_slash)
{
++dn_sum;
}
}

return {sub, dn_sum, nseg};
}

template<class Iter>
inline
path_ref
make_subref(Iter const& first, Iter const& last) noexcept
{
auto const& f = segments_iter_access::impl(first);
auto const& l = segments_iter_access::impl(last);
return make_subref_from_impls(f, l);
}

} // detail
} // urls
} // boost

#endif
2 changes: 1 addition & 1 deletion include/boost/url/grammar/charset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <boost/url/detail/config.hpp>
#include <boost/url/grammar/detail/charset.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <cstdint>
#include <type_traits>
#include <utility>
Expand Down
6 changes: 3 additions & 3 deletions include/boost/url/grammar/impl/range_rule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <boost/url/grammar/recycled.hpp>
#include <boost/core/empty_value.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <exception>
#include <iterator>
#include <new>
Expand Down Expand Up @@ -464,7 +464,7 @@ range(
: s_(s)
, n_(n)
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
sizeof(impl1<R, false>) <=
BufferSize);

Expand All @@ -487,7 +487,7 @@ range(
: s_(s)
, n_(n)
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
sizeof(impl2<R0, R1, false>) <=
BufferSize);

Expand Down
4 changes: 2 additions & 2 deletions include/boost/url/grammar/impl/variant_rule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <boost/url/grammar/error.hpp>
#include <boost/url/grammar/parse.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <cstdint>
#include <type_traits>

Expand Down Expand Up @@ -107,7 +107,7 @@ variant_rule(
Rn const&... rn) noexcept ->
implementation_defined::variant_rule_t<R0, Rn...>
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
mp11::mp_all<
is_rule<R0>,
is_rule<Rn>...>::value);
Expand Down
3 changes: 2 additions & 1 deletion include/boost/url/grammar/optional_rule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/url/error_types.hpp>
#include <boost/url/grammar/type_traits.hpp>
#include <boost/core/empty_value.hpp>
#include <boost/core/static_assert.hpp>
#include <boost/assert.hpp>

namespace boost {
Expand Down Expand Up @@ -88,7 +89,7 @@ optional_rule(
R const& r) ->
implementation_defined::optional_rule_t<R>
{
BOOST_STATIC_ASSERT(grammar::is_rule<R>::value);
BOOST_CORE_STATIC_ASSERT(grammar::is_rule<R>::value);
return { r };
}

Expand Down
2 changes: 1 addition & 1 deletion include/boost/url/grammar/range_rule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <boost/core/detail/string_view.hpp>
#include <boost/url/grammar/parse.hpp>
#include <boost/url/grammar/type_traits.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <cstddef>
#include <iterator>
#include <type_traits>
Expand Down
6 changes: 3 additions & 3 deletions include/boost/url/grammar/tuple_rule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <boost/url/grammar/detail/tuple.hpp>
#include <boost/url/grammar/type_traits.hpp>
#include <boost/mp11/algorithm.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/static_assert.hpp>
#include <boost/core/empty_value.hpp>
#include <tuple>

Expand Down Expand Up @@ -132,7 +132,7 @@ tuple_rule(
implementation_defined::tuple_rule_t<
R0, Rn...>
{
BOOST_STATIC_ASSERT(
BOOST_CORE_STATIC_ASSERT(
mp11::mp_all<
is_rule<R0>,
is_rule<Rn>...>::value);
Expand Down Expand Up @@ -223,7 +223,7 @@ constexpr
BOOST_URL_IMPLEMENTATION_DEFINED(implementation_defined::squelch_rule_t<R>)
squelch( R const& r ) noexcept
{
BOOST_STATIC_ASSERT(is_rule<R>::value);
BOOST_CORE_STATIC_ASSERT(is_rule<R>::value);
return { r };
}

Expand Down
Loading
Loading