From d86c8b5b2b3d822fe2245d00b5424e7c6304ef54 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 26 Dec 2017 17:33:06 +1100 Subject: [PATCH] uri: define more constructors --- uri.cpp.rl | 15 ++++++++++++--- uri.hpp | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/uri.cpp.rl b/uri.cpp.rl index 759f4153..ad188a3c 100644 --- a/uri.cpp.rl +++ b/uri.cpp.rl @@ -25,7 +25,10 @@ #include #include +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 _value): + uri (std::string (_value.begin (), _value.end ())) { ; } -/////////////////////////////////////////////////////////////////////////////// +//----------------------------------------------------------------------------- +uri::uri (const std::string &_value): + uri (std::string (_value)) +{ ; } + + +//----------------------------------------------------------------------------- static const util::view NULL_VIEW { nullptr, nullptr }; diff --git a/uri.hpp b/uri.hpp index efee4747..dc12910e 100644 --- a/uri.hpp +++ b/uri.hpp @@ -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); class parse_error : public std::runtime_error { using runtime_error::runtime_error; };