@@ -287,13 +287,27 @@ bool ada_set_pathname(ada_url result, const char* input,
287287 return r->set_pathname (std::string_view (input, length));
288288}
289289
290+ /* *
291+ * Update the search/query of the URL.
292+ *
293+ * If a URL has `?` as the search value, passing empty string to this function
294+ * does not remove the attribute. If you need to remove it, please use
295+ * `ada_clear_search` method.
296+ */
290297void ada_set_search (ada_url result, const char * input, size_t length) noexcept {
291298 ada::result<ada::url_aggregator>& r = get_instance (result);
292299 if (r) {
293300 r->set_search (std::string_view (input, length));
294301 }
295302}
296303
304+ /* *
305+ * Update the hash/fragment of the URL.
306+ *
307+ * If a URL has `#` as the hash value, passing empty string to this function
308+ * does not remove the attribute. If you need to remove it, please use
309+ * `ada_clear_hash` method.
310+ */
297311void ada_set_hash (ada_url result, const char * input, size_t length) noexcept {
298312 ada::result<ada::url_aggregator>& r = get_instance (result);
299313 if (r) {
@@ -308,13 +322,25 @@ void ada_clear_port(ada_url result) noexcept {
308322 }
309323}
310324
325+ /* *
326+ * Removes the hash of the URL.
327+ *
328+ * Despite `ada_set_hash` method, this function allows the complete
329+ * removal of the hash attribute, even if it has a value of `#`.
330+ */
311331void ada_clear_hash (ada_url result) noexcept {
312332 ada::result<ada::url_aggregator>& r = get_instance (result);
313333 if (r) {
314334 r->clear_hash ();
315335 }
316336}
317337
338+ /* *
339+ * Removes the search of the URL.
340+ *
341+ * Despite `ada_set_search` method, this function allows the complete
342+ * removal of the search attribute, even if it has a value of `?`.
343+ */
318344void ada_clear_search (ada_url result) noexcept {
319345 ada::result<ada::url_aggregator>& r = get_instance (result);
320346 if (r) {
0 commit comments