Loading...
Searching...
No Matches
ada_c.cpp
Go to the documentation of this file.
// NOLINTBEGIN(bugprone-exception-escape,
// bugprone-suspicious-stringview-data-usage)
#include "ada/url_aggregator-inl.h"
#include "ada/url_search_params-inl.h"
ada::result<ada::url_aggregator>& get_instance(void* result) noexcept {
return *(ada::result<ada::url_aggregator>*)result;
}
extern "C" {
typedef void* ada_url;
typedef void* ada_url_search_params;
typedef void* ada_strings;
typedef void* ada_url_search_params_keys_iter;
typedef void* ada_url_search_params_values_iter;
typedef void* ada_url_search_params_entries_iter;
struct ada_string {
const char* data;
size_t length;
};
struct ada_owned_string {
const char* data;
size_t length;
};
struct ada_string_pair {
ada_string key;
ada_string value;
};
ada_string ada_string_create(const char* data, size_t length) {
ada_string out{};
out.data = data;
out.length = length;
return out;
}
struct ada_url_components {
/*
* By using 32-bit integers, we implicitly assume that the URL string
* cannot exceed 4 GB.
*
* https://user:pass@example.com:1234/foo/bar?baz#quux
* | | | | ^^^^| | |
* | | | | | | | `----- hash_start
* | | | | | | `--------- search_start
* | | | | | `----------------- pathname_start
* | | | | `--------------------- port
* | | | `----------------------- host_end
* | | `---------------------------------- host_start
* | `--------------------------------------- username_end
* `--------------------------------------------- protocol_end
*/
uint32_t protocol_end;
uint32_t username_end;
uint32_t host_start;
uint32_t host_end;
uint32_t port;
uint32_t pathname_start;
uint32_t search_start;
uint32_t hash_start;
};
ada_url ada_parse(const char* input, size_t length) noexcept {
return new ada::result<ada::url_aggregator>(
ada::parse<ada::url_aggregator>(std::string_view(input, length)));
}
ada_url ada_parse_with_base(const char* input, size_t input_length,
const char* base, size_t base_length) noexcept {
auto base_out =
ada::parse<ada::url_aggregator>(std::string_view(base, base_length));
if (!base_out) {
return new ada::result<ada::url_aggregator>(base_out);
}
return new ada::result<ada::url_aggregator>(ada::parse<ada::url_aggregator>(
std::string_view(input, input_length), &base_out.value()));
}
bool ada_can_parse(const char* input, size_t length) noexcept {
return ada::can_parse(std::string_view(input, length));
}
bool ada_can_parse_with_base(const char* input, size_t input_length,
const char* base, size_t base_length) noexcept {
std::string_view base_view(base, base_length);
return ada::can_parse(std::string_view(input, input_length), &base_view);
}
void ada_free(ada_url result) noexcept {
auto* r = (ada::result<ada::url_aggregator>*)result;
delete r;
}
ada_url ada_copy(ada_url input) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(input);
return new ada::result<ada::url_aggregator>(r);
}
bool ada_is_valid(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
return r.has_value();
}
// caller must free the result with ada_free_owned_string
ada_owned_string ada_get_origin(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
ada_owned_string owned{};
if (!r) {
owned.data = nullptr;
owned.length = 0;
return owned;
}
std::string out = r->get_origin();
owned.length = out.size();
owned.data = new char[owned.length];
memcpy((void*)owned.data, out.data(), owned.length);
return owned;
}
void ada_free_owned_string(ada_owned_string owned) noexcept {
delete[] owned.data;
}
ada_string ada_get_href(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_href();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_username(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_username();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_password(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_password();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_port(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_port();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_hash(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_hash();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_host(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_host();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_hostname(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_hostname();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_pathname(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_pathname();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_search(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_search();
return ada_string_create(out.data(), out.length());
}
ada_string ada_get_protocol(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view out = r->get_protocol();
return ada_string_create(out.data(), out.length());
}
uint8_t ada_get_host_type(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return 0;
}
return r->host_type;
}
uint8_t ada_get_scheme_type(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return 0;
}
return r->type;
}
bool ada_set_href(ada_url result, const char* input, size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_href(std::string_view(input, length));
}
bool ada_set_host(ada_url result, const char* input, size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_host(std::string_view(input, length));
}
bool ada_set_hostname(ada_url result, const char* input,
size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_hostname(std::string_view(input, length));
}
bool ada_set_protocol(ada_url result, const char* input,
size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_protocol(std::string_view(input, length));
}
bool ada_set_username(ada_url result, const char* input,
size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_username(std::string_view(input, length));
}
bool ada_set_password(ada_url result, const char* input,
size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_password(std::string_view(input, length));
}
bool ada_set_port(ada_url result, const char* input, size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_port(std::string_view(input, length));
}
bool ada_set_pathname(ada_url result, const char* input,
size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->set_pathname(std::string_view(input, length));
}
void ada_set_search(ada_url result, const char* input, size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (r) {
r->set_search(std::string_view(input, length));
}
}
void ada_set_hash(ada_url result, const char* input, size_t length) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (r) {
r->set_hash(std::string_view(input, length));
}
}
void ada_clear_port(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (r) {
r->clear_port();
}
}
void ada_clear_hash(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (r) {
r->clear_hash();
}
}
void ada_clear_search(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (r) {
r->clear_search();
}
}
bool ada_has_credentials(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_credentials();
}
bool ada_has_empty_hostname(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_empty_hostname();
}
bool ada_has_hostname(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_hostname();
}
bool ada_has_non_empty_username(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_non_empty_username();
}
bool ada_has_non_empty_password(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_non_empty_password();
}
bool ada_has_port(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_port();
}
bool ada_has_password(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_password();
}
bool ada_has_hash(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_hash();
}
bool ada_has_search(ada_url result) noexcept {
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return false;
}
return r->has_search();
}
// returns a pointer to the internal url_aggregator::url_components
const ada_url_components* ada_get_components(ada_url result) noexcept {
static_assert(sizeof(ada_url_components) == sizeof(ada::url_components));
ada::result<ada::url_aggregator>& r = get_instance(result);
if (!r) {
return nullptr;
}
return reinterpret_cast<const ada_url_components*>(&r->get_components());
}
ada_owned_string ada_idna_to_unicode(const char* input, size_t length) {
std::string out = ada::idna::to_unicode(std::string_view(input, length));
ada_owned_string owned{};
owned.length = out.length();
owned.data = new char[owned.length];
memcpy((void*)owned.data, out.data(), owned.length);
return owned;
}
ada_owned_string ada_idna_to_ascii(const char* input, size_t length) {
std::string out = ada::idna::to_ascii(std::string_view(input, length));
ada_owned_string owned{};
owned.length = out.size();
owned.data = new char[owned.length];
memcpy((void*)owned.data, out.data(), owned.length);
return owned;
}
ada_url_search_params ada_parse_search_params(const char* input,
size_t length) {
return new ada::result<ada::url_search_params>(
ada::url_search_params(std::string_view(input, length)));
}
void ada_free_search_params(ada_url_search_params result) {
auto* r = (ada::result<ada::url_search_params>*)result;
delete r;
}
ada_owned_string ada_search_params_to_string(ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) return ada_owned_string{nullptr, 0};
std::string out = r->to_string();
ada_owned_string owned{};
owned.length = out.size();
owned.data = new char[owned.length];
memcpy((void*)owned.data, out.data(), owned.length);
return owned;
}
size_t ada_search_params_size(ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return 0;
}
return r->size();
}
void ada_search_params_sort(ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) {
r->sort();
}
}
void ada_search_params_reset(ada_url_search_params result, const char* input,
size_t length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) {
r->reset(std::string_view(input, length));
}
}
void ada_search_params_append(ada_url_search_params result, const char* key,
size_t key_length, const char* value,
size_t value_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) {
r->append(std::string_view(key, key_length),
std::string_view(value, value_length));
}
}
void ada_search_params_set(ada_url_search_params result, const char* key,
size_t key_length, const char* value,
size_t value_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) {
r->set(std::string_view(key, key_length),
std::string_view(value, value_length));
}
}
void ada_search_params_remove(ada_url_search_params result, const char* key,
size_t key_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) {
r->remove(std::string_view(key, key_length));
}
}
void ada_search_params_remove_value(ada_url_search_params result,
const char* key, size_t key_length,
const char* value, size_t value_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) {
r->remove(std::string_view(key, key_length),
std::string_view(value, value_length));
}
}
bool ada_search_params_has(ada_url_search_params result, const char* key,
size_t key_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return false;
}
return r->has(std::string_view(key, key_length));
}
bool ada_search_params_has_value(ada_url_search_params result, const char* key,
size_t key_length, const char* value,
size_t value_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return false;
}
return r->has(std::string_view(key, key_length),
std::string_view(value, value_length));
}
ada_string ada_search_params_get(ada_url_search_params result, const char* key,
size_t key_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return ada_string_create(nullptr, 0);
}
auto found = r->get(std::string_view(key, key_length));
if (!found.has_value()) {
return ada_string_create(nullptr, 0);
}
return ada_string_create(found->data(), found->length());
}
ada_strings ada_search_params_get_all(ada_url_search_params result,
const char* key, size_t key_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return new ada::result<std::vector<std::string>>(
std::vector<std::string>());
}
return new ada::result<std::vector<std::string>>(
r->get_all(std::string_view(key, key_length)));
}
ada_url_search_params_keys_iter ada_search_params_get_keys(
ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return new ada::result<ada::url_search_params_keys_iter>(
ada::url_search_params_keys_iter());
}
return new ada::result<ada::url_search_params_keys_iter>(r->get_keys());
}
ada_url_search_params_values_iter ada_search_params_get_values(
ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return new ada::result<ada::url_search_params_values_iter>(
ada::url_search_params_values_iter());
}
return new ada::result<ada::url_search_params_values_iter>(r->get_values());
}
ada_url_search_params_entries_iter ada_search_params_get_entries(
ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) {
return new ada::result<ada::url_search_params_entries_iter>(
ada::url_search_params_entries_iter());
}
return new ada::result<ada::url_search_params_entries_iter>(r->get_entries());
}
void ada_free_strings(ada_strings result) {
auto* r = (ada::result<std::vector<std::string>>*)result;
delete r;
}
size_t ada_strings_size(ada_strings result) {
auto* r = (ada::result<std::vector<std::string>>*)result;
if (!r) {
return 0;
}
return (*r)->size();
}
ada_string ada_strings_get(ada_strings result, size_t index) {
auto* r = (ada::result<std::vector<std::string>>*)result;
if (!r) {
return ada_string_create(nullptr, 0);
}
std::string_view view = (*r)->at(index);
return ada_string_create(view.data(), view.length());
}
void ada_free_search_params_keys_iter(ada_url_search_params_keys_iter result) {
auto* r = (ada::result<ada::url_search_params_keys_iter>*)result;
delete r;
}
ada_string ada_search_params_keys_iter_next(
ada_url_search_params_keys_iter result) {
auto* r = (ada::result<ada::url_search_params_keys_iter>*)result;
if (!r) {
return ada_string_create(nullptr, 0);
}
auto next = (*r)->next();
if (!next.has_value()) {
return ada_string_create(nullptr, 0);
}
return ada_string_create(next->data(), next->length());
}
bool ada_search_params_keys_iter_has_next(
ada_url_search_params_keys_iter result) {
auto* r = (ada::result<ada::url_search_params_keys_iter>*)result;
if (!r) {
return false;
}
return (*r)->has_next();
}
void ada_free_search_params_values_iter(
ada_url_search_params_values_iter result) {
auto* r = (ada::result<ada::url_search_params_values_iter>*)result;
delete r;
}
ada_string ada_search_params_values_iter_next(
ada_url_search_params_values_iter result) {
auto* r = (ada::result<ada::url_search_params_values_iter>*)result;
if (!r) {
return ada_string_create(nullptr, 0);
}
auto next = (*r)->next();
if (!next.has_value()) {
return ada_string_create(nullptr, 0);
}
return ada_string_create(next->data(), next->length());
}
bool ada_search_params_values_iter_has_next(
ada_url_search_params_values_iter result) {
auto* r = (ada::result<ada::url_search_params_values_iter>*)result;
if (!r) {
return false;
}
return (*r)->has_next();
}
void ada_free_search_params_entries_iter(
ada_url_search_params_entries_iter result) {
auto* r = (ada::result<ada::url_search_params_entries_iter>*)result;
delete r;
}
ada_string_pair ada_search_params_entries_iter_next(
ada_url_search_params_entries_iter result) {
auto* r = (ada::result<ada::url_search_params_entries_iter>*)result;
if (!r) return {ada_string_create(nullptr, 0), ada_string_create(nullptr, 0)};
auto next = (*r)->next();
if (!next.has_value()) {
return {ada_string_create(nullptr, 0), ada_string_create(nullptr, 0)};
}
return ada_string_pair{
ada_string_create(next->first.data(), next->first.length()),
ada_string_create(next->second.data(), next->second.length())};
}
bool ada_search_params_entries_iter_has_next(
ada_url_search_params_entries_iter result) {
auto* r = (ada::result<ada::url_search_params_entries_iter>*)result;
if (!r) {
return false;
}
return (*r)->has_next();
}
typedef struct {
int major;
int minor;
int revision;
} ada_version_components;
const char* ada_get_version() { return ADA_VERSION; }
ada_version_components ada_get_version_components() {
return ada_version_components{
.major = ada::ADA_VERSION_MAJOR,
.minor = ada::ADA_VERSION_MINOR,
.revision = ada::ADA_VERSION_REVISION,
};
}
} // extern "C"
// NOLINTEND(bugprone-exception-escape,
// bugprone-suspicious-stringview-data-usage)
ada_parse_search_params
ada_url_search_params ada_parse_search_params(const char *input, size_t length)
Definition ada_c.cpp:469
ada_get_search
ada_string ada_get_search(ada_url result) noexcept
Definition ada_c.cpp:205
ada_search_params_get_all
ada_strings ada_search_params_get_all(ada_url_search_params result, const char *key, size_t key_length)
Definition ada_c.cpp:596
ada_get_scheme_type
uint8_t ada_get_scheme_type(ada_url result) noexcept
Definition ada_c.cpp:231
ada_has_search
bool ada_has_search(ada_url result) noexcept
Definition ada_c.cpp:433
ada_free_search_params_entries_iter
void ada_free_search_params_entries_iter(ada_url_search_params_entries_iter result)
Definition ada_c.cpp:718
ada_search_params_keys_iter_has_next
bool ada_search_params_keys_iter_has_next(ada_url_search_params_keys_iter result)
Definition ada_c.cpp:681
ada_search_params_values_iter_next
ada_string ada_search_params_values_iter_next(ada_url_search_params_values_iter result)
Definition ada_c.cpp:696
ada_free_search_params_keys_iter
void ada_free_search_params_keys_iter(ada_url_search_params_keys_iter result)
Definition ada_c.cpp:663
ada_clear_hash
void ada_clear_hash(ada_url result) noexcept
Definition ada_c.cpp:349
ada_search_params_has_value
bool ada_search_params_has_value(ada_url_search_params result, const char *key, size_t key_length, const char *value, size_t value_length)
Definition ada_c.cpp:570
ada_free_strings
void ada_free_strings(ada_strings result)
Definition ada_c.cpp:641
ada_search_params_append
void ada_search_params_append(ada_url_search_params result, const char *key, size_t key_length, const char *value, size_t value_length)
Definition ada_c.cpp:518
ada_search_params_get_entries
ada_url_search_params_entries_iter ada_search_params_get_entries(ada_url_search_params result)
Definition ada_c.cpp:630
ada_search_params_get
ada_string ada_search_params_get(ada_url_search_params result, const char *key, size_t key_length)
Definition ada_c.cpp:582
ada_free
void ada_free(ada_url result) noexcept
Definition ada_c.cpp:98
ada_can_parse_with_base
bool ada_can_parse_with_base(const char *input, size_t input_length, const char *base, size_t base_length) noexcept
Definition ada_c.cpp:92
ada_free_owned_string
void ada_free_owned_string(ada_owned_string owned) noexcept
Definition ada_c.cpp:129
ada_parse
ada_url ada_parse(const char *input, size_t length) noexcept
Definition ada_c.cpp:70
ada_get_version
const char * ada_get_version()
Definition ada_c.cpp:752
ada_get_version_components
ada_version_components ada_get_version_components()
Definition ada_c.cpp:754
ada_get_host_type
uint8_t ada_get_host_type(ada_url result) noexcept
Definition ada_c.cpp:223
ada_get_protocol
ada_string ada_get_protocol(ada_url result) noexcept
Definition ada_c.cpp:214
ada_search_params_sort
void ada_search_params_sort(ada_url_search_params result)
Definition ada_c.cpp:501
ada_has_credentials
bool ada_has_credentials(ada_url result) noexcept
Definition ada_c.cpp:369
ada_set_pathname
bool ada_set_pathname(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:299
ada_get_host
ada_string ada_get_host(ada_url result) noexcept
Definition ada_c.cpp:178
ada_set_password
bool ada_set_password(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:282
ada_get_port
ada_string ada_get_port(ada_url result) noexcept
Definition ada_c.cpp:160
ada_string_create
ada_string ada_string_create(const char *data, size_t length)
Definition ada_c.cpp:33
get_instance
ada::result< ada::url_aggregator > & get_instance(void *result) noexcept
Definition ada_c.cpp:6
ada_idna_to_unicode
ada_owned_string ada_idna_to_unicode(const char *input, size_t length)
Definition ada_c.cpp:451
ada_get_hash
ada_string ada_get_hash(ada_url result) noexcept
Definition ada_c.cpp:169
ada_get_origin
ada_owned_string ada_get_origin(ada_url result) noexcept
Definition ada_c.cpp:114
ada_search_params_remove_value
void ada_search_params_remove_value(ada_url_search_params result, const char *key, size_t key_length, const char *value, size_t value_length)
Definition ada_c.cpp:549
ada_get_hostname
ada_string ada_get_hostname(ada_url result) noexcept
Definition ada_c.cpp:187
ada_free_search_params
void ada_free_search_params(ada_url_search_params result)
Definition ada_c.cpp:475
ada_set_username
bool ada_set_username(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:273
ada_has_empty_hostname
bool ada_has_empty_hostname(ada_url result) noexcept
Definition ada_c.cpp:377
ada_has_hash
bool ada_has_hash(ada_url result) noexcept
Definition ada_c.cpp:425
ada_get_href
ada_string ada_get_href(ada_url result) noexcept
Definition ada_c.cpp:133
ada_get_password
ada_string ada_get_password(ada_url result) noexcept
Definition ada_c.cpp:151
ada_set_protocol
bool ada_set_protocol(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:264
ada_can_parse
bool ada_can_parse(const char *input, size_t length) noexcept
Definition ada_c.cpp:88
ada_is_valid
bool ada_is_valid(ada_url result) noexcept
Definition ada_c.cpp:108
ada_search_params_to_string
ada_owned_string ada_search_params_to_string(ada_url_search_params result)
Definition ada_c.cpp:480
ada_strings_get
ada_string ada_strings_get(ada_strings result, size_t index)
Definition ada_c.cpp:654
ada_set_search
void ada_set_search(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:315
ada_get_components
const ada_url_components * ada_get_components(ada_url result) noexcept
Definition ada_c.cpp:442
ada_search_params_entries_iter_has_next
bool ada_search_params_entries_iter_has_next(ada_url_search_params_entries_iter result)
Definition ada_c.cpp:737
ada_search_params_size
size_t ada_search_params_size(ada_url_search_params result)
Definition ada_c.cpp:492
ada_get_pathname
ada_string ada_get_pathname(ada_url result) noexcept
Definition ada_c.cpp:196
ada_free_search_params_values_iter
void ada_free_search_params_values_iter(ada_url_search_params_values_iter result)
Definition ada_c.cpp:690
ada_parse_with_base
ada_url ada_parse_with_base(const char *input, size_t input_length, const char *base, size_t base_length) noexcept
Definition ada_c.cpp:75
ada_search_params_keys_iter_next
ada_string ada_search_params_keys_iter_next(ada_url_search_params_keys_iter result)
Definition ada_c.cpp:668
ada_clear_port
void ada_clear_port(ada_url result) noexcept
Definition ada_c.cpp:336
ada_set_hostname
bool ada_set_hostname(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:255
ada_has_hostname
bool ada_has_hostname(ada_url result) noexcept
Definition ada_c.cpp:385
ada_search_params_entries_iter_next
ada_string_pair ada_search_params_entries_iter_next(ada_url_search_params_entries_iter result)
Definition ada_c.cpp:724
ada_search_params_get_keys
ada_url_search_params_keys_iter ada_search_params_get_keys(ada_url_search_params result)
Definition ada_c.cpp:608
ada_idna_to_ascii
ada_owned_string ada_idna_to_ascii(const char *input, size_t length)
Definition ada_c.cpp:460
ada_has_non_empty_password
bool ada_has_non_empty_password(ada_url result) noexcept
Definition ada_c.cpp:401
ada_set_href
bool ada_set_href(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:239
ada_copy
ada_url ada_copy(ada_url input) noexcept
Definition ada_c.cpp:103
ada_has_password
bool ada_has_password(ada_url result) noexcept
Definition ada_c.cpp:417
ada_search_params_values_iter_has_next
bool ada_search_params_values_iter_has_next(ada_url_search_params_values_iter result)
Definition ada_c.cpp:709
ada_set_port
bool ada_set_port(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:291
ada_has_port
bool ada_has_port(ada_url result) noexcept
Definition ada_c.cpp:409
ada_search_params_set
void ada_search_params_set(ada_url_search_params result, const char *key, size_t key_length, const char *value, size_t value_length)
Definition ada_c.cpp:529
ada_set_host
bool ada_set_host(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:247
ada_strings_size
size_t ada_strings_size(ada_strings result)
Definition ada_c.cpp:646
ada_search_params_get_values
ada_url_search_params_values_iter ada_search_params_get_values(ada_url_search_params result)
Definition ada_c.cpp:619
ada_set_hash
void ada_set_hash(ada_url result, const char *input, size_t length) noexcept
Definition ada_c.cpp:329
ada_search_params_has
bool ada_search_params_has(ada_url_search_params result, const char *key, size_t key_length)
Definition ada_c.cpp:560
ada_has_non_empty_username
bool ada_has_non_empty_username(ada_url result) noexcept
Definition ada_c.cpp:393
ada_search_params_reset
void ada_search_params_reset(ada_url_search_params result, const char *input, size_t length)
Definition ada_c.cpp:509
ada_search_params_remove
void ada_search_params_remove(ada_url_search_params result, const char *key, size_t key_length)
Definition ada_c.cpp:540
ada_clear_search
void ada_clear_search(ada_url result) noexcept
Definition ada_c.cpp:362
ada_get_username
ada_string ada_get_username(ada_url result) noexcept
Definition ada_c.cpp:142
ada_url_search_params_entries_iter
void * ada_url_search_params_entries_iter
Definition ada_c.h:125
ada_strings
void * ada_strings
Definition ada_c.h:116
ada_url_search_params
void * ada_url_search_params
Definition ada_c.h:113
ada_url
void * ada_url
Definition ada_c.h:39
ada_url_search_params_keys_iter
void * ada_url_search_params_keys_iter
Definition ada_c.h:117
ada_url_search_params_values_iter
void * ada_url_search_params_values_iter
Definition ada_c.h:118
ADA_VERSION
#define ADA_VERSION
Definition ada_version.h:8
ada::idna::to_ascii
std::string to_ascii(std::string_view ut8_string)
Definition ada_idna.cpp:9539
ada::idna::to_unicode
std::string to_unicode(std::string_view input)
Definition ada_idna.cpp:9655
ada::url_search_params_values_iter
url_search_params_iter< std::string_view, url_search_params_iter_type::VALUES > url_search_params_values_iter
Definition url_search_params.h:40
ada::can_parse
bool can_parse(std::string_view input, const std::string_view *base_input=nullptr)
Definition implementation.cpp:51
ada::url_search_params_entries_iter
url_search_params_iter< key_value_view_pair, url_search_params_iter_type::ENTRIES > url_search_params_entries_iter
Definition url_search_params.h:44
ada::url_search_params_keys_iter
url_search_params_iter< std::string_view, url_search_params_iter_type::KEYS > url_search_params_keys_iter
Definition url_search_params.h:37
ada::result
tl::expected< result_type, ada::errors > result
Definition implementation.h:44
ada::ADA_VERSION_MINOR
@ ADA_VERSION_MINOR
Definition ada_version.h:14
ada::ADA_VERSION_REVISION
@ ADA_VERSION_REVISION
Definition ada_version.h:15
ada::ADA_VERSION_MAJOR
@ ADA_VERSION_MAJOR
Definition ada_version.h:13
ada::parse
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
Definition implementation.cpp:13
ada::url_components
Stores byte offsets for URL components within a buffer.
Definition url_components.h:39
ada::url_search_params
Class for parsing and manipulating URL query strings.
Definition url_search_params.h:60
ada_owned_string
Definition ada_c.h:23
ada_owned_string::length
size_t length
Definition ada_c.h:25
ada_owned_string::data
const char * data
Definition ada_c.h:24
ada_string_pair
Definition ada_c.h:120
ada_string_pair::value
ada_string value
Definition ada_c.h:122
ada_string_pair::key
ada_string key
Definition ada_c.h:121
ada_string
Definition ada_c.h:17
ada_string::data
const char * data
Definition ada_c.h:18
ada_string::length
size_t length
Definition ada_c.h:19
ada_url_components
Definition ada_c.h:28
ada_url_components::username_end
uint32_t username_end
Definition ada_c.h:30
ada_url_components::host_end
uint32_t host_end
Definition ada_c.h:32
ada_url_components::hash_start
uint32_t hash_start
Definition ada_c.h:36
ada_url_components::pathname_start
uint32_t pathname_start
Definition ada_c.h:34
ada_url_components::port
uint32_t port
Definition ada_c.h:33
ada_url_components::protocol_end
uint32_t protocol_end
Definition ada_c.h:29
ada_url_components::search_start
uint32_t search_start
Definition ada_c.h:35
ada_url_components::host_start
uint32_t host_start
Definition ada_c.h:31
ada_version_components
Definition ada_c.h:188
url_aggregator-inl.h
Inline functions for url aggregator.
url_search_params-inl.h
Inline declarations for the URL Search Params.