diff --git a/example/router/detail/impl/router.cpp b/example/router/detail/impl/router.cpp index 1b6a7393..059cd1be 100644 --- a/example/router/detail/impl/router.cpp +++ b/example/router/detail/impl/router.cpp @@ -47,7 +47,6 @@ class segment_template public: segment_template() = default; - BOOST_URL_DECL bool match(pct_string_view seg) const; @@ -57,7 +56,6 @@ public: return str_; } - BOOST_URL_DECL core::string_view id() const; @@ -140,7 +138,6 @@ struct segment_template_rule_t { using value_type = segment_template; - BOOST_URL_DECL system::result parse( char const*& it, diff --git a/example/router/detail/router.hpp b/example/router/detail/router.hpp index a5fb16e1..308b0881 100644 --- a/example/router/detail/router.hpp +++ b/example/router/detail/router.hpp @@ -35,19 +35,15 @@ public: }; protected: - BOOST_URL_DECL router_base(); - BOOST_URL_DECL virtual ~router_base(); - BOOST_URL_DECL void insert_impl( core::string_view s, any_resource const* v); - BOOST_URL_DECL any_resource const* find_impl( segments_encoded_view path, diff --git a/include/boost/url/authority_view.hpp b/include/boost/url/authority_view.hpp index 738f73ba..cf68220e 100644 --- a/include/boost/url/authority_view.hpp +++ b/include/boost/url/authority_view.hpp @@ -79,7 +79,7 @@ namespace urls { @see @ref parse_authority. */ -class BOOST_SYMBOL_VISIBLE +class BOOST_URL_DECL authority_view : private detail::parts_base { @@ -103,7 +103,6 @@ public: /** Destructor */ - BOOST_URL_DECL virtual ~authority_view(); @@ -119,7 +118,6 @@ public: @par Specification */ - BOOST_URL_DECL authority_view() noexcept; /** Construct from a string. @@ -157,19 +155,16 @@ public: @see @ref parse_authority. */ - BOOST_URL_DECL explicit authority_view(core::string_view s); /** Constructor */ - BOOST_URL_DECL authority_view( authority_view const&) noexcept; /** Assignment */ - BOOST_URL_DECL authority_view& operator=( authority_view const&) noexcept; @@ -304,7 +299,6 @@ public: @ref userinfo. */ - BOOST_URL_DECL bool has_userinfo() const noexcept; @@ -399,7 +393,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL pct_string_view encoded_userinfo() const noexcept; @@ -498,7 +491,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL pct_string_view encoded_user() const noexcept; @@ -540,7 +532,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL bool has_password() const noexcept; @@ -633,7 +624,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL pct_string_view encoded_password() const noexcept; @@ -750,7 +740,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL pct_string_view encoded_host() const noexcept; @@ -865,7 +854,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL pct_string_view encoded_host_address() const noexcept; @@ -905,7 +893,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL ipv4_address host_ipv4_address() const noexcept; @@ -953,7 +940,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL ipv6_address host_ipv6_address() const noexcept; @@ -986,7 +972,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL core::string_view host_ipvfuture() const noexcept; @@ -1069,7 +1054,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL pct_string_view encoded_host_name() const noexcept; @@ -1111,7 +1095,6 @@ public: @ref port, @ref port_number. */ - BOOST_URL_DECL bool has_port() const noexcept; @@ -1147,7 +1130,6 @@ public: @ref has_port, @ref port_number. */ - BOOST_URL_DECL core::string_view port() const noexcept; @@ -1183,7 +1165,6 @@ public: @ref has_port, @ref port. */ - BOOST_URL_DECL std::uint16_t port_number() const noexcept; @@ -1223,7 +1204,6 @@ public: @ref port, @ref port_number. */ - BOOST_URL_DECL pct_string_view encoded_host_and_port() const noexcept; @@ -1249,7 +1229,6 @@ public: @li 6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL int compare(authority_view const& other) const noexcept; diff --git a/include/boost/url/detail/any_params_iter.hpp b/include/boost/url/detail/any_params_iter.hpp index c5a2cce3..0adeec2a 100644 --- a/include/boost/url/detail/any_params_iter.hpp +++ b/include/boost/url/detail/any_params_iter.hpp @@ -124,7 +124,6 @@ struct BOOST_SYMBOL_VISIBLE param_iter : any_params_iter { - BOOST_URL_DECL explicit param_iter( param_view const&) noexcept; @@ -234,7 +233,6 @@ struct BOOST_SYMBOL_VISIBLE param_encoded_iter : any_params_iter { - BOOST_URL_DECL explicit param_encoded_iter( param_pct_view const&) noexcept; diff --git a/include/boost/url/detail/config.hpp b/include/boost/url/detail/config.hpp index ca7770a9..c2980308 100644 --- a/include/boost/url/detail/config.hpp +++ b/include/boost/url/detail/config.hpp @@ -20,20 +20,21 @@ # error unsupported platform #endif -#if defined(BOOST_URL_DOCS) -# define BOOST_URL_DECL +// Determine if compiling as a dynamic library +#if (defined(BOOST_URL_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_URL_STATIC_LINK) +# define BOOST_URL_BUILD_DLL +#endif + +// Set visibility flags +#if !defined(BOOST_URL_BUILD_DLL) +# define BOOST_URL_DECL /* static library */ +#elif defined(BOOST_URL_SOURCE) +# define BOOST_URL_DECL BOOST_SYMBOL_EXPORT /* source: dllexport/visibility */ #else -# if (defined(BOOST_URL_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_URL_STATIC_LINK) -# if defined(BOOST_URL_SOURCE) -# define BOOST_URL_DECL BOOST_SYMBOL_EXPORT -# define BOOST_URL_BUILD_DLL -# else -# define BOOST_URL_DECL BOOST_SYMBOL_IMPORT -# endif -# endif // shared lib -# ifndef BOOST_URL_DECL -# define BOOST_URL_DECL -# endif +# define BOOST_URL_DECL BOOST_SYMBOL_IMPORT /* header: dllimport */ +#endif + +// Set up auto-linker # if !defined(BOOST_URL_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_URL_NO_LIB) # define BOOST_LIB_NAME boost_url # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_URL_DYN_LINK) @@ -41,8 +42,8 @@ # endif # include # endif -#endif +// Set up SSE2 #if ! defined(BOOST_URL_NO_SSE2) && \ ! defined(BOOST_URL_USE_SSE2) # if (defined(_M_IX86) && _M_IX86_FP == 2) || \ @@ -51,6 +52,7 @@ # endif #endif +// constexpr #if BOOST_WORKAROUND( BOOST_GCC_VERSION, <= 72000 ) || \ BOOST_WORKAROUND( BOOST_CLANG_VERSION, <= 35000 ) # define BOOST_URL_CONSTEXPR @@ -73,6 +75,7 @@ # define BOOST_URL_POS (BOOST_CURRENT_LOCATION) #endif +// String token parameters #ifndef BOOST_URL_STRTOK_TPARAM #define BOOST_URL_STRTOK_TPARAM class StringToken = string_token::return_string #endif @@ -83,6 +86,7 @@ #define BOOST_URL_STRTOK_ARG(name) StringToken&& token = {} #endif +// Move #if BOOST_WORKAROUND( BOOST_GCC_VERSION, < 80000 ) || \ BOOST_WORKAROUND( BOOST_CLANG_VERSION, < 30900 ) #define BOOST_URL_RETURN(x) return std::move((x)) @@ -90,18 +94,21 @@ #define BOOST_URL_RETURN(x) return (x) #endif +// Limit tests #ifndef BOOST_URL_MAX_SIZE // we leave room for a null, // and still fit in size_t #define BOOST_URL_MAX_SIZE ((std::size_t(-1))-1) #endif +// noinline attribute #ifdef BOOST_GCC #define BOOST_URL_NO_INLINE [[gnu::noinline]] #else #define BOOST_URL_NO_INLINE #endif +// libstdcxx copy-on-write strings #ifndef BOOST_URL_COW_STRINGS #if defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 60000 || (defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0)) #define BOOST_URL_COW_STRINGS @@ -117,16 +124,17 @@ # error Unknown or unsupported architecture, please open an issue #endif +// deprecated attribute #if defined(BOOST_MSVC) || defined(BOOST_URL_DOCS) #define BOOST_URL_DEPRECATED(msg) #else #define BOOST_URL_DEPRECATED(msg) BOOST_DEPRECATED(msg) #endif +// avoid Boost.TypeTraits for these traits namespace boost { namespace urls { -// avoid some of Boost.TypeTraits for just this template struct make_void { typedef void type; }; template using void_t = typename make_void::type; diff --git a/include/boost/url/detail/params_iter_impl.hpp b/include/boost/url/detail/params_iter_impl.hpp index 24925285..b2a268ea 100644 --- a/include/boost/url/detail/params_iter_impl.hpp +++ b/include/boost/url/detail/params_iter_impl.hpp @@ -19,7 +19,7 @@ namespace boost { namespace urls { namespace detail { -struct params_iter_impl +struct BOOST_URL_DECL params_iter_impl : parts_base { query_ref ref; @@ -37,12 +37,10 @@ struct params_iter_impl params_iter_impl const&) = default; // begin - BOOST_URL_DECL params_iter_impl( query_ref const&) noexcept; // end - BOOST_URL_DECL params_iter_impl( query_ref const&, int) noexcept; @@ -53,9 +51,9 @@ struct params_iter_impl std::size_t, std::size_t) noexcept; void setup() noexcept; - BOOST_URL_DECL void increment() noexcept; - BOOST_URL_DECL void decrement() noexcept; - BOOST_URL_DECL param_pct_view + void increment() noexcept; + void decrement() noexcept; + param_pct_view dereference() const noexcept; pct_string_view key() const noexcept; diff --git a/include/boost/url/detail/url_impl.hpp b/include/boost/url/detail/url_impl.hpp index 8b0373d3..ca600d5f 100644 --- a/include/boost/url/detail/url_impl.hpp +++ b/include/boost/url/detail/url_impl.hpp @@ -31,7 +31,7 @@ constexpr char const* const empty_c_str_ = ""; // This is the private 'guts' of a // url_view, exposed so different parts // of the implementation can work on it. -struct url_impl : parts_base +struct BOOST_URL_DECL url_impl : parts_base { static constexpr @@ -140,7 +140,7 @@ public: // this allows a params to come from a // url_impl or a separate core::string_view -class query_ref +class BOOST_URL_DECL query_ref : private parts_base { url_impl const* impl_ = nullptr; @@ -157,7 +157,6 @@ public: std::size_t nparam ) noexcept; query_ref() = default; - BOOST_URL_DECL query_ref(url_impl const& impl) noexcept; pct_string_view buffer() const noexcept; std::size_t size() const noexcept; // with '?' @@ -186,158 +185,6 @@ public: } }; -//------------------------------------------------ - -// return length of [first, last) -inline -auto -url_impl:: -len( - int first, - int last) const noexcept -> - std::size_t -{ - BOOST_ASSERT(first <= last); - BOOST_ASSERT(last <= id_end); - return offset(last) - offset(first); -} - -// return length of part -inline -auto -url_impl:: -len(int id) const noexcept -> - std::size_t -{ - return id == id_end - ? zero_ - : ( offset(id + 1) - - offset(id) ); -} - -// return offset of id -inline -auto -url_impl:: -offset(int id) const noexcept -> - std::size_t -{ - return - id == id_scheme - ? zero_ - : offset_[id]; -} - -// return id as string -inline -core::string_view -url_impl:: -get(int id) const noexcept -{ - return { - cs_ + offset(id), len(id) }; -} - -// return [first, last) as string -inline -core::string_view -url_impl:: -get(int first, - int last) const noexcept -{ - return { cs_ + offset(first), - offset(last) - offset(first) }; -} - -// return id as pct-string -inline -pct_string_view -url_impl:: -pct_get( - int id) const noexcept -{ - return make_pct_string_view_unsafe( - cs_ + offset(id), - len(id), - decoded_[id]); -} - -// return [first, last) as pct-string -inline -pct_string_view -url_impl:: -pct_get( - int first, - int last) const noexcept -{ - auto const pos = offset(first); - std::size_t n = 0; - for(auto i = first; i < last;) - n += decoded_[i++]; - return make_pct_string_view_unsafe( - cs_ + pos, - offset(last) - pos, - n); -} - -//------------------------------------------------ - -// change id to size n -inline -void -url_impl:: -set_size( - int id, - std::size_t n) noexcept -{ - auto d = n - len(id); - for(auto i = id + 1; - i <= id_end; ++i) - offset_[i] += d; -} - -// trim id to size n, -// moving excess into id+1 -inline -void -url_impl:: -split( - int id, - std::size_t n) noexcept -{ - BOOST_ASSERT(id < id_end - 1); - //BOOST_ASSERT(n <= len(id)); - offset_[id + 1] = offset(id) + n; -} - -// add n to [first, last] -inline -void -url_impl:: -adjust( - int first, - int last, - std::size_t n) noexcept -{ - for(int i = first; - i <= last; ++i) - offset_[i] += n; -} - -// set [first, last) offset -inline -void -url_impl:: -collapse( - int first, - int last, - std::size_t n) noexcept -{ - for(int i = first + 1; - i < last; ++i) - offset_[i] = n; -} - } // detail } // urls diff --git a/include/boost/url/encoding_opts.hpp b/include/boost/url/encoding_opts.hpp index 33bd8a17..d78633bc 100644 --- a/include/boost/url/encoding_opts.hpp +++ b/include/boost/url/encoding_opts.hpp @@ -28,7 +28,7 @@ namespace urls { @ref encoded_size, @ref pct_string_view. */ -struct encoding_opts +struct BOOST_URL_DECL encoding_opts { /** True if spaces encode to and from plus signs @@ -71,11 +71,7 @@ struct encoding_opts encoding_opts( bool space_as_plus_ = false, bool lower_case_ = false, - bool disallow_null_ = false) noexcept - : space_as_plus(space_as_plus_) - , lower_case(lower_case_) - , disallow_null(disallow_null_) - {} + bool disallow_null_ = false) noexcept; #endif }; diff --git a/include/boost/url/grammar/impl/error.hpp b/include/boost/url/grammar/impl/error.hpp index a66efcc1..a92a1cba 100644 --- a/include/boost/url/grammar/impl/error.hpp +++ b/include/boost/url/grammar/impl/error.hpp @@ -39,16 +39,24 @@ struct BOOST_SYMBOL_VISIBLE error_cat_type : system::error_category { - BOOST_URL_DECL const char* name( + BOOST_URL_DECL + const char* name( ) const noexcept override; - BOOST_URL_DECL std::string message( + + BOOST_URL_DECL + std::string message( int) const override; - BOOST_URL_DECL char const* message( + + BOOST_URL_DECL + char const* message( int, char*, std::size_t ) const noexcept override; - BOOST_URL_DECL system::error_condition + + BOOST_URL_DECL + system::error_condition default_error_condition( int code) const noexcept override; + BOOST_SYSTEM_CONSTEXPR error_cat_type() noexcept : error_category(0x0536e50a30f9e9f2) { @@ -59,13 +67,19 @@ struct BOOST_SYMBOL_VISIBLE condition_cat_type : system::error_category { - BOOST_URL_DECL const char* name( + BOOST_URL_DECL + const char* name( ) const noexcept override; - BOOST_URL_DECL std::string message( + + BOOST_URL_DECL + std::string message( int) const override; - BOOST_URL_DECL char const* message( + + BOOST_URL_DECL + char const* message( int, char*, std::size_t ) const noexcept override; + BOOST_SYSTEM_CONSTEXPR condition_cat_type() : error_category(0x0536e50a30f9e9f2) { diff --git a/include/boost/url/impl/error.hpp b/include/boost/url/impl/error.hpp index 23f59d5c..5aea1bf7 100644 --- a/include/boost/url/impl/error.hpp +++ b/include/boost/url/impl/error.hpp @@ -32,16 +32,24 @@ struct BOOST_SYMBOL_VISIBLE error_cat_type : system::error_category { - BOOST_URL_DECL const char* name( + BOOST_URL_DECL + const char* name( ) const noexcept override; - BOOST_URL_DECL std::string message( + + BOOST_URL_DECL + std::string message( int) const override; - BOOST_URL_DECL char const* message( + + BOOST_URL_DECL + char const* message( int, char*, std::size_t ) const noexcept override; - BOOST_URL_DECL system::error_condition + + BOOST_URL_DECL + system::error_condition default_error_condition( int code) const noexcept override; + BOOST_SYSTEM_CONSTEXPR error_cat_type() noexcept : error_category(0xbc15399d7a4ce829) { diff --git a/include/boost/url/impl/params_base.hpp b/include/boost/url/impl/params_base.hpp index 3f2e6c7c..65364231 100644 --- a/include/boost/url/impl/params_base.hpp +++ b/include/boost/url/impl/params_base.hpp @@ -19,7 +19,7 @@ namespace urls { //------------------------------------------------ -class params_base::iterator +class BOOST_URL_DECL params_base::iterator { detail::params_iter_impl it_; bool space_as_plus_ = true; @@ -88,7 +88,6 @@ public: return tmp; } - BOOST_URL_DECL reference operator*() const; @@ -110,84 +109,6 @@ public: } }; -//------------------------------------------------ - -inline -params_base:: -params_base() noexcept - // space_as_plus = true - : opt_(true, false, false) -{ -} - -inline -bool -params_base:: -contains( - core::string_view key, - ignore_case_param ic) const noexcept -{ - return find( - begin(),key, ic) != end(); -} - -inline -auto -params_base:: -find( - core::string_view key, - ignore_case_param ic) const noexcept -> - iterator -{ - return iterator( - find_impl( - begin().it_, key, ic), - opt_); -} - -inline -auto -params_base:: -find( - iterator it, - core::string_view key, - ignore_case_param ic) const noexcept -> - iterator -{ - return iterator( - find_impl( - it.it_, key, ic), - opt_); -} - -inline -auto -params_base:: -find_last( - core::string_view key, - ignore_case_param ic) const noexcept -> - iterator -{ - return iterator( - find_last_impl( - end().it_, key, ic), - opt_); -} - -inline -auto -params_base:: -find_last( - iterator it, - core::string_view key, - ignore_case_param ic) const noexcept -> - iterator -{ - return iterator( - find_last_impl( - it.it_, key, ic), - opt_); -} } // urls } // boost diff --git a/include/boost/url/impl/params_encoded_ref.hpp b/include/boost/url/impl/params_encoded_ref.hpp index b497f4fa..3776641f 100644 --- a/include/boost/url/impl/params_encoded_ref.hpp +++ b/include/boost/url/impl/params_encoded_ref.hpp @@ -126,33 +126,6 @@ insert( FwdIt>::iterator_category{}); } -inline -auto -params_encoded_ref:: -erase( - iterator pos) noexcept -> - iterator -{ - return erase( - pos, - std::next(pos)); -} - -inline -auto -params_encoded_ref:: -erase( - iterator first, - iterator last) noexcept -> - iterator -{ - core::string_view s("", 0); - return u_->edit_params( - first.it_, - last.it_, - detail::query_iter(s)); -} - template auto params_encoded_ref:: diff --git a/include/boost/url/impl/params_ref.hpp b/include/boost/url/impl/params_ref.hpp index b6588973..a2367df6 100644 --- a/include/boost/url/impl/params_ref.hpp +++ b/include/boost/url/impl/params_ref.hpp @@ -166,35 +166,6 @@ insert( FwdIt>::iterator_category{}); } -inline -auto -params_ref:: -erase( - iterator pos) noexcept -> - iterator -{ - return erase( - pos, - std::next(pos)); -} - -inline -auto -params_ref:: -erase( - iterator first, - iterator last) noexcept -> - iterator -{ - core::string_view s("", 0); - return iterator( - u_->edit_params( - first.it_, - last.it_, - detail::query_iter(s)), - opt_); -} - template auto params_ref:: diff --git a/include/boost/url/params_base.hpp b/include/boost/url/params_base.hpp index 579854e8..6f5aac27 100644 --- a/include/boost/url/params_base.hpp +++ b/include/boost/url/params_base.hpp @@ -36,7 +36,7 @@ namespace urls { @li @ref params_encoded_ref @li @ref params_encoded_view */ -class params_base +class BOOST_URL_DECL params_base { friend class url_view_base; friend class params_ref; @@ -46,7 +46,6 @@ class params_base encoding_opts opt_; params_base() noexcept; - BOOST_URL_DECL params_base( detail::query_ref const& ref, encoding_opts opt) noexcept; @@ -173,7 +172,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL pct_string_view buffer() const noexcept; @@ -190,7 +188,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL bool empty() const noexcept; @@ -207,7 +204,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL std::size_t size() const noexcept; @@ -219,7 +215,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL iterator begin() const noexcept; @@ -231,7 +226,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL iterator end() const noexcept; @@ -299,7 +293,6 @@ public: here, the comparison is case-insensitive. */ - BOOST_URL_DECL std::size_t count( core::string_view key, @@ -484,14 +477,12 @@ public: ignore_case_param ic = {}) const noexcept; private: - BOOST_URL_DECL detail::params_iter_impl find_impl( detail::params_iter_impl, core::string_view, ignore_case_param) const noexcept; - BOOST_URL_DECL detail::params_iter_impl find_last_impl( detail::params_iter_impl, diff --git a/include/boost/url/params_encoded_base.hpp b/include/boost/url/params_encoded_base.hpp index 7052af52..e6042e76 100644 --- a/include/boost/url/params_encoded_base.hpp +++ b/include/boost/url/params_encoded_base.hpp @@ -35,7 +35,7 @@ namespace urls { @li @ref params_encoded_ref @li @ref params_encoded_view */ -class params_encoded_base +class BOOST_URL_DECL params_encoded_base { friend class url_view_base; friend class params_encoded_ref; @@ -173,7 +173,6 @@ public: @li Query string (Wikipedia) */ - BOOST_URL_DECL pct_string_view buffer() const noexcept; @@ -190,7 +189,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL bool empty() const noexcept; @@ -207,7 +205,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL std::size_t size() const noexcept; @@ -219,7 +216,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL iterator begin() const noexcept; @@ -231,7 +227,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL iterator end() const noexcept; @@ -306,7 +301,6 @@ public: here, the comparison is case-insensitive. */ - BOOST_URL_DECL std::size_t count( pct_string_view key, @@ -513,14 +507,12 @@ public: ignore_case_param ic = {}) const noexcept; private: - BOOST_URL_DECL detail::params_iter_impl find_impl( detail::params_iter_impl, pct_string_view, ignore_case_param) const noexcept; - BOOST_URL_DECL detail::params_iter_impl find_last_impl( detail::params_iter_impl, diff --git a/include/boost/url/params_encoded_ref.hpp b/include/boost/url/params_encoded_ref.hpp index 2d276123..0f0fbc9a 100644 --- a/include/boost/url/params_encoded_ref.hpp +++ b/include/boost/url/params_encoded_ref.hpp @@ -70,7 +70,7 @@ class params_encoded_view; params and all params after (including `end()`). */ -class params_encoded_ref +class BOOST_URL_DECL params_encoded_ref : public params_encoded_base { friend class url_base; @@ -139,7 +139,6 @@ public: @param other The params to assign. */ - BOOST_URL_DECL params_encoded_ref& operator=( params_encoded_ref const& other); @@ -177,7 +176,6 @@ public: @param init The list of params to assign. */ - BOOST_URL_DECL params_encoded_ref& operator=(std::initializer_list< param_pct_view> init); @@ -190,7 +188,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL operator params_encoded_view() const noexcept; @@ -289,7 +286,6 @@ public: @param init The list of params to assign. */ - BOOST_URL_DECL void assign( std::initializer_list< @@ -472,7 +468,6 @@ public: @param p The param to insert. */ - BOOST_URL_DECL iterator insert( iterator before, @@ -514,7 +509,6 @@ public: @param init The list of params to insert. */ - BOOST_URL_DECL iterator insert( iterator before, @@ -660,7 +654,6 @@ public: here, the comparison is case-insensitive. */ - BOOST_URL_DECL std::size_t erase( pct_string_view key, @@ -709,7 +702,6 @@ public: @param p The param to assign. */ - BOOST_URL_DECL iterator replace( iterator pos, @@ -750,7 +742,6 @@ public: @param init The list of params to assign. */ - BOOST_URL_DECL iterator replace( iterator from, @@ -838,7 +829,6 @@ public: @param pos An iterator to the element. */ - BOOST_URL_DECL iterator unset( iterator pos) noexcept; @@ -886,7 +876,6 @@ public: That is, `has_value` for the element is true. */ - BOOST_URL_DECL iterator set( iterator pos, @@ -959,7 +948,6 @@ public: here, the comparison is case-insensitive. */ - BOOST_URL_DECL iterator set( pct_string_view key, @@ -967,14 +955,12 @@ public: ignore_case_param ic = {}); private: - BOOST_URL_DECL detail::params_iter_impl find_impl( detail::params_iter_impl, pct_string_view, ignore_case_param) const noexcept; - BOOST_URL_DECL detail::params_iter_impl find_last_impl( detail::params_iter_impl, diff --git a/include/boost/url/params_encoded_view.hpp b/include/boost/url/params_encoded_view.hpp index a5db66ae..bef2cf1b 100644 --- a/include/boost/url/params_encoded_view.hpp +++ b/include/boost/url/params_encoded_view.hpp @@ -51,7 +51,7 @@ namespace urls { Changes to the underlying character buffer can invalidate iterators which reference it. */ -class params_encoded_view +class BOOST_URL_DECL params_encoded_view : public params_encoded_base { friend class url_view_base; @@ -162,7 +162,6 @@ public: @li 3.4. Query */ - BOOST_URL_DECL params_encoded_view( core::string_view s); @@ -221,16 +220,15 @@ public: @par Exception Safety Throws nothing */ - BOOST_URL_DECL operator params_view() const noexcept; //-------------------------------------------- - BOOST_URL_DECL friend - system::result - parse_query(core::string_view s) noexcept; + BOOST_URL_DECL + system::result + parse_query(core::string_view s) noexcept; }; } // urls diff --git a/include/boost/url/params_ref.hpp b/include/boost/url/params_ref.hpp index 4cc2da59..05230eb6 100644 --- a/include/boost/url/params_ref.hpp +++ b/include/boost/url/params_ref.hpp @@ -77,7 +77,7 @@ class params_view; elements and all elements after (including `end()`). */ -class params_ref +class BOOST_URL_DECL params_ref : public params_base { friend class url_base; @@ -181,7 +181,6 @@ public: @param other The params to assign. */ - BOOST_URL_DECL params_ref& operator=( params_ref const& other); @@ -219,7 +218,6 @@ public: /** Conversion */ - BOOST_URL_DECL operator params_view() const noexcept; @@ -314,7 +312,6 @@ public: @param init The list of params to assign. */ - BOOST_URL_DECL void assign( std::initializer_list< @@ -477,7 +474,6 @@ public: @param p The param to insert. */ - BOOST_URL_DECL iterator insert( iterator before, @@ -515,7 +511,6 @@ public: @param init The list of params to insert. */ - BOOST_URL_DECL iterator insert( iterator before, @@ -654,7 +649,6 @@ public: here, the comparison is case-insensitive. */ - BOOST_URL_DECL std::size_t erase( core::string_view key, @@ -694,7 +688,6 @@ public: @param p The param to assign. */ - BOOST_URL_DECL iterator replace( iterator pos, @@ -731,7 +724,6 @@ public: @param init The list of params to assign. */ - BOOST_URL_DECL iterator replace( iterator from, @@ -815,7 +807,6 @@ public: @param pos An iterator to the element. */ - BOOST_URL_DECL iterator unset( iterator pos) noexcept; @@ -854,7 +845,6 @@ public: That is, `has_value` for the element is true. */ - BOOST_URL_DECL iterator set( iterator pos, @@ -917,7 +907,6 @@ public: here, the comparison is case-insensitive. */ - BOOST_URL_DECL iterator set( core::string_view key, @@ -927,14 +916,12 @@ public: //-------------------------------------------- private: - BOOST_URL_DECL detail::params_iter_impl find_impl( detail::params_iter_impl, core::string_view, ignore_case_param) const noexcept; - BOOST_URL_DECL detail::params_iter_impl find_last_impl( detail::params_iter_impl, diff --git a/include/boost/url/static_url.hpp b/include/boost/url/static_url.hpp index 85528069..9bac2617 100644 --- a/include/boost/url/static_url.hpp +++ b/include/boost/url/static_url.hpp @@ -49,7 +49,7 @@ class static_url; @li @ref parse_uri @li @ref parse_uri_reference */ -class BOOST_SYMBOL_VISIBLE +class BOOST_URL_DECL static_url_base : public url_base { @@ -57,13 +57,13 @@ class BOOST_SYMBOL_VISIBLE friend class static_url; ~static_url_base() = default; - BOOST_URL_DECL static_url_base( + static_url_base( char* buf, std::size_t cap) noexcept; - BOOST_URL_DECL static_url_base( + static_url_base( char* buf, std::size_t cap, core::string_view s); - BOOST_URL_DECL void clear_impl() noexcept override; - BOOST_URL_DECL void reserve_impl(std::size_t, op_t&) override; - BOOST_URL_DECL void cleanup(op_t&) override; + void clear_impl() noexcept override; + void reserve_impl(std::size_t, op_t&) override; + void cleanup(op_t&) override; void copy(url_view_base const& u) diff --git a/include/boost/url/url.hpp b/include/boost/url/url.hpp index bfd4f7da..3e198bc1 100644 --- a/include/boost/url/url.hpp +++ b/include/boost/url/url.hpp @@ -60,7 +60,7 @@ namespace urls { @ref parse_uri_reference, @ref resolve. */ -class BOOST_SYMBOL_VISIBLE url +class BOOST_URL_DECL url : public url_base { friend std::hash; @@ -82,7 +82,6 @@ public: buffer is destroyed, invalidating all references to it. */ - BOOST_URL_DECL virtual ~url(); /** Constructor @@ -118,7 +117,6 @@ public: 4.2. Relative Reference (rfc3986) */ - BOOST_URL_DECL url() noexcept; /** Constructor @@ -168,7 +166,6 @@ public: @li 4.1. URI Reference */ - BOOST_URL_DECL explicit url(core::string_view s); @@ -194,7 +191,6 @@ public: @param u The url to move from. */ - BOOST_URL_DECL url(url&& u) noexcept; /** Constructor @@ -272,7 +268,6 @@ public: @param u The url to assign from. */ - BOOST_URL_DECL url& operator=(url&& u) noexcept; @@ -362,7 +357,6 @@ public: @param other The object to swap with */ - BOOST_URL_DECL void swap(url& other) noexcept; @@ -512,9 +506,9 @@ private: char* allocate(std::size_t); void deallocate(char* s); - BOOST_URL_DECL void clear_impl() noexcept override; - BOOST_URL_DECL void reserve_impl(std::size_t, op_t&) override; - BOOST_URL_DECL void cleanup(op_t&) override; + void clear_impl() noexcept override; + void reserve_impl(std::size_t, op_t&) override; + void cleanup(op_t&) override; }; } // urls diff --git a/include/boost/url/url_base.hpp b/include/boost/url/url_base.hpp index a28fc434..7b13b70e 100644 --- a/include/boost/url/url_base.hpp +++ b/include/boost/url/url_base.hpp @@ -60,7 +60,7 @@ struct pattern; @li @ref parse_uri @li @ref parse_uri_reference */ -class BOOST_SYMBOL_VISIBLE +class BOOST_URL_DECL url_base : public url_view_base { @@ -94,12 +94,12 @@ class BOOST_SYMBOL_VISIBLE url_base() noexcept = default; url_base(detail::url_impl const&) noexcept; explicit url_base(core::string_view); - BOOST_URL_DECL void reserve_impl(std::size_t n); - BOOST_URL_DECL void copy(url_view_base const&); - BOOST_URL_DECL virtual void clear_impl() noexcept = 0; - BOOST_URL_DECL virtual void reserve_impl( + void reserve_impl(std::size_t n); + void copy(url_view_base const&); + virtual void clear_impl() noexcept = 0; + virtual void reserve_impl( std::size_t, op_t&) = 0; - BOOST_URL_DECL virtual void cleanup(op_t&) = 0; + virtual void cleanup(op_t&) = 0; public: //-------------------------------------------- @@ -239,7 +239,6 @@ public: @see @ref remove_scheme. */ - BOOST_URL_DECL url_base& set_scheme(core::string_view s); @@ -274,7 +273,6 @@ public: @li 3.1. Scheme (rfc3986) */ - BOOST_URL_DECL url_base& #ifndef BOOST_URL_DOCS set_scheme_id(urls::scheme id); @@ -315,7 +313,6 @@ public: @see @ref set_scheme. */ - BOOST_URL_DECL url_base& remove_scheme(); @@ -361,7 +358,6 @@ public: @see @ref remove_authority. */ - BOOST_URL_DECL url_base& set_encoded_authority( pct_string_view s); @@ -404,7 +400,6 @@ public: @see @ref set_encoded_authority. */ - BOOST_URL_DECL url_base& remove_authority(); @@ -471,7 +466,6 @@ public: @ref remove_userinfo, @ref set_encoded_userinfo. */ - BOOST_URL_DECL url_base& set_userinfo( core::string_view s); @@ -538,7 +532,6 @@ public: @ref remove_userinfo, @ref set_userinfo. */ - BOOST_URL_DECL url_base& set_encoded_userinfo( pct_string_view s); @@ -580,7 +573,6 @@ public: @ref set_encoded_userinfo, @ref set_userinfo. */ - BOOST_URL_DECL url_base& remove_userinfo() noexcept; @@ -630,7 +622,6 @@ public: @ref set_encoded_user, @ref set_password. */ - BOOST_URL_DECL url_base& set_user( core::string_view s); @@ -684,7 +675,6 @@ public: @ref set_password, @ref set_user. */ - BOOST_URL_DECL url_base& set_encoded_user( pct_string_view s); @@ -737,7 +727,6 @@ public: @ref set_encoded_user, @ref set_user. */ - BOOST_URL_DECL url_base& set_password( core::string_view s); @@ -795,7 +784,6 @@ public: @ref set_encoded_user, @ref set_user. */ - BOOST_URL_DECL url_base& set_encoded_password( pct_string_view s); @@ -847,7 +835,6 @@ public: @ref set_password, @ref set_user. */ - BOOST_URL_DECL url_base& remove_password() noexcept; @@ -931,7 +918,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_host( core::string_view s); @@ -1016,7 +1002,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_encoded_host(pct_string_view s); @@ -1115,7 +1100,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_host_address(core::string_view s); @@ -1219,7 +1203,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_encoded_host_address( pct_string_view s); @@ -1276,7 +1259,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_host_ipv4( ipv4_address const& addr); @@ -1341,7 +1323,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_host_ipv6( ipv6_address const& addr); @@ -1394,7 +1375,6 @@ public: @ref set_host_ipv6, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_host_ipvfuture( core::string_view s); @@ -1442,7 +1422,6 @@ public: @ref set_host_ipv6, @ref set_host_ipvfuture. */ - BOOST_URL_DECL url_base& set_host_name( core::string_view s); @@ -1496,7 +1475,6 @@ public: @ref set_host_ipvfuture, @ref set_host_name. */ - BOOST_URL_DECL url_base& set_encoded_host_name( pct_string_view s); @@ -1541,7 +1519,6 @@ public: @ref remove_port, @ref set_port. */ - BOOST_URL_DECL url_base& set_port_number(std::uint16_t n); @@ -1585,7 +1562,6 @@ public: @ref remove_port, @ref set_port. */ - BOOST_URL_DECL url_base& set_port(core::string_view s); @@ -1624,7 +1600,6 @@ public: @see @ref set_port. */ - BOOST_URL_DECL url_base& remove_port() noexcept; @@ -1687,7 +1662,6 @@ public: @ref set_encoded_path, @ref set_path. */ - BOOST_URL_DECL bool set_path_absolute(bool absolute); @@ -1754,7 +1728,6 @@ public: @ref set_encoded_path, @ref set_path_absolute. */ - BOOST_URL_DECL url_base& set_path( core::string_view s); @@ -1820,7 +1793,6 @@ public: @ref set_path, @ref set_path_absolute. */ - BOOST_URL_DECL url_base& set_encoded_path( pct_string_view s); @@ -1876,7 +1848,6 @@ public: @ref set_path, @ref set_path_absolute. */ - BOOST_URL_DECL urls::segments_ref segments() noexcept; @@ -1938,7 +1909,6 @@ public: @ref set_path, @ref set_path_absolute. */ - BOOST_URL_DECL segments_encoded_ref encoded_segments() noexcept; @@ -2000,7 +1970,6 @@ public: @ref remove_query, @ref set_encoded_query. */ - BOOST_URL_DECL url_base& set_query( core::string_view s); @@ -2056,7 +2025,6 @@ public: @ref remove_query, @ref set_query. */ - BOOST_URL_DECL url_base& set_encoded_query( pct_string_view s); @@ -2105,7 +2073,6 @@ public: @ref set_encoded_query, @ref set_query. */ - BOOST_URL_DECL params_ref params() noexcept; @@ -2166,7 +2133,6 @@ public: @ref set_encoded_query, @ref set_query. */ - BOOST_URL_DECL params_ref params(encoding_opts opt) noexcept; @@ -2221,7 +2187,6 @@ public: @ref set_encoded_query, @ref set_query. */ - BOOST_URL_DECL params_encoded_ref encoded_params() noexcept; @@ -2275,7 +2240,6 @@ public: @ref set_encoded_query, @ref set_query. */ - BOOST_URL_DECL url_base& set_params( std::initializer_list ps ) noexcept; @@ -2336,7 +2300,6 @@ public: @ref set_encoded_query, @ref set_query. */ - BOOST_URL_DECL url_base& set_encoded_params( std::initializer_list< param_pct_view > ps ) noexcept; @@ -2379,7 +2342,6 @@ public: @ref set_encoded_query, @ref set_query. */ - BOOST_URL_DECL url_base& remove_query() noexcept; @@ -2425,7 +2387,6 @@ public: @ref set_encoded_fragment, @ref set_fragment. */ - BOOST_URL_DECL url_base& remove_fragment() noexcept; @@ -2470,7 +2431,6 @@ public: @ref remove_fragment, @ref set_encoded_fragment. */ - BOOST_URL_DECL url_base& set_fragment( core::string_view s); @@ -2522,7 +2482,6 @@ public: @ref remove_fragment, @ref set_fragment. */ - BOOST_URL_DECL url_base& set_encoded_fragment( pct_string_view s); @@ -2554,7 +2513,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL url_base& remove_origin(); @@ -2578,7 +2536,6 @@ public: >6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL url_base& normalize(); @@ -2598,7 +2555,6 @@ public: >6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL url_base& normalize_scheme(); @@ -2621,7 +2577,6 @@ public: >6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL url_base& normalize_authority(); @@ -2645,7 +2600,6 @@ public: >6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL url_base& normalize_path(); @@ -2668,7 +2622,6 @@ public: >6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL url_base& normalize_query(); @@ -2691,7 +2644,6 @@ public: >6.2.2 Syntax-Based Normalization (rfc3986) */ - BOOST_URL_DECL url_base& normalize_fragment(); @@ -2785,7 +2737,6 @@ public: @ref url, @ref url_view. */ - BOOST_URL_DECL system::result resolve( url_view_base const& ref); @@ -2822,7 +2773,6 @@ private: core::string_view first_segment() const noexcept; - BOOST_URL_DECL detail::segments_iter_impl edit_segments( detail::segments_iter_impl const&, @@ -2830,7 +2780,6 @@ private: detail::any_segments_iter&& it0, int absolute = -1); - BOOST_URL_DECL auto edit_params( detail::params_iter_impl const&, @@ -2838,7 +2787,6 @@ private: detail::any_params_iter&&) -> detail::params_iter_impl; - BOOST_URL_DECL system::result resolve_impl( url_view_base const& base, diff --git a/include/boost/url/url_view.hpp b/include/boost/url/url_view.hpp index b85c39d8..19a5a29a 100644 --- a/include/boost/url/url_view.hpp +++ b/include/boost/url/url_view.hpp @@ -71,7 +71,7 @@ namespace urls { @ref parse_uri, @ref parse_uri_reference. */ -class BOOST_SYMBOL_VISIBLE url_view +class BOOST_URL_DECL url_view : public url_view_base { friend std::hash; @@ -143,7 +143,6 @@ public: 4.2. Relative Reference (rfc3986) */ - BOOST_URL_DECL url_view() noexcept; /** Constructor @@ -195,7 +194,6 @@ public: @see @ref parse_uri_reference. */ - BOOST_URL_DECL url_view(core::string_view s); /// @copydoc url_view(core::string_view) @@ -257,7 +255,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL url_view( url_view_base const& other) noexcept; @@ -305,7 +302,6 @@ public: @par Exception Safety Throws nothing. */ - BOOST_URL_DECL url_view& operator=( url_view_base const& other) noexcept; diff --git a/include/boost/url/url_view_base.hpp b/include/boost/url/url_view_base.hpp index 29fb4808..f7f009e6 100644 --- a/include/boost/url/url_view_base.hpp +++ b/include/boost/url/url_view_base.hpp @@ -62,7 +62,7 @@ struct pattern; @li @ref parse_uri @li @ref parse_uri_reference */ -class BOOST_SYMBOL_VISIBLE +class BOOST_URL_DECL url_view_base : private detail::parts_base { @@ -89,10 +89,8 @@ class BOOST_SYMBOL_VISIBLE struct shared_impl; - BOOST_URL_DECL url_view_base() noexcept; - BOOST_URL_DECL explicit url_view_base( detail::url_impl const&) noexcept; @@ -113,7 +111,6 @@ class BOOST_SYMBOL_VISIBLE #ifndef BOOST_URL_DOCS public: #endif - BOOST_URL_DECL std::size_t digest(std::size_t = 0) const noexcept; @@ -297,7 +294,6 @@ public: @par Exception Safety Calls to allocate may throw. */ - BOOST_URL_DECL std::shared_ptr< url_view const> persist() const; @@ -340,7 +336,6 @@ public: @ref scheme, @ref scheme_id. */ - BOOST_URL_DECL bool has_scheme() const noexcept; @@ -377,7 +372,6 @@ public: @ref has_scheme, @ref scheme_id. */ - BOOST_URL_DECL core::string_view scheme() const noexcept; @@ -427,7 +421,6 @@ public: @ref has_scheme, @ref scheme. */ - BOOST_URL_DECL urls::scheme scheme_id() const noexcept; @@ -519,7 +512,6 @@ public: @ref encoded_authority, @ref has_authority. */ - BOOST_URL_DECL authority_view authority() const noexcept; @@ -556,7 +548,6 @@ public: @ref authority, @ref has_authority. */ - BOOST_URL_DECL pct_string_view encoded_authority() const noexcept; @@ -603,7 +594,6 @@ public: @ref userinfo. */ - BOOST_URL_DECL bool has_userinfo() const noexcept; @@ -645,7 +635,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL bool has_password() const noexcept; @@ -754,7 +743,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL pct_string_view encoded_userinfo() const noexcept; @@ -853,7 +841,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL pct_string_view encoded_user() const noexcept; @@ -946,7 +933,6 @@ public: @ref user, @ref userinfo. */ - BOOST_URL_DECL pct_string_view encoded_password() const noexcept; @@ -1067,7 +1053,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL pct_string_view encoded_host() const noexcept; @@ -1182,7 +1167,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL pct_string_view encoded_host_address() const noexcept; @@ -1222,7 +1206,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL ipv4_address host_ipv4_address() const noexcept; @@ -1270,7 +1253,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL ipv6_address host_ipv6_address() const noexcept; @@ -1303,7 +1285,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL core::string_view host_ipvfuture() const noexcept; @@ -1384,7 +1365,6 @@ public: @li 3.2.2. Host (rfc3986) */ - BOOST_URL_DECL pct_string_view encoded_host_name() const noexcept; @@ -1426,7 +1406,6 @@ public: @ref port, @ref port_number. */ - BOOST_URL_DECL bool has_port() const noexcept; @@ -1462,7 +1441,6 @@ public: @ref has_port, @ref port_number. */ - BOOST_URL_DECL core::string_view port() const noexcept; @@ -1498,7 +1476,6 @@ public: @ref has_port, @ref port. */ - BOOST_URL_DECL std::uint16_t port_number() const noexcept; @@ -1654,7 +1631,6 @@ public: @ref path, @ref segments. */ - BOOST_URL_DECL pct_string_view encoded_path() const noexcept; @@ -1695,7 +1671,6 @@ public: @ref path, @ref segments_view. */ - BOOST_URL_DECL segments_view segments() const noexcept; @@ -1746,7 +1721,6 @@ public: @ref segments, @ref segments_encoded_view. */ - BOOST_URL_DECL segments_encoded_view encoded_segments() const noexcept; @@ -1793,7 +1767,6 @@ public: @ref params, @ref query. */ - BOOST_URL_DECL bool has_query() const noexcept; @@ -1895,7 +1868,6 @@ public: @ref params, @ref query. */ - BOOST_URL_DECL pct_string_view encoded_query() const noexcept; @@ -1940,11 +1912,9 @@ public: @ref has_query, @ref query. */ - BOOST_URL_DECL params_view params() const noexcept; - BOOST_URL_DECL params_view params(encoding_opts opt) const noexcept; @@ -1993,7 +1963,6 @@ public: @ref params, @ref query. */ - BOOST_URL_DECL params_encoded_view encoded_params() const noexcept; @@ -2036,7 +2005,6 @@ public: @ref encoded_fragment, @ref fragment. */ - BOOST_URL_DECL bool has_fragment() const noexcept; @@ -2141,7 +2109,6 @@ public: @ref fragment, @ref has_fragment. */ - BOOST_URL_DECL pct_string_view encoded_fragment() const noexcept; @@ -2187,7 +2154,6 @@ public: @ref port, @ref port_number. */ - BOOST_URL_DECL pct_string_view encoded_host_and_port() const noexcept; @@ -2216,7 +2182,6 @@ public: @ref encoded_resource, @ref encoded_target. */ - BOOST_URL_DECL pct_string_view encoded_origin() const noexcept; @@ -2249,7 +2214,6 @@ public: @ref encoded_origin, @ref encoded_target. */ - BOOST_URL_DECL pct_string_view encoded_resource() const noexcept; @@ -2282,7 +2246,6 @@ public: @ref encoded_origin, @ref encoded_resource. */ - BOOST_URL_DECL pct_string_view encoded_target() const noexcept; @@ -2311,7 +2274,6 @@ public: @return -1 if `*this < other`, 0 if `this == other`, and 1 if `this > other`. */ - BOOST_URL_DECL int compare(url_view_base const& other) const noexcept; @@ -2690,7 +2652,6 @@ private: // implementation // //-------------------------------------------- - BOOST_URL_DECL static int segments_compare( diff --git a/src/detail/url_impl.cpp b/src/detail/url_impl.cpp index 41b71d1d..32e24445 100644 --- a/src/detail/url_impl.cpp +++ b/src/detail/url_impl.cpp @@ -158,6 +158,146 @@ apply_frag( decoded_[id_frag] = s.decoded_size(); } +// return length of [first, last) +auto +url_impl:: +len( + int first, + int last) const noexcept -> + std::size_t +{ + BOOST_ASSERT(first <= last); + BOOST_ASSERT(last <= id_end); + return offset(last) - offset(first); +} + +// return length of part +auto +url_impl:: +len(int id) const noexcept -> + std::size_t +{ + return id == id_end + ? zero_ + : ( offset(id + 1) - + offset(id) ); +} + +// return offset of id +auto +url_impl:: +offset(int id) const noexcept -> + std::size_t +{ + return + id == id_scheme + ? zero_ + : offset_[id]; +} + +// return id as string +core::string_view +url_impl:: +get(int id) const noexcept +{ + return { + cs_ + offset(id), len(id) }; +} + +// return [first, last) as string +core::string_view +url_impl:: +get(int first, + int last) const noexcept +{ + return { cs_ + offset(first), + offset(last) - offset(first) }; +} + +// return id as pct-string +pct_string_view +url_impl:: +pct_get( + int id) const noexcept +{ + return make_pct_string_view_unsafe( + cs_ + offset(id), + len(id), + decoded_[id]); +} + +// return [first, last) as pct-string +pct_string_view +url_impl:: +pct_get( + int first, + int last) const noexcept +{ + auto const pos = offset(first); + std::size_t n = 0; + for(auto i = first; i < last;) + n += decoded_[i++]; + return make_pct_string_view_unsafe( + cs_ + pos, + offset(last) - pos, + n); +} + +//------------------------------------------------ + +// change id to size n +void +url_impl:: +set_size( + int id, + std::size_t n) noexcept +{ + auto d = n - len(id); + for(auto i = id + 1; + i <= id_end; ++i) + offset_[i] += d; +} + +// trim id to size n, +// moving excess into id+1 +void +url_impl:: +split( + int id, + std::size_t n) noexcept +{ + BOOST_ASSERT(id < id_end - 1); + //BOOST_ASSERT(n <= len(id)); + offset_[id + 1] = offset(id) + n; +} + +// add n to [first, last] +void +url_impl:: +adjust( + int first, + int last, + std::size_t n) noexcept +{ + for(int i = first; + i <= last; ++i) + offset_[i] += n; +} + +// set [first, last) offset +void +url_impl:: +collapse( + int first, + int last, + std::size_t n) noexcept +{ + for(int i = first + 1; + i < last; ++i) + offset_[i] = n; +} + + //------------------------------------------------ // // path_ref diff --git a/src/encoding_opts.cpp b/src/encoding_opts.cpp new file mode 100644 index 00000000..8675f730 --- /dev/null +++ b/src/encoding_opts.cpp @@ -0,0 +1,32 @@ +// +// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/url +// + +#ifndef BOOST_URL_IMPL_ENCONDING_OPTS_IPP +#define BOOST_URL_IMPL_ENCONDING_OPTS_IPP + +#include +#include + +namespace boost { +namespace urls { + +encoding_opts:: +encoding_opts( + bool space_as_plus_, + bool lower_case_, + bool disallow_null_) noexcept + : space_as_plus(space_as_plus_) + , lower_case(lower_case_) + , disallow_null(disallow_null_) +{} + +} // urls +} // boost + +#endif diff --git a/src/params_base.cpp b/src/params_base.cpp index 8e67af6c..3f4f47ef 100644 --- a/src/params_base.cpp +++ b/src/params_base.cpp @@ -20,6 +20,8 @@ namespace boost { namespace urls { +//------------------------------------------------ + params_base:: iterator:: iterator( @@ -41,7 +43,6 @@ iterator( { } -//------------------------------------------------ auto params_base:: @@ -67,6 +68,77 @@ operator*() const -> // //------------------------------------------------ +params_base:: +params_base() noexcept + // space_as_plus = true + : opt_(true, false, false) +{ +} + +bool +params_base:: +contains( + core::string_view key, + ignore_case_param ic) const noexcept +{ + return find( + begin(),key, ic) != end(); +} + +auto +params_base:: +find( + core::string_view key, + ignore_case_param ic) const noexcept -> + iterator +{ + return iterator( + find_impl( + begin().it_, key, ic), + opt_); +} + +auto +params_base:: +find( + iterator it, + core::string_view key, + ignore_case_param ic) const noexcept -> + iterator +{ + return iterator( + find_impl( + it.it_, key, ic), + opt_); +} + +auto +params_base:: +find_last( + core::string_view key, + ignore_case_param ic) const noexcept -> + iterator +{ + return iterator( + find_last_impl( + end().it_, key, ic), + opt_); +} + +auto +params_base:: +find_last( + iterator it, + core::string_view key, + ignore_case_param ic) const noexcept -> + iterator +{ + return iterator( + find_last_impl( + it.it_, key, ic), + opt_); +} + params_base:: params_base( detail::query_ref const& ref, diff --git a/src/params_encoded_ref.cpp b/src/params_encoded_ref.cpp index 710dd0c1..df5392b5 100644 --- a/src/params_encoded_ref.cpp +++ b/src/params_encoded_ref.cpp @@ -219,6 +219,32 @@ set( } } +auto +params_encoded_ref:: +erase( + iterator pos) noexcept -> + iterator +{ + return erase( + pos, + std::next(pos)); +} + +auto +params_encoded_ref:: +erase( + iterator first, + iterator last) noexcept -> + iterator +{ + core::string_view s("", 0); + return u_->edit_params( + first.it_, + last.it_, + detail::query_iter(s)); +} + + //------------------------------------------------ // // (implementation) diff --git a/src/params_ref.cpp b/src/params_ref.cpp index 2444901b..43f97a0c 100644 --- a/src/params_ref.cpp +++ b/src/params_ref.cpp @@ -211,6 +211,33 @@ set( } } +auto +params_ref:: +erase( + iterator pos) noexcept -> + iterator +{ + return erase( + pos, + std::next(pos)); +} + +auto +params_ref:: +erase( + iterator first, + iterator last) noexcept -> + iterator +{ + core::string_view s("", 0); + return iterator( + u_->edit_params( + first.it_, + last.it_, + detail::query_iter(s)), + opt_); +} + //------------------------------------------------ // // (implementation)