| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - /* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */ | ||
| 1 | + /* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */ | ||
| 2 | 2 | /* begin file src/ada.cpp */ | |
| 3 | 3 | #include "ada.h" | |
| 4 | 4 | /* begin file src/checkers.cpp */ | |
@@ -11231,6 +11231,7 @@ bool url::parse_ipv4(std::string_view input) { | |||
| 11231 | 11231 | } else { | |
| 11232 | 11232 | host = ada::serializers::ipv4(ipv4); // We have to reserialize the address. | |
| 11233 | 11233 | } | |
| 11234 | + host_type = IPV4; | ||
| 11234 | 11235 | return true; | |
| 11235 | 11236 | } | |
| 11236 | 11237 | ||
@@ -11460,6 +11461,7 @@ bool url::parse_ipv6(std::string_view input) { | |||
| 11460 | 11461 | } | |
| 11461 | 11462 | host = ada::serializers::ipv6(address); | |
| 11462 | 11463 | ada_log("parse_ipv6 ", *host); | |
| 11464 | + host_type = IPV6; | ||
| 11463 | 11465 | return true; | |
| 11464 | 11466 | } | |
| 11465 | 11467 | ||
@@ -12569,7 +12571,6 @@ result_type parse_url(std::string_view user_input, | |||
| 12569 | 12571 | // If c is U+002F (/) and remaining starts with U+002F (/), | |
| 12570 | 12572 | // then set state to special authority ignore slashes state and increase | |
| 12571 | 12573 | // pointer by 1. | |
| 12572 | - state = ada::state::SPECIAL_AUTHORITY_IGNORE_SLASHES; | ||
| 12573 | 12574 | std::string_view view = helpers::substring(url_data, input_position); | |
| 12574 | 12575 | if (ada::checkers::begins_with(view, "//")) { | |
| 12575 | 12576 | input_position += 2; | |
@@ -14021,6 +14022,7 @@ bool url_aggregator::parse_ipv4(std::string_view input) { | |||
| 14021 | 14022 | update_base_hostname( | |
| 14022 | 14023 | ada::serializers::ipv4(ipv4)); // We have to reserialize the address. | |
| 14023 | 14024 | } | |
| 14025 | + host_type = IPV4; | ||
| 14024 | 14026 | ADA_ASSERT_TRUE(validate()); | |
| 14025 | 14027 | return true; | |
| 14026 | 14028 | } | |
@@ -14256,6 +14258,7 @@ bool url_aggregator::parse_ipv6(std::string_view input) { | |||
| 14256 | 14258 | update_base_hostname(ada::serializers::ipv6(address)); | |
| 14257 | 14259 | ada_log("parse_ipv6 ", get_hostname()); | |
| 14258 | 14260 | ADA_ASSERT_TRUE(validate()); | |
| 14261 | + host_type = IPV6; | ||
| 14259 | 14262 | return true; | |
| 14260 | 14263 | } | |
| 14261 | 14264 | ||
@@ -14890,6 +14893,11 @@ void ada_free(ada_url result) noexcept { | |||
| 14890 | 14893 | delete r; | |
| 14891 | 14894 | } | |
| 14892 | 14895 | ||
| 14896 | + ada_url ada_copy(ada_url input) noexcept { | ||
| 14897 | + ada::result<ada::url_aggregator>& r = get_instance(input); | ||
| 14898 | + return new ada::result<ada::url_aggregator>(r); | ||
| 14899 | + } | ||
| 14900 | + | ||
| 14893 | 14901 | bool ada_is_valid(ada_url result) noexcept { | |
| 14894 | 14902 | ada::result<ada::url_aggregator>& r = get_instance(result); | |
| 14895 | 14903 | return r.has_value(); | |
@@ -15007,6 +15015,14 @@ ada_string ada_get_protocol(ada_url result) noexcept { | |||
| 15007 | 15015 | return ada_string_create(out.data(), out.length()); | |
| 15008 | 15016 | } | |
| 15009 | 15017 | ||
| 15018 | + uint8_t ada_get_url_host_type(ada_url result) noexcept { | ||
| 15019 | + ada::result<ada::url_aggregator>& r = get_instance(result); | ||
| 15020 | + if (!r) { | ||
| 15021 | + return 0; | ||
| 15022 | + } | ||
| 15023 | + return r->host_type; | ||
| 15024 | + } | ||
| 15025 | + | ||
| 15010 | 15026 | bool ada_set_href(ada_url result, const char* input, size_t length) noexcept { | |
| 15011 | 15027 | ada::result<ada::url_aggregator>& r = get_instance(result); | |
| 15012 | 15028 | if (!r) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - /* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */ | ||
| 1 | + /* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */ | ||
| 2 | 2 | /* begin file include/ada.h */ | |
| 3 | 3 | /** | |
| 4 | 4 | * @file ada.h | |
@@ -1008,6 +1008,7 @@ ada_really_inline bool bit_at(const uint8_t a[], const uint8_t i) { | |||
| 1008 | 1008 | #define ADA_CHECKERS_INL_H | |
| 1009 | 1009 | ||
| 1010 | 1010 | ||
| 1011 | + #include <algorithm> | ||
| 1011 | 1012 | #include <string_view> | |
| 1012 | 1013 | #include <cstring> | |
| 1013 | 1014 | ||
@@ -1058,7 +1059,7 @@ ada_really_inline constexpr bool begins_with(std::string_view view, | |||
| 1058 | 1059 | std::string_view prefix) { | |
| 1059 | 1060 | // in C++20, you have view.begins_with(prefix) | |
| 1060 | 1061 | return view.size() >= prefix.size() && | |
| 1061 | - (view.substr(0, prefix.size()) == prefix); | ||
| 1062 | + std::equal(prefix.begin(), prefix.end(), view.begin()); | ||
| 1062 | 1063 | } | |
| 1063 | 1064 | ||
| 1064 | 1065 | } // namespace ada::checkers | |
@@ -1406,6 +1407,25 @@ constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept; | |||
| 1406 | 1407 | ||
| 1407 | 1408 | namespace ada { | |
| 1408 | 1409 | ||
| 1410 | + /** | ||
| 1411 | + * Type of URL host as an enum. | ||
| 1412 | + */ | ||
| 1413 | + enum url_host_type : uint8_t { | ||
| 1414 | + /** | ||
| 1415 | + * Represents common URLs such as "https://www.google.com" | ||
| 1416 | + */ | ||
| 1417 | + DEFAULT = 0, | ||
| 1418 | + /** | ||
| 1419 | + * Represents ipv4 addresses such as "http://127.0.0.1" | ||
| 1420 | + */ | ||
| 1421 | + IPV4 = 1, | ||
| 1422 | + /** | ||
| 1423 | + * Represents ipv6 addresses such as | ||
| 1424 | + * "http://[2001:db8:3333:4444:5555:6666:7777:8888]" | ||
| 1425 | + */ | ||
| 1426 | + IPV6 = 2, | ||
| 1427 | + }; | ||
| 1428 | + | ||
| 1409 | 1429 | /** | |
| 1410 | 1430 | * @brief Base class of URL implementations | |
| 1411 | 1431 | * | |
@@ -1428,6 +1448,11 @@ struct url_base { | |||
| 1428 | 1448 | */ | |
| 1429 | 1449 | bool has_opaque_path{false}; | |
| 1430 | 1450 | ||
| 1451 | + /** | ||
| 1452 | + * URL hosts type | ||
| 1453 | + */ | ||
| 1454 | + url_host_type host_type = url_host_type::DEFAULT; | ||
| 1455 | + | ||
| 1431 | 1456 | /** | |
| 1432 | 1457 | * @private | |
| 1433 | 1458 | */ | |
@@ -1768,8 +1793,8 @@ inline int fast_digit_count(uint32_t x) noexcept { | |||
| 1768 | 1793 | #define TL_EXPECTED_HPP | |
| 1769 | 1794 | ||
| 1770 | 1795 | #define TL_EXPECTED_VERSION_MAJOR 1 | |
| 1771 | - #define TL_EXPECTED_VERSION_MINOR 0 | ||
| 1772 | - #define TL_EXPECTED_VERSION_PATCH 1 | ||
| 1796 | + #define TL_EXPECTED_VERSION_MINOR 1 | ||
| 1797 | + #define TL_EXPECTED_VERSION_PATCH 0 | ||
| 1773 | 1798 | ||
| 1774 | 1799 | #include <exception> | |
| 1775 | 1800 | #include <functional> | |
@@ -1802,6 +1827,16 @@ inline int fast_digit_count(uint32_t x) noexcept { | |||
| 1802 | 1827 | #define TL_EXPECTED_GCC55 | |
| 1803 | 1828 | #endif | |
| 1804 | 1829 | ||
| 1830 | + #if !defined(TL_ASSERT) | ||
| 1831 | + // can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug | ||
| 1832 | + #if (__cplusplus > 201103L) && !defined(TL_EXPECTED_GCC49) | ||
| 1833 | + #include <cassert> | ||
| 1834 | + #define TL_ASSERT(x) assert(x) | ||
| 1835 | + #else | ||
| 1836 | + #define TL_ASSERT(x) | ||
| 1837 | + #endif | ||
| 1838 | + #endif | ||
| 1839 | + | ||
| 1805 | 1840 | #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ | |
| 1806 | 1841 | !defined(__clang__)) | |
| 1807 | 1842 | // GCC < 5 doesn't support overloading on const&& for member functions | |
@@ -1957,6 +1992,7 @@ template <typename E> | |||
| 1957 | 1992 | #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED | |
| 1958 | 1993 | throw std::forward<E>(e); | |
| 1959 | 1994 | #else | |
| 1995 | + (void)e; | ||
| 1960 | 1996 | #ifdef _MSC_VER | |
| 1961 | 1997 | __assume(0); | |
| 1962 | 1998 | #else | |
@@ -2597,7 +2633,7 @@ struct expected_operations_base : expected_storage_base<T, E> { | |||
| 2597 | 2633 | geterr().~unexpected<E>(); | |
| 2598 | 2634 | construct(std::move(rhs).get()); | |
| 2599 | 2635 | } else { | |
| 2600 | - assign_common(rhs); | ||
| 2636 | + assign_common(std::move(rhs)); | ||
| 2601 | 2637 | } | |
| 2602 | 2638 | } | |
| 2603 | 2639 | ||
@@ -2960,7 +2996,7 @@ struct default_constructor_tag { | |||
| 2960 | 2996 | }; | |
| 2961 | 2997 | ||
| 2962 | 2998 | // expected_default_ctor_base will ensure that expected has a deleted default | |
| 2963 | - // constructor if T is not default constructible. | ||
| 2999 | + // consturctor if T is not default constructible. | ||
| 2964 | 3000 | // This specialization is for when T is default constructible | |
| 2965 | 3001 | template <class T, class E, | |
| 2966 | 3002 | bool Enable = | |
@@ -3255,6 +3291,53 @@ class expected : private detail::expected_move_assign_base<T, E>, | |||
| 3255 | 3291 | return map_error_impl(std::move(*this), std::forward<F>(f)); | |
| 3256 | 3292 | } | |
| 3257 | 3293 | #endif | |
| 3294 | + #endif | ||
| 3295 | + #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ | ||
| 3296 | + !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) | ||
| 3297 | + template <class F> | ||
| 3298 | + TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) & { | ||
| 3299 | + return map_error_impl(*this, std::forward<F>(f)); | ||
| 3300 | + } | ||
| 3301 | + template <class F> | ||
| 3302 | + TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) && { | ||
| 3303 | + return map_error_impl(std::move(*this), std::forward<F>(f)); | ||
| 3304 | + } | ||
| 3305 | + template <class F> | ||
| 3306 | + constexpr auto transform_error(F &&f) const & { | ||
| 3307 | + return map_error_impl(*this, std::forward<F>(f)); | ||
| 3308 | + } | ||
| 3309 | + template <class F> | ||
| 3310 | + constexpr auto transform_error(F &&f) const && { | ||
| 3311 | + return map_error_impl(std::move(*this), std::forward<F>(f)); | ||
| 3312 | + } | ||
| 3313 | + #else | ||
| 3314 | + template <class F> | ||
| 3315 | + TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &>(), | ||
| 3316 | + std::declval<F &&>())) | ||
| 3317 | + transform_error(F &&f) & { | ||
| 3318 | + return map_error_impl(*this, std::forward<F>(f)); | ||
| 3319 | + } | ||
| 3320 | + template <class F> | ||
| 3321 | + TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &&>(), | ||
| 3322 | + std::declval<F &&>())) | ||
| 3323 | + transform_error(F &&f) && { | ||
| 3324 | + return map_error_impl(std::move(*this), std::forward<F>(f)); | ||
| 3325 | + } | ||
| 3326 | + template <class F> | ||
| 3327 | + constexpr decltype(map_error_impl(std::declval<const expected &>(), | ||
| 3328 | + std::declval<F &&>())) | ||
| 3329 | + transform_error(F &&f) const & { | ||
| 3330 | + return map_error_impl(*this, std::forward<F>(f)); | ||
| 3331 | + } | ||
| 3332 | + | ||
| 3333 | + #ifndef TL_EXPECTED_NO_CONSTRR | ||
| 3334 | + template <class F> | ||
| 3335 | + constexpr decltype(map_error_impl(std::declval<const expected &&>(), | ||
| 3336 | + std::declval<F &&>())) | ||
| 3337 | + transform_error(F &&f) const && { | ||
| 3338 | + return map_error_impl(std::move(*this), std::forward<F>(f)); | ||
| 3339 | + } | ||
| 3340 | + #endif | ||
| 3258 | 3341 | #endif | |
| 3259 | 3342 | template <class F> | |
| 3260 | 3343 | expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) & { | |
@@ -3697,27 +3780,37 @@ class expected : private detail::expected_move_assign_base<T, E>, | |||
| 3697 | 3780 | } | |
| 3698 | 3781 | } | |
| 3699 | 3782 | ||
| 3700 | - constexpr const T *operator->() const { return valptr(); } | ||
| 3701 | - TL_EXPECTED_11_CONSTEXPR T *operator->() { return valptr(); } | ||
| 3783 | + constexpr const T *operator->() const { | ||
| 3784 | + TL_ASSERT(has_value()); | ||
| 3785 | + return valptr(); | ||
| 3786 | + } | ||
| 3787 | + TL_EXPECTED_11_CONSTEXPR T *operator->() { | ||
| 3788 | + TL_ASSERT(has_value()); | ||
| 3789 | + return valptr(); | ||
| 3790 | + } | ||
| 3702 | 3791 | ||
| 3703 | 3792 | template <class U = T, | |
| 3704 | 3793 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> | |
| 3705 | 3794 | constexpr const U &operator*() const & { | |
| 3795 | + TL_ASSERT(has_value()); | ||
| 3706 | 3796 | return val(); | |
| 3707 | 3797 | } | |
| 3708 | 3798 | template <class U = T, | |
| 3709 | 3799 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> | |
| 3710 | 3800 | TL_EXPECTED_11_CONSTEXPR U &operator*() & { | |
| 3801 | + TL_ASSERT(has_value()); | ||
| 3711 | 3802 | return val(); | |
| 3712 | 3803 | } | |
| 3713 | 3804 | template <class U = T, | |
| 3714 | 3805 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> | |
| 3715 | 3806 | constexpr const U &&operator*() const && { | |
| 3807 | + TL_ASSERT(has_value()); | ||
| 3716 | 3808 | return std::move(val()); | |
| 3717 | 3809 | } | |
| 3718 | 3810 | template <class U = T, | |
| 3719 | 3811 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> | |
| 3720 | 3812 | TL_EXPECTED_11_CONSTEXPR U &&operator*() && { | |
| 3813 | + TL_ASSERT(has_value()); | ||
| 3721 | 3814 | return std::move(val()); | |
| 3722 | 3815 | } | |
| 3723 | 3816 | ||
@@ -3753,10 +3846,22 @@ class expected : private detail::expected_move_assign_base<T, E>, | |||
| 3753 | 3846 | return std::move(val()); | |
| 3754 | 3847 | } | |
| 3755 | 3848 | ||
| 3756 | - constexpr const E &error() const & { return err().value(); } | ||
| 3757 | - TL_EXPECTED_11_CONSTEXPR E &error() & { return err().value(); } | ||
| 3758 | - constexpr const E &&error() const && { return std::move(err().value()); } | ||
| 3759 | - TL_EXPECTED_11_CONSTEXPR E &&error() && { return std::move(err().value()); } | ||
| 3849 | + constexpr const E &error() const & { | ||
| 3850 | + TL_ASSERT(!has_value()); | ||
| 3851 | + return err().value(); | ||
| 3852 | + } | ||
| 3853 | + TL_EXPECTED_11_CONSTEXPR E &error() & { | ||
| 3854 | + TL_ASSERT(!has_value()); | ||
| 3855 | + return err().value(); | ||
| 3856 | + } | ||
| 3857 | + constexpr const E &&error() const && { | ||
| 3858 | + TL_ASSERT(!has_value()); | ||
| 3859 | + return std::move(err().value()); | ||
| 3860 | + } | ||
| 3861 | + TL_EXPECTED_11_CONSTEXPR E &&error() && { | ||
| 3862 | + TL_ASSERT(!has_value()); | ||
| 3863 | + return std::move(err().value()); | ||
| 3864 | + } | ||
| 3760 | 3865 | ||
| 3761 | 3866 | template <class U> | |
| 3762 | 3867 | constexpr T value_or(U &&v) const & { | |
@@ -6609,6 +6714,7 @@ struct url_search_params { | |||
| 6609 | 6714 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-has | |
| 6610 | 6715 | */ | |
| 6611 | 6716 | inline bool has(std::string_view key) noexcept; | |
| 6717 | + inline bool has(std::string_view key, std::string_view value) noexcept; | ||
| 6612 | 6718 | ||
| 6613 | 6719 | /** | |
| 6614 | 6720 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-set | |
@@ -6733,6 +6839,15 @@ inline bool url_search_params::has(const std::string_view key) noexcept { | |||
| 6733 | 6839 | return entry != params.end(); | |
| 6734 | 6840 | } | |
| 6735 | 6841 | ||
| 6842 | + inline bool url_search_params::has(std::string_view key, | ||
| 6843 | + std::string_view value) noexcept { | ||
| 6844 | + auto entry = | ||
| 6845 | + std::find_if(params.begin(), params.end(), [&key, &value](auto ¶m) { | ||
| 6846 | + return param.first == key && param.second == value; | ||
| 6847 | + }); | ||
| 6848 | + return entry != params.end(); | ||
| 6849 | + } | ||
| 6850 | + | ||
| 6736 | 6851 | inline std::string url_search_params::to_string() { | |
| 6737 | 6852 | auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE; | |
| 6738 | 6853 | std::string out{}; | |
@@ -6807,14 +6922,14 @@ inline void url_search_params::sort() { | |||
| 6807 | 6922 | #ifndef ADA_ADA_VERSION_H | |
| 6808 | 6923 | #define ADA_ADA_VERSION_H | |
| 6809 | 6924 | ||
| 6810 | - #define ADA_VERSION "2.6.0" | ||
| 6925 | + #define ADA_VERSION "2.6.3" | ||
| 6811 | 6926 | ||
| 6812 | 6927 | namespace ada { | |
| 6813 | 6928 | ||
| 6814 | 6929 | enum { | |
| 6815 | 6930 | ADA_VERSION_MAJOR = 2, | |
| 6816 | 6931 | ADA_VERSION_MINOR = 6, | |
| 6817 | - ADA_VERSION_REVISION = 0, | ||
| 6932 | + ADA_VERSION_REVISION = 3, | ||
| 6818 | 6933 | }; | |
| 6819 | 6934 | ||
| 6820 | 6935 | } // namespace ada | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,6 +51,7 @@ bool ada_can_parse_with_base(const char* input, size_t input_length, | |||
| 51 | 51 | ||
| 52 | 52 | void ada_free(ada_url result); | |
| 53 | 53 | void ada_free_owned_string(ada_owned_string owned); | |
| 54 | + ada_url ada_copy(ada_url input); | ||
| 54 | 55 | ||
| 55 | 56 | bool ada_is_valid(ada_url result); | |
| 56 | 57 | ||
@@ -67,6 +68,7 @@ ada_string ada_get_hostname(ada_url result); | |||
| 67 | 68 | ada_string ada_get_pathname(ada_url result); | |
| 68 | 69 | ada_string ada_get_search(ada_url result); | |
| 69 | 70 | ada_string ada_get_protocol(ada_url result); | |
| 71 | + uint8_t ada_get_url_host_type(ada_url result); | ||
| 70 | 72 | ||
| 71 | 73 | // url_aggregator setters | |
| 72 | 74 | // if ada_is_valid(result)) is false, the setters have no effect | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory. | |||
| 9 | 9 | This a list of all the dependencies: | |
| 10 | 10 | ||
| 11 | 11 | * [acorn][] | |
| 12 | - * [ada][] | ||
| 12 | + * [ada 2.6.3][] | ||
| 13 | 13 | * [base64][] | |
| 14 | 14 | * [brotli][] | |
| 15 | 15 | * [c-ares][] | |
@@ -148,7 +148,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. | |||
| 148 | 148 | [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is | |
| 149 | 149 | an abstract syntax tree walker for the ESTree format. | |
| 150 | 150 | ||
| 151 | - ### ada | ||
| 151 | + ### ada 2.6.3 | ||
| 152 | 152 | ||
| 153 | 153 | The [ada](https://github.com/ada-url/ada) dependency is a | |
| 154 | 154 | fast and spec-compliant URL parser written in C++. | |
@@ -312,7 +312,7 @@ it comes from the Chromium team's zlib fork which incorporated | |||
| 312 | 312 | performance improvements not currently available in standard zlib. | |
| 313 | 313 | ||
| 314 | 314 | [acorn]: #acorn | |
| 315 | - [ada]: #ada | ||
| 315 | + [ada 2.6.3]: #ada-263 | ||
| 316 | 316 | [base64]: #base64 | |
| 317 | 317 | [brotli]: #brotli | |
| 318 | 318 | [c-ares]: #c-ares | |
| Back | FazBrowse Home | New Git URL |
0 commit comments