|
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 |
|