123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547 |
- #ifndef BOOST_URL_URL_HPP
- #define BOOST_URL_URL_HPP
- #include <boost/url/detail/config.hpp>
- #include <boost/url/url_base.hpp>
- #include <boost/assert.hpp>
- #include <utility>
- namespace boost {
- namespace urls {
- class BOOST_URL_DECL url
- : public url_base
- {
- friend std::hash<url>;
- using url_view_base::digest;
- public:
-
-
-
-
-
-
- virtual ~url();
-
- url() noexcept;
-
- explicit
- url(core::string_view s);
-
- url(url&& u) noexcept;
-
- url(url_view_base const& u)
- {
- copy(u);
- }
-
- url(url const& u)
- : url(static_cast<
- url_view_base const&>(u))
- {
- }
-
- url&
- operator=(url&& u) noexcept;
-
- url&
- operator=(
- url_view_base const& u)
- {
- copy(u);
- return *this;
- }
-
- url&
- operator=(url const& u)
- {
- return (*this)=static_cast<
- url_view_base const&>(u);
- }
-
-
- void
- swap(url& other) noexcept;
-
- friend
- void
- swap(url& v0, url& v1) noexcept
- {
- v0.swap(v1);
- }
-
-
-
-
-
- url& set_scheme(core::string_view s) { url_base::set_scheme(s); return *this; }
-
- url& set_scheme_id(urls::scheme id) { url_base::set_scheme_id(id); return *this; }
-
- url& remove_scheme() { url_base::remove_scheme(); return *this; }
-
- url& set_encoded_authority(pct_string_view s) { url_base::set_encoded_authority(s); return *this; }
-
- url& remove_authority() { url_base::remove_authority(); return *this; }
-
- url& set_userinfo(core::string_view s) { url_base::set_userinfo(s); return *this; }
-
- url& set_encoded_userinfo(pct_string_view s) { url_base::set_encoded_userinfo(s); return *this; }
-
- url& remove_userinfo() noexcept { url_base::remove_userinfo(); return *this; }
-
- url& set_user(core::string_view s) { url_base::set_user(s); return *this; }
-
- url& set_encoded_user(pct_string_view s) { url_base::set_encoded_user(s); return *this; }
-
- url& set_password(core::string_view s) { url_base::set_password(s); return *this; }
-
- url& set_encoded_password(pct_string_view s) { url_base::set_encoded_password(s); return *this; }
-
- url& remove_password() noexcept { url_base::remove_password(); return *this; }
-
- url& set_host(core::string_view s) { url_base::set_host(s); return *this; }
-
- url& set_encoded_host(pct_string_view s) { url_base::set_encoded_host(s); return *this; }
-
- url& set_host_address(core::string_view s) { url_base::set_host_address(s); return *this; }
-
- url& set_encoded_host_address(pct_string_view s) { url_base::set_encoded_host_address(s); return *this; }
-
- url& set_host_ipv4(ipv4_address const& addr) { url_base::set_host_ipv4(addr); return *this; }
-
- url& set_host_ipv6(ipv6_address const& addr) { url_base::set_host_ipv6(addr); return *this; }
-
- url& set_host_ipvfuture(core::string_view s) { url_base::set_host_ipvfuture(s); return *this; }
-
- url& set_host_name(core::string_view s) { url_base::set_host_name(s); return *this; }
-
- url& set_encoded_host_name(pct_string_view s) { url_base::set_encoded_host_name(s); return *this; }
-
- url& set_port_number(std::uint16_t n) { url_base::set_port_number(n); return *this; }
-
- url& set_port(core::string_view s) { url_base::set_port(s); return *this; }
-
- url& remove_port() noexcept { url_base::remove_port(); return *this; }
-
-
-
- url& set_path(core::string_view s) { url_base::set_path(s); return *this; }
-
- url& set_encoded_path(pct_string_view s) { url_base::set_encoded_path(s); return *this; }
-
- url& set_query(core::string_view s) { url_base::set_query(s); return *this; }
-
- url& set_encoded_query(pct_string_view s) { url_base::set_encoded_query(s); return *this; }
-
- url& set_params(std::initializer_list<param_view> ps) { url_base::set_params(ps); return *this; }
-
- url& set_encoded_params(std::initializer_list< param_pct_view > ps) { url_base::set_encoded_params(ps); return *this; }
-
- url& remove_query() noexcept { url_base::remove_query(); return *this; }
-
- url& remove_fragment() noexcept { url_base::remove_fragment(); return *this; }
-
- url& set_fragment(core::string_view s) { url_base::set_fragment(s); return *this; }
-
- url& set_encoded_fragment(pct_string_view s) { url_base::set_encoded_fragment(s); return *this; }
-
- url& remove_origin() { url_base::remove_origin(); return *this; }
-
- url& normalize() { url_base::normalize(); return *this; }
-
- url& normalize_scheme() { url_base::normalize_scheme(); return *this; }
-
- url& normalize_authority() { url_base::normalize_authority(); return *this; }
-
- url& normalize_path() { url_base::normalize_path(); return *this; }
-
- url& normalize_query() { url_base::normalize_query(); return *this; }
-
- url& normalize_fragment() { url_base::normalize_fragment(); return *this; }
-
- private:
- char* allocate(std::size_t);
- void deallocate(char* s);
- void clear_impl() noexcept override;
- void reserve_impl(std::size_t, op_t&) override;
- void cleanup(op_t&) override;
- };
- }
- }
- #ifndef BOOST_URL_DOCS
- namespace std {
- template<>
- struct hash< ::boost::urls::url >
- {
- hash() = default;
- hash(hash const&) = default;
- hash& operator=(hash const&) = default;
- explicit
- hash(std::size_t salt) noexcept
- : salt_(salt)
- {
- }
- std::size_t
- operator()(::boost::urls::url const& u) const noexcept
- {
- return u.digest(salt_);
- }
- private:
- std::size_t salt_ = 0;
- };
- }
- #endif
- #endif
|