diff --git a/uri.cpp b/uri.cpp index d7bab44b..9bb2bf8a 100644 --- a/uri.cpp +++ b/uri.cpp @@ -128,18 +128,16 @@ uri::set (component c, std::string_view val) //----------------------------------------------------------------------------- -void uri::clear (component const c) +void uri::clear_fragment () { - auto const offset = m_views[c].size (); - for (int i = c + 1; i < component::NUM_COMPONENTS; ++i) - m_views[i] -= offset; + if (!m_views[FRAGMENT]) + return; m_value.erase ( - m_views[c].begin () - m_value.data (), - m_views[c].size () + m_views[FRAGMENT].begin () - m_value.data (), + m_views[FRAGMENT].size () ); - - m_views[c] = nullptr; + m_views[FRAGMENT] = nullptr; } diff --git a/uri.hpp b/uri.hpp index 68d764f0..84eebf68 100644 --- a/uri.hpp +++ b/uri.hpp @@ -100,7 +100,8 @@ namespace cruft { std::string_view query (void) const& { return get (QUERY); } std::string_view fragment (void) const& { return get (FRAGMENT); } - void clear (component); + // void clear (component); + void clear_fragment (void); auto components (void) const& noexcept { return m_views; }