* We require all strings to be valid UTF-8. It is the user's responsibility to * ensure that the provided strings are valid UTF-8. * @see https://url.spec.whatwg.org/#interface-urlsearchparams */
| 8481 | * @see https://url.spec.whatwg.org/#interface-urlsearchparams |
| 8482 | */ |
| 8483 | struct url_search_params { |
| 8484 | url_search_params() = default; |
| 8485 | |
| 8486 | /** |
| 8487 | * @see |
| 8488 | * https://github.com/web-platform-tests/wpt/blob/master/url/urlsearchparams-constructor.any.js |
| 8489 | */ |
| 8490 | explicit url_search_params(const std::string_view input) { |
| 8491 | initialize(input); |
| 8492 | } |
| 8493 | |
| 8494 | url_search_params(const url_search_params &u) = default; |
| 8495 | url_search_params(url_search_params &&u) noexcept = default; |
| 8496 | url_search_params &operator=(url_search_params &&u) noexcept = default; |
| 8497 | url_search_params &operator=(const url_search_params &u) = default; |
| 8498 | ~url_search_params() = default; |
| 8499 | |
| 8500 | [[nodiscard]] inline size_t size() const noexcept; |
| 8501 | |
| 8502 | /** |
| 8503 | * Both key and value must be valid UTF-8. |
| 8504 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-append |
| 8505 | */ |
| 8506 | inline void append(std::string_view key, std::string_view value); |
| 8507 | |
| 8508 | /** |
| 8509 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-delete |
| 8510 | */ |
| 8511 | inline void remove(std::string_view key); |
| 8512 | inline void remove(std::string_view key, std::string_view value); |
| 8513 | |
| 8514 | /** |
| 8515 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-get |
| 8516 | */ |
| 8517 | inline std::optional<std::string_view> get(std::string_view key); |
| 8518 | |
| 8519 | /** |
| 8520 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-getall |
| 8521 | */ |
| 8522 | inline std::vector<std::string> get_all(std::string_view key); |
| 8523 | |
| 8524 | /** |
| 8525 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-has |
| 8526 | */ |
| 8527 | inline bool has(std::string_view key) noexcept; |
| 8528 | inline bool has(std::string_view key, std::string_view value) noexcept; |
| 8529 | |
| 8530 | /** |
| 8531 | * Both key and value must be valid UTF-8. |
| 8532 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-set |
| 8533 | */ |
| 8534 | inline void set(std::string_view key, std::string_view value); |
| 8535 | |
| 8536 | /** |
| 8537 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-sort |
| 8538 | */ |
| 8539 | inline void sort(); |
| 8540 |
no outgoing calls
no test coverage detected