uri: return std::string_view rather than cruft::view
These play better with external APIs
This commit is contained in:
parent
c3c022332b
commit
74675d1e5a
24
uri.hpp
24
uri.hpp
@ -66,25 +66,25 @@ namespace cruft {
|
|||||||
NUM_COMPONENTS
|
NUM_COMPONENTS
|
||||||
};
|
};
|
||||||
|
|
||||||
view<const char*>
|
std::string_view
|
||||||
get (component c) const&
|
get (component c) const&
|
||||||
{
|
{
|
||||||
CHECK_INDEX (c, NUM_COMPONENTS);
|
CHECK_INDEX (c, NUM_COMPONENTS);
|
||||||
return m_views[c];
|
return { m_views[c].data (), m_views[c].size () };
|
||||||
}
|
}
|
||||||
|
|
||||||
cruft::view<const char*> all (void) const& { return cruft::make_view (m_value); }
|
std::string_view all (void) const& { return m_value; }
|
||||||
std::string const& value (void) const& { return m_value; }
|
std::string const& value (void) const& { return m_value; }
|
||||||
|
|
||||||
cruft::view<const char*> scheme (void) const& { return get (SCHEME); }
|
std::string_view scheme (void) const& { return get (SCHEME); }
|
||||||
cruft::view<const char*> heirarchical (void) const& { return get (HIERARCHICAL); }
|
std::string_view heirarchical (void) const& { return get (HIERARCHICAL); }
|
||||||
cruft::view<const char*> authority (void) const& { return get (AUTHORITY); }
|
std::string_view authority (void) const& { return get (AUTHORITY); }
|
||||||
cruft::view<const char*> user (void) const& { return get (USER); }
|
std::string_view user (void) const& { return get (USER); }
|
||||||
cruft::view<const char*> host (void) const& { return get (HOST); }
|
std::string_view host (void) const& { return get (HOST); }
|
||||||
cruft::view<const char*> port (void) const& { return get (PORT); }
|
std::string_view port (void) const& { return get (PORT); }
|
||||||
cruft::view<const char*> path (void) const& { return get (PATH); }
|
std::string_view path (void) const& { return get (PATH); }
|
||||||
cruft::view<const char*> query (void) const& { return get (QUERY); }
|
std::string_view query (void) const& { return get (QUERY); }
|
||||||
cruft::view<const char*> fragment (void) const& { return get (FRAGMENT); }
|
std::string_view fragment (void) const& { return get (FRAGMENT); }
|
||||||
|
|
||||||
auto components (void) const& noexcept { return m_views; }
|
auto components (void) const& noexcept { return m_views; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user