uri: add minimal copy and move operators
This commit is contained in:
parent
5685f1ebb1
commit
a1460a240f
20
uri.cpp
20
uri.cpp
@ -23,6 +23,26 @@ uri::uri (const std::string &_value):
|
||||
{ ; }
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
uri::uri (uri const &rhs)
|
||||
: m_views (rhs.m_views)
|
||||
, m_value (rhs.m_value)
|
||||
{
|
||||
auto const offset = rhs.m_value.data () - m_value.data ();
|
||||
for (auto &i: m_views)
|
||||
i = { i.begin () - offset, i.end () - offset };
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
uri& uri::operator= (uri &&rhs) noexcept
|
||||
{
|
||||
m_views = std::move (rhs.m_views);
|
||||
m_value = std::move (rhs.m_value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static uint8_t
|
||||
hex_to_uint (char c)
|
||||
|
6
uri.hpp
6
uri.hpp
@ -33,10 +33,16 @@ namespace cruft {
|
||||
class uri {
|
||||
public:
|
||||
uri (std::string &&);
|
||||
uri& operator= (uri &&) noexcept;
|
||||
|
||||
uri (uri const&);
|
||||
uri& operator= (uri const&);
|
||||
|
||||
uri (const std::string&);
|
||||
uri (const char *);
|
||||
uri (view<const char *>);
|
||||
|
||||
|
||||
class parse_error : public std::runtime_error
|
||||
{ using runtime_error::runtime_error; };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user