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_BASE_HPP
0012 #define BOOST_URL_IMPL_PARAMS_BASE_HPP
0013 
0014 #include <boost/url/detail/params_iter_impl.hpp>
0015 #include <iterator>
0016 
0017 namespace boost {
0018 namespace urls {
0019 
0020 //------------------------------------------------
0021 
0022 class BOOST_URL_DECL params_base::iterator
0023 {
0024     detail::params_iter_impl it_;
0025     bool space_as_plus_ = true;
0026 
0027     friend class params_base;
0028     friend class params_ref;
0029 
0030     iterator(
0031         detail::query_ref const& ref,
0032         encoding_opts opt) noexcept;
0033 
0034     iterator(
0035         detail::query_ref const& impl,
0036         encoding_opts opt,
0037         int) noexcept;
0038 
0039     iterator(
0040         detail::params_iter_impl const& it,
0041         encoding_opts opt) noexcept
0042         : it_(it)
0043         , space_as_plus_(opt.space_as_plus)
0044     {
0045     }
0046 
0047 public:
0048     using value_type = params_base::value_type;
0049     using reference = params_base::reference;
0050     using pointer = reference;
0051     using difference_type =
0052         params_base::difference_type;
0053     using iterator_category =
0054         std::bidirectional_iterator_tag;
0055 
0056     iterator() = default;
0057     iterator(iterator const&) = default;
0058     iterator& operator=(
0059         iterator const&) noexcept = default;
0060 
0061     iterator&
0062     operator++() noexcept
0063     {
0064         it_.increment();
0065         return *this;
0066     }
0067 
0068     iterator
0069     operator++(int) noexcept
0070     {
0071         auto tmp = *this;
0072         ++*this;
0073         return tmp;
0074     }
0075 
0076     iterator&
0077     operator--() noexcept
0078     {
0079         it_.decrement();
0080         return *this;
0081     }
0082 
0083     iterator
0084     operator--(int) noexcept
0085     {
0086         auto tmp = *this;
0087         --*this;
0088         return tmp;
0089     }
0090 
0091     reference
0092     operator*() const;
0093 
0094     // the return value is too expensive
0095     pointer operator->() const = delete;
0096 
0097     bool
0098     operator==(
0099         iterator const& other) const noexcept
0100     {
0101         return it_.equal(other.it_);
0102     }
0103 
0104     bool
0105     operator!=(
0106         iterator const& other) const noexcept
0107     {
0108         return ! it_.equal(other.it_);
0109     }
0110 };
0111 
0112 
0113 } // urls
0114 } // boost
0115 
0116 #endif