LCOV - code coverage report
Current view: top level - libs/url/src - url_view.cpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 22 23 95.7 %
Date: 2024-02-29 20:02:55 Functions: 4 4 100.0 %

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
       3             : // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
       4             : //
       5             : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       6             : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       7             : //
       8             : // Official repository: https://github.com/boostorg/url
       9             : //
      10             : 
      11             : #ifndef BOOST_URL_IMPL_URL_VIEW_IPP
      12             : #define BOOST_URL_IMPL_URL_VIEW_IPP
      13             : 
      14             : #include <boost/url/detail/config.hpp>
      15             : #include <boost/url/url_view.hpp>
      16             : #include <boost/url/parse.hpp>
      17             : #include <boost/url/detail/except.hpp>
      18             : 
      19             : namespace boost {
      20             : namespace urls {
      21             : 
      22             : namespace detail {
      23             : 
      24             : url_view
      25        3519 : url_impl::
      26             : construct() const noexcept
      27             : {
      28        3519 :     return url_view(*this);
      29             : }
      30             : 
      31             : } // detail
      32             : 
      33             : //------------------------------------------------
      34             : 
      35             : url_view::
      36             : url_view() noexcept = default;
      37             : 
      38         264 : url_view::
      39         264 : url_view(core::string_view s)
      40         264 :     : url_view(parse_uri_reference(s
      41         264 :         ).value(BOOST_URL_POS))
      42             : {
      43         263 : }
      44             : 
      45       15679 : url_view::
      46             : url_view(
      47       15679 :     url_view_base const& u) noexcept
      48       15679 :     : url_view_base(u.impl_)
      49             : {
      50       15679 :     if (u.pi_->from_ == from::url)
      51             :     {
      52         143 :         pi_ = u.pi_;
      53             :     }
      54             :     else
      55             :     {
      56       15536 :         impl_ = u.impl_;
      57       15536 :         pi_ = &impl_;
      58             :     }
      59       15679 : }
      60             : 
      61             : url_view&
      62          13 : url_view::
      63             : operator=(
      64             :     url_view_base const& u) noexcept
      65             : {
      66          13 :     if (pi_ == u.pi_)
      67           1 :         return *this;
      68             : 
      69          12 :     if (u.pi_->from_ == from::url)
      70             :     {
      71           0 :         pi_ = u.pi_;
      72             :     }
      73             :     else
      74             :     {
      75          12 :         impl_ = u.impl_;
      76          12 :         pi_ = &impl_;
      77             :     }
      78          12 :     return *this;
      79             : }
      80             : 
      81             : } // urls
      82             : } // boost
      83             : 
      84             : #endif

Generated by: LCOV version 1.15