1
- /* auto-generated on 2025-01-30 18:48:55 -0500. Do not edit! */
1
+ /* auto-generated on 2025-02-11 09:47:50 -0500. Do not edit! */
2
2
/* begin file include/ada.h */
3
3
/**
4
4
* @file ada.h
@@ -1219,6 +1219,7 @@ constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept;
1219
1219
#endif // ADA_SCHEME_H
1220
1220
/* end file include/ada/scheme.h */
1221
1221
1222
+ #include <string>
1222
1223
#include <string_view>
1223
1224
1224
1225
namespace ada {
@@ -1352,6 +1353,7 @@ struct url_base {
1352
1353
#endif
1353
1354
/* end file include/ada/url_base.h */
1354
1355
1356
+ #include <string>
1355
1357
#include <string_view>
1356
1358
#include <optional>
1357
1359
@@ -4118,6 +4120,9 @@ void swap(expected<T, E> &lhs,
4118
4120
#ifndef ADA_URL_PATTERN_REGEX_H
4119
4121
#define ADA_URL_PATTERN_REGEX_H
4120
4122
4123
+ #include <string>
4124
+ #include <string_view>
4125
+
4121
4126
#ifdef ADA_USE_UNSAFE_STD_REGEX_PROVIDER
4122
4127
#include <regex>
4123
4128
#endif // ADA_USE_UNSAFE_STD_REGEX_PROVIDER
@@ -4216,7 +4221,9 @@ concept url_pattern_encoding_callback = requires(F f, std::string_view sv) {
4216
4221
// either a string or a URLPatternInit struct. If a string is given,
4217
4222
// it will be parsed to create a URLPatternInit. The URLPatternInit
4218
4223
// API is defined as part of the URLPattern specification.
4224
+ // All provided strings must be valid UTF-8.
4219
4225
struct url_pattern_init {
4226
+ // All strings must be valid UTF-8.
4220
4227
// @see https://urlpattern.spec.whatwg.org/#process-a-urlpatterninit
4221
4228
static tl::expected<url_pattern_init, errors> process(
4222
4229
url_pattern_init init, std::string_view type,
@@ -4276,15 +4283,23 @@ struct url_pattern_init {
4276
4283
#endif // ADA_TESTING
4277
4284
4278
4285
bool operator==(const url_pattern_init&) const;
4279
-
4286
+ // If present, must be valid UTF-8.
4280
4287
std::optional<std::string> protocol{};
4288
+ // If present, must be valid UTF-8.
4281
4289
std::optional<std::string> username{};
4290
+ // If present, must be valid UTF-8.
4282
4291
std::optional<std::string> password{};
4292
+ // If present, must be valid UTF-8.
4283
4293
std::optional<std::string> hostname{};
4294
+ // If present, must be valid UTF-8.
4284
4295
std::optional<std::string> port{};
4296
+ // If present, must be valid UTF-8.
4285
4297
std::optional<std::string> pathname{};
4298
+ // If present, must be valid UTF-8.
4286
4299
std::optional<std::string> search{};
4300
+ // If present, must be valid UTF-8.
4287
4301
std::optional<std::string> hash{};
4302
+ // If present, must be valid UTF-8.
4288
4303
std::optional<std::string> base_url{};
4289
4304
};
4290
4305
} // namespace ada
@@ -4366,6 +4381,7 @@ tl::expected<url_pattern<regex_provider>, errors> parse_url_pattern_impl(
4366
4381
#ifndef ADA_IMPLEMENTATION_H
4367
4382
#define ADA_IMPLEMENTATION_H
4368
4383
4384
+ #include <string>
4369
4385
#include <string_view>
4370
4386
#include <optional>
4371
4387
@@ -4379,6 +4395,7 @@ tl::expected<url_pattern<regex_provider>, errors> parse_url_pattern_impl(
4379
4395
4380
4396
#include <algorithm>
4381
4397
#include <optional>
4398
+ #include <ostream>
4382
4399
#include <string>
4383
4400
#include <string_view>
4384
4401
@@ -5040,7 +5057,9 @@ std::string href_from_file(std::string_view path);
5040
5057
#endif // ADA_IMPLEMENTATION_H
5041
5058
/* end file include/ada/implementation.h */
5042
5059
5060
+ #include <ostream>
5043
5061
#include <string>
5062
+ #include <string_view>
5044
5063
#include <unordered_map>
5045
5064
#include <variant>
5046
5065
#include <vector>
@@ -5219,6 +5238,8 @@ class url_pattern_component {
5219
5238
bool has_regexp_groups = false;
5220
5239
};
5221
5240
5241
+ // A URLPattern input can be either a string or a URLPatternInit object.
5242
+ // If it is a string, it must be a valid UTF-8 string.
5222
5243
using url_pattern_input = std::variant<std::string_view, url_pattern_init>;
5223
5244
5224
5245
// A struct providing the URLPattern matching results for all
@@ -5251,19 +5272,24 @@ struct url_pattern_options {
5251
5272
// defined in https://wicg.github.io/urlpattern.
5252
5273
// More information about the URL Pattern syntax can be found at
5253
5274
// https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
5275
+ //
5276
+ // We require all strings to be valid UTF-8: it is the user's responsibility
5277
+ // to ensure that the provided strings are valid UTF-8.
5254
5278
template <url_pattern_regex::regex_concept regex_provider>
5255
5279
class url_pattern {
5256
5280
public:
5257
5281
url_pattern() = default;
5258
5282
5259
5283
/**
5284
+ * If non-null, base_url must pointer at a valid UTF-8 string.
5260
5285
* @see https://urlpattern.spec.whatwg.org/#dom-urlpattern-exec
5261
5286
*/
5262
5287
result<std::optional<url_pattern_result>> exec(
5263
5288
const url_pattern_input& input,
5264
5289
const std::string_view* base_url = nullptr);
5265
5290
5266
5291
/**
5292
+ * If non-null, base_url must pointer at a valid UTF-8 string.
5267
5293
* @see https://urlpattern.spec.whatwg.org/#dom-urlpattern-test
5268
5294
*/
5269
5295
result<bool> test(const url_pattern_input& input,
@@ -5725,6 +5751,7 @@ std::string generate_segment_wildcard_regexp(
5725
5751
#endif
5726
5752
/* end file include/ada/url_pattern_helpers.h */
5727
5753
5754
+ #include <string>
5728
5755
#include <string_view>
5729
5756
#include <variant>
5730
5757
@@ -6257,6 +6284,7 @@ ada_warn_unused std::string to_string(ada::state s);
6257
6284
6258
6285
6259
6286
#include <string>
6287
+ #include <string_view>
6260
6288
#include <optional>
6261
6289
6262
6290
/**
@@ -6870,6 +6898,7 @@ namespace ada {
6870
6898
#ifndef ADA_URL_AGGREGATOR_H
6871
6899
#define ADA_URL_AGGREGATOR_H
6872
6900
6901
+ #include <ostream>
6873
6902
#include <string>
6874
6903
#include <string_view>
6875
6904
#include <variant>
@@ -7255,6 +7284,7 @@ ada_really_inline size_t percent_encode_index(const std::string_view input,
7255
7284
/* end file include/ada/unicode-inl.h */
7256
7285
7257
7286
#include <charconv>
7287
+ #include <ostream>
7258
7288
#include <string_view>
7259
7289
7260
7290
namespace ada {
@@ -8406,6 +8436,8 @@ using url_search_params_entries_iter =
8406
8436
url_search_params_iter_type::ENTRIES>;
8407
8437
8408
8438
/**
8439
+ * We require all strings to be valid UTF-8. It is the user's responsibility to
8440
+ * ensure that the provided strings are valid UTF-8.
8409
8441
* @see https://url.spec.whatwg.org/#interface-urlsearchparams
8410
8442
*/
8411
8443
struct url_search_params {
@@ -8428,6 +8460,7 @@ struct url_search_params {
8428
8460
[[nodiscard]] inline size_t size() const noexcept;
8429
8461
8430
8462
/**
8463
+ * Both key and value must be valid UTF-8.
8431
8464
* @see https://url.spec.whatwg.org/#dom-urlsearchparams-append
8432
8465
*/
8433
8466
inline void append(std::string_view key, std::string_view value);
@@ -8455,6 +8488,7 @@ struct url_search_params {
8455
8488
inline bool has(std::string_view key, std::string_view value) noexcept;
8456
8489
8457
8490
/**
8491
+ * Both key and value must be valid UTF-8.
8458
8492
* @see https://url.spec.whatwg.org/#dom-urlsearchparams-set
8459
8493
*/
8460
8494
inline void set(std::string_view key, std::string_view value);
@@ -8518,6 +8552,7 @@ struct url_search_params {
8518
8552
std::vector<key_value_pair> params{};
8519
8553
8520
8554
/**
8555
+ * The init parameter must be valid UTF-8.
8521
8556
* @see https://url.spec.whatwg.org/#concept-urlencoded-parser
8522
8557
*/
8523
8558
void initialize(std::string_view init);
@@ -8724,10 +8759,80 @@ inline void url_search_params::remove(const std::string_view key,
8724
8759
}
8725
8760
8726
8761
inline void url_search_params::sort() {
8727
- std::ranges::stable_sort(
8728
- params, [](const key_value_pair &lhs, const key_value_pair &rhs) {
8729
- return lhs.first < rhs.first;
8730
- });
8762
+ // We rely on the fact that the content is valid UTF-8.
8763
+ std::ranges::stable_sort(params, [](const key_value_pair &lhs,
8764
+ const key_value_pair &rhs) {
8765
+ size_t i = 0, j = 0;
8766
+ uint32_t low_surrogate1 = 0, low_surrogate2 = 0;
8767
+ while ((i < lhs.first.size() || low_surrogate1 != 0) &&
8768
+ (j < rhs.first.size() || low_surrogate2 != 0)) {
8769
+ uint32_t codePoint1 = 0, codePoint2 = 0;
8770
+
8771
+ if (low_surrogate1 != 0) {
8772
+ codePoint1 = low_surrogate1;
8773
+ low_surrogate1 = 0;
8774
+ } else {
8775
+ uint8_t c1 = uint8_t(lhs.first[i]);
8776
+ if (c1 <= 0x7F) {
8777
+ codePoint1 = c1;
8778
+ i++;
8779
+ } else if (c1 <= 0xDF) {
8780
+ codePoint1 = ((c1 & 0x1F) << 6) | (uint8_t(lhs.first[i + 1]) & 0x3F);
8781
+ i += 2;
8782
+ } else if (c1 <= 0xEF) {
8783
+ codePoint1 = ((c1 & 0x0F) << 12) |
8784
+ ((uint8_t(lhs.first[i + 1]) & 0x3F) << 6) |
8785
+ (uint8_t(lhs.first[i + 2]) & 0x3F);
8786
+ i += 3;
8787
+ } else {
8788
+ codePoint1 = ((c1 & 0x07) << 18) |
8789
+ ((uint8_t(lhs.first[i + 1]) & 0x3F) << 12) |
8790
+ ((uint8_t(lhs.first[i + 2]) & 0x3F) << 6) |
8791
+ (uint8_t(lhs.first[i + 3]) & 0x3F);
8792
+ i += 4;
8793
+
8794
+ codePoint1 -= 0x10000;
8795
+ uint16_t high_surrogate = uint16_t(0xD800 + (codePoint1 >> 10));
8796
+ low_surrogate1 = uint16_t(0xDC00 + (codePoint1 & 0x3FF));
8797
+ codePoint1 = high_surrogate;
8798
+ }
8799
+ }
8800
+
8801
+ if (low_surrogate2 != 0) {
8802
+ codePoint2 = low_surrogate2;
8803
+ low_surrogate2 = 0;
8804
+ } else {
8805
+ uint8_t c2 = uint8_t(rhs.first[j]);
8806
+ if (c2 <= 0x7F) {
8807
+ codePoint2 = c2;
8808
+ j++;
8809
+ } else if (c2 <= 0xDF) {
8810
+ codePoint2 = ((c2 & 0x1F) << 6) | (uint8_t(rhs.first[j + 1]) & 0x3F);
8811
+ j += 2;
8812
+ } else if (c2 <= 0xEF) {
8813
+ codePoint2 = ((c2 & 0x0F) << 12) |
8814
+ ((uint8_t(rhs.first[j + 1]) & 0x3F) << 6) |
8815
+ (uint8_t(rhs.first[j + 2]) & 0x3F);
8816
+ j += 3;
8817
+ } else {
8818
+ codePoint2 = ((c2 & 0x07) << 18) |
8819
+ ((uint8_t(rhs.first[j + 1]) & 0x3F) << 12) |
8820
+ ((uint8_t(rhs.first[j + 2]) & 0x3F) << 6) |
8821
+ (uint8_t(rhs.first[j + 3]) & 0x3F);
8822
+ j += 4;
8823
+ codePoint2 -= 0x10000;
8824
+ uint16_t high_surrogate = uint16_t(0xD800 + (codePoint2 >> 10));
8825
+ low_surrogate2 = uint16_t(0xDC00 + (codePoint2 & 0x3FF));
8826
+ codePoint2 = high_surrogate;
8827
+ }
8828
+ }
8829
+
8830
+ if (codePoint1 != codePoint2) {
8831
+ return (codePoint1 < codePoint2);
8832
+ }
8833
+ }
8834
+ return (j < rhs.first.size() || low_surrogate2 != 0);
8835
+ });
8731
8836
}
8732
8837
8733
8838
inline url_search_params_keys_iter url_search_params::get_keys() {
@@ -10330,14 +10435,14 @@ constructor_string_parser<regex_provider>::parse(std::string_view input) {
10330
10435
#ifndef ADA_ADA_VERSION_H
10331
10436
#define ADA_ADA_VERSION_H
10332
10437
10333
- #define ADA_VERSION "3.0.1 "
10438
+ #define ADA_VERSION "3.1.0 "
10334
10439
10335
10440
namespace ada {
10336
10441
10337
10442
enum {
10338
10443
ADA_VERSION_MAJOR = 3,
10339
- ADA_VERSION_MINOR = 0 ,
10340
- ADA_VERSION_REVISION = 1 ,
10444
+ ADA_VERSION_MINOR = 1 ,
10445
+ ADA_VERSION_REVISION = 0 ,
10341
10446
};
10342
10447
10343
10448
} // namespace ada
0 commit comments