Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:28

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0006 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // Official repository: https://github.com/boostorg/url
0009 //
0010 
0011 #ifndef BOOST_URL_IMPL_PARAMS_ENCODED_BASE_HPP
0012 #define BOOST_URL_IMPL_PARAMS_ENCODED_BASE_HPP
0013 
0014 #include <boost/url/detail/params_iter_impl.hpp>
0015 
0016 namespace boost {
0017 namespace urls {
0018 
0019 #ifndef BOOST_URL_DOCS
0020 class params_ref;
0021 #endif
0022 
0023 //------------------------------------------------
0024 
0025 class params_encoded_base::iterator
0026 {
0027     detail::params_iter_impl it_;
0028 
0029     friend class params_encoded_base;
0030     friend class params_encoded_ref;
0031 
0032     iterator(detail::query_ref const& ref) noexcept;
0033     iterator(detail::query_ref const& ref, int) noexcept;
0034     iterator(
0035         detail::params_iter_impl const& it)
0036         : it_(it)
0037     {
0038     }
0039 
0040 public:
0041     using value_type =
0042         params_encoded_base::value_type;
0043     using reference =
0044         params_encoded_base::reference;
0045     using pointer = reference;
0046     using difference_type = std::ptrdiff_t;
0047     using iterator_category =
0048         std::bidirectional_iterator_tag;
0049 
0050     iterator() = default;
0051     iterator(iterator const&) = default;
0052     iterator& operator=(
0053         iterator const&) = default;
0054 
0055     iterator&
0056     operator++() noexcept
0057     {
0058         it_.increment();
0059         return *this;
0060     }
0061 
0062     iterator
0063     operator++(int) noexcept
0064     {
0065         auto tmp = *this;
0066         ++*this;
0067         return tmp;
0068     }
0069 
0070     iterator&
0071     operator--() noexcept
0072     {
0073         it_.decrement();
0074         return *this;
0075     }
0076 
0077     iterator
0078     operator--(int) noexcept
0079     {
0080         auto tmp = *this;
0081         --*this;
0082         return tmp;
0083     }
0084 
0085     reference
0086     operator*() const
0087     {
0088         return it_.dereference();
0089     }
0090 
0091     pointer
0092     operator->() const
0093     {
0094         return it_.dereference();
0095     }
0096 
0097     friend
0098     bool
0099     operator==(
0100         iterator const& it0,
0101         iterator const& it1) noexcept
0102     {
0103         return it0.it_.equal(it1.it_);
0104     }
0105 
0106     friend
0107     bool
0108     operator!=(
0109         iterator const& it0,
0110         iterator const& it1) noexcept
0111     {
0112         return ! it0.it_.equal(it1.it_);
0113     }
0114 };
0115 
0116 //------------------------------------------------
0117 //
0118 // Observers
0119 //
0120 //------------------------------------------------
0121 
0122 inline
0123 bool
0124 params_encoded_base::
0125 contains(
0126     pct_string_view key,
0127     ignore_case_param ic) const noexcept
0128 {
0129     return find_impl(
0130         begin().it_, key, ic) != end();
0131 }
0132 
0133 inline
0134 auto
0135 params_encoded_base::
0136 find(
0137     pct_string_view key,
0138     ignore_case_param ic) const noexcept ->
0139         iterator
0140 {
0141     return find_impl(
0142         begin().it_, key, ic);
0143 }
0144 
0145 inline
0146 auto
0147 params_encoded_base::
0148 find(
0149     iterator it,
0150     pct_string_view key,
0151     ignore_case_param ic) const noexcept ->
0152         iterator
0153 {
0154     return find_impl(
0155         it.it_, key, ic);
0156 }
0157 
0158 inline
0159 auto
0160 params_encoded_base::
0161 find_last(
0162     pct_string_view key,
0163     ignore_case_param ic) const noexcept ->
0164         iterator
0165 {
0166     return find_last_impl(
0167         end().it_, key, ic);
0168 }
0169 
0170 inline
0171 auto
0172 params_encoded_base::
0173 find_last(
0174     iterator it,
0175     pct_string_view key,
0176     ignore_case_param ic) const noexcept ->
0177         iterator
0178 {
0179     return find_last_impl(
0180         it.it_, key, ic);
0181 }
0182 
0183 } // urls
0184 } // boost
0185 
0186 #endif