uri: define more constructors

This commit is contained in:
Danny Robson 2017-12-26 17:33:06 +11:00
parent 9704387fdc
commit d86c8b5b2b
2 changed files with 14 additions and 4 deletions

View File

@ -25,7 +25,10 @@
#include <algorithm>
#include <iostream>
using util::uri;
///////////////////////////////////////////////////////////////////////////////
%%{
machine impl;
@ -83,12 +86,18 @@ util::uri::uri (const char *str):
//-----------------------------------------------------------------------------
util::uri::uri (const char *first, const char *last):
uri (std::string (first, last))
uri::uri (util::view<const char *> _value):
uri (std::string (_value.begin (), _value.end ()))
{ ; }
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
uri::uri (const std::string &_value):
uri (std::string (_value))
{ ; }
//-----------------------------------------------------------------------------
static const util::view<const char*> NULL_VIEW { nullptr, nullptr };

View File

@ -41,8 +41,9 @@ namespace util {
class uri {
public:
explicit uri (std::string &&);
explicit uri (const std::string&);
explicit uri (const char *str);
uri (const char *first, const char *last);
explicit uri (util::view<const char *>);
class parse_error : public std::runtime_error
{ using runtime_error::runtime_error; };