From ec9c6f1bbdfd3d86fba493ea56473c0aaf9acad1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 29 Sep 2018 00:12:26 +0300 Subject: Add support for rootless URLs --- libbutl/url.ixx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'libbutl/url.ixx') diff --git a/libbutl/url.ixx b/libbutl/url.ixx index 2feb347..7a6d86f 100644 --- a/libbutl/url.ixx +++ b/libbutl/url.ixx @@ -4,6 +4,28 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. { + // url_traits + // + template + inline typename url_traits::path_type url_traits:: + translate_path (string_type&& path) + { + return path_type (basic_url::decode (path)); + } + + template + inline typename url_traits::string_type url_traits:: + translate_path (const path_type& path) + { + using url = basic_url; + + return url::encode ( + string_type (path), + [] (typename url::char_type& c) {return !url::path_char (c);}); + } + + // basic_url + // template inline basic_url:: basic_url (scheme_type s, @@ -81,4 +103,18 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. std::move (f)) { } + + template + inline basic_url:: + basic_url (scheme_type s, + optional p, + optional q, + optional f) + : scheme (std::move (s)), + path (std::move (p)), + query (std::move (q)), + fragment (std::move (f)), + rootless (true) + { + } } -- cgit v1.1