@@ -287,13 +287,27 @@ bool ada_set_pathname(ada_url result, const char* input,
287
287
return r->set_pathname (std::string_view (input, length));
288
288
}
289
289
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
+ */
290
297
void ada_set_search (ada_url result, const char * input, size_t length) noexcept {
291
298
ada::result<ada::url_aggregator>& r = get_instance (result);
292
299
if (r) {
293
300
r->set_search (std::string_view (input, length));
294
301
}
295
302
}
296
303
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
+ */
297
311
void ada_set_hash (ada_url result, const char * input, size_t length) noexcept {
298
312
ada::result<ada::url_aggregator>& r = get_instance (result);
299
313
if (r) {
@@ -308,13 +322,25 @@ void ada_clear_port(ada_url result) noexcept {
308
322
}
309
323
}
310
324
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
+ */
311
331
void ada_clear_hash (ada_url result) noexcept {
312
332
ada::result<ada::url_aggregator>& r = get_instance (result);
313
333
if (r) {
314
334
r->clear_hash ();
315
335
}
316
336
}
317
337
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
+ */
318
344
void ada_clear_search (ada_url result) noexcept {
319
345
ada::result<ada::url_aggregator>& r = get_instance (result);
320
346
if (r) {
0 commit comments