Ada 2.7.8
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
ada_c.h File Reference

Includes the C definitions for Ada. This is a C file, not C++. More...

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Classes

struct  ada_string
 
struct  ada_owned_string
 
struct  ada_url_components
 
struct  ada_string_pair
 

Macros

#define ada_url_omitted   0xffffffff
 

Typedefs

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
 

Functions

ada_url ada_parse (const char *input, size_t length)
 
ada_url ada_parse_with_base (const char *input, size_t input_length, const char *base, size_t base_length)
 
bool ada_can_parse (const char *input, size_t length)
 
bool ada_can_parse_with_base (const char *input, size_t input_length, const char *base, size_t base_length)
 
void ada_free (ada_url result)
 
void ada_free_owned_string (ada_owned_string owned)
 
ada_url ada_copy (ada_url input)
 
bool ada_is_valid (ada_url result)
 
ada_owned_string ada_get_origin (ada_url result)
 
ada_string ada_get_href (ada_url result)
 
ada_string ada_get_username (ada_url result)
 
ada_string ada_get_password (ada_url result)
 
ada_string ada_get_port (ada_url result)
 
ada_string ada_get_hash (ada_url result)
 
ada_string ada_get_host (ada_url result)
 
ada_string ada_get_hostname (ada_url result)
 
ada_string ada_get_pathname (ada_url result)
 
ada_string ada_get_search (ada_url result)
 
ada_string ada_get_protocol (ada_url result)
 
uint8_t ada_get_host_type (ada_url result)
 
uint8_t ada_get_scheme_type (ada_url result)
 
bool ada_set_href (ada_url result, const char *input, size_t length)
 
bool ada_set_host (ada_url result, const char *input, size_t length)
 
bool ada_set_hostname (ada_url result, const char *input, size_t length)
 
bool ada_set_protocol (ada_url result, const char *input, size_t length)
 
bool ada_set_username (ada_url result, const char *input, size_t length)
 
bool ada_set_password (ada_url result, const char *input, size_t length)
 
bool ada_set_port (ada_url result, const char *input, size_t length)
 
bool ada_set_pathname (ada_url result, const char *input, size_t length)
 
void ada_set_search (ada_url result, const char *input, size_t length)
 
void ada_set_hash (ada_url result, const char *input, size_t length)
 
void ada_clear_port (ada_url result)
 
void ada_clear_hash (ada_url result)
 
void ada_clear_search (ada_url result)
 
bool ada_has_credentials (ada_url result)
 
bool ada_has_empty_hostname (ada_url result)
 
bool ada_has_hostname (ada_url result)
 
bool ada_has_non_empty_username (ada_url result)
 
bool ada_has_non_empty_password (ada_url result)
 
bool ada_has_port (ada_url result)
 
bool ada_has_password (ada_url result)
 
bool ada_has_hash (ada_url result)
 
bool ada_has_search (ada_url result)
 
const ada_url_componentsada_get_components (ada_url result)
 
ada_owned_string ada_idna_to_unicode (const char *input, size_t length)
 
ada_owned_string ada_idna_to_ascii (const char *input, size_t length)
 
ada_url_search_params ada_parse_search_params (const char *input, size_t length)
 
void ada_free_search_params (ada_url_search_params result)
 
size_t ada_search_params_size (ada_url_search_params result)
 
void ada_search_params_sort (ada_url_search_params result)
 
ada_owned_string ada_search_params_to_string (ada_url_search_params result)
 
void ada_search_params_append (ada_url_search_params result, const char *key, size_t key_length, const char *value, size_t 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)
 
void ada_search_params_remove (ada_url_search_params result, const char *key, size_t 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)
 
bool ada_search_params_has (ada_url_search_params result, const char *key, size_t 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_string ada_search_params_get (ada_url_search_params result, const char *key, size_t key_length)
 
ada_strings ada_search_params_get_all (ada_url_search_params result, const char *key, size_t key_length)
 
ada_url_search_params_keys_iter ada_search_params_get_keys (ada_url_search_params result)
 
ada_url_search_params_values_iter ada_search_params_get_values (ada_url_search_params result)
 
ada_url_search_params_entries_iter ada_search_params_get_entries (ada_url_search_params result)
 
void ada_free_strings (ada_strings result)
 
size_t ada_strings_size (ada_strings result)
 
ada_string ada_strings_get (ada_strings result, size_t index)
 
void ada_free_search_params_keys_iter (ada_url_search_params_keys_iter result)
 
ada_string ada_search_params_keys_iter_next (ada_url_search_params_keys_iter result)
 
bool ada_search_params_keys_iter_has_next (ada_url_search_params_keys_iter result)
 
void ada_free_search_params_values_iter (ada_url_search_params_values_iter result)
 
ada_string ada_search_params_values_iter_next (ada_url_search_params_values_iter result)
 
bool ada_search_params_values_iter_has_next (ada_url_search_params_values_iter result)
 
void ada_free_search_params_entries_iter (ada_url_search_params_entries_iter result)
 
ada_string_pair ada_search_params_entries_iter_next (ada_url_search_params_entries_iter result)
 
bool ada_search_params_entries_iter_has_next (ada_url_search_params_entries_iter result)
 

Detailed Description

Includes the C definitions for Ada. This is a C file, not C++.

Definition in file ada_c.h.

Macro Definition Documentation

◆ ada_url_omitted

#define ada_url_omitted   0xffffffff

Definition at line 14 of file ada_c.h.

Typedef Documentation

◆ ada_strings

typedef void* ada_strings

Definition at line 116 of file ada_c.h.

◆ ada_url

typedef void* ada_url

Definition at line 39 of file ada_c.h.

◆ ada_url_search_params

typedef void* ada_url_search_params

Definition at line 113 of file ada_c.h.

◆ ada_url_search_params_entries_iter

Definition at line 125 of file ada_c.h.

◆ ada_url_search_params_keys_iter

Definition at line 117 of file ada_c.h.

◆ ada_url_search_params_values_iter

Definition at line 118 of file ada_c.h.

Function Documentation

◆ ada_can_parse()

bool ada_can_parse ( const char * input,
size_t length )
noexcept

Definition at line 85 of file ada_c.cpp.

References ada::can_parse().

◆ 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 at line 89 of file ada_c.cpp.

References ada::can_parse().

◆ ada_clear_hash()

void ada_clear_hash ( ada_url result)
noexcept

Removes the hash of the URL.

Despite ada_set_hash method, this function allows the complete removal of the hash attribute, even if it has a value of #.

Definition at line 348 of file ada_c.cpp.

References get_instance().

◆ ada_clear_port()

void ada_clear_port ( ada_url result)
noexcept

Definition at line 335 of file ada_c.cpp.

References get_instance().

◆ ada_clear_search()

void ada_clear_search ( ada_url result)
noexcept

Removes the search of the URL.

Despite ada_set_search method, this function allows the complete removal of the search attribute, even if it has a value of ?.

Definition at line 361 of file ada_c.cpp.

References get_instance().

◆ ada_copy()

ada_url ada_copy ( ada_url input)
noexcept

Definition at line 100 of file ada_c.cpp.

References get_instance(), and ada::parse().

◆ ada_free()

void ada_free ( ada_url result)
noexcept

Definition at line 95 of file ada_c.cpp.

◆ ada_free_owned_string()

void ada_free_owned_string ( ada_owned_string owned)
noexcept

Definition at line 126 of file ada_c.cpp.

◆ ada_free_search_params()

void ada_free_search_params ( ada_url_search_params result)

Definition at line 474 of file ada_c.cpp.

◆ ada_free_search_params_entries_iter()

void ada_free_search_params_entries_iter ( ada_url_search_params_entries_iter result)

Definition at line 708 of file ada_c.cpp.

◆ ada_free_search_params_keys_iter()

void ada_free_search_params_keys_iter ( ada_url_search_params_keys_iter result)

Definition at line 653 of file ada_c.cpp.

◆ ada_free_search_params_values_iter()

void ada_free_search_params_values_iter ( ada_url_search_params_values_iter result)

Definition at line 680 of file ada_c.cpp.

◆ ada_free_strings()

void ada_free_strings ( ada_strings result)

Definition at line 631 of file ada_c.cpp.

◆ ada_get_components()

const ada_url_components * ada_get_components ( ada_url result)
noexcept

Definition at line 441 of file ada_c.cpp.

References get_instance().

◆ ada_get_hash()

ada_string ada_get_hash ( ada_url result)
noexcept

Definition at line 168 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_host()

ada_string ada_get_host ( ada_url result)
noexcept

Definition at line 177 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_host_type()

uint8_t ada_get_host_type ( ada_url result)
noexcept

Definition at line 222 of file ada_c.cpp.

References get_instance().

◆ ada_get_hostname()

ada_string ada_get_hostname ( ada_url result)
noexcept

Definition at line 186 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_href()

ada_string ada_get_href ( ada_url result)
noexcept

Definition at line 132 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_origin()

ada_owned_string ada_get_origin ( ada_url result)
noexcept

Definition at line 111 of file ada_c.cpp.

References ada_owned_string::data, and get_instance().

◆ ada_get_password()

ada_string ada_get_password ( ada_url result)
noexcept

Definition at line 150 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_pathname()

ada_string ada_get_pathname ( ada_url result)
noexcept

Definition at line 195 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_port()

ada_string ada_get_port ( ada_url result)
noexcept

Definition at line 159 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_protocol()

ada_string ada_get_protocol ( ada_url result)
noexcept

Definition at line 213 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_scheme_type()

uint8_t ada_get_scheme_type ( ada_url result)
noexcept

Definition at line 230 of file ada_c.cpp.

References get_instance().

◆ ada_get_search()

ada_string ada_get_search ( ada_url result)
noexcept

Definition at line 204 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_get_username()

ada_string ada_get_username ( ada_url result)
noexcept

Definition at line 141 of file ada_c.cpp.

References ada_string_create(), and get_instance().

◆ ada_has_credentials()

bool ada_has_credentials ( ada_url result)
noexcept

Definition at line 368 of file ada_c.cpp.

References get_instance().

◆ ada_has_empty_hostname()

bool ada_has_empty_hostname ( ada_url result)
noexcept

Definition at line 376 of file ada_c.cpp.

References get_instance().

◆ ada_has_hash()

bool ada_has_hash ( ada_url result)
noexcept

Definition at line 424 of file ada_c.cpp.

References get_instance().

◆ ada_has_hostname()

bool ada_has_hostname ( ada_url result)
noexcept

Definition at line 384 of file ada_c.cpp.

References get_instance().

◆ ada_has_non_empty_password()

bool ada_has_non_empty_password ( ada_url result)
noexcept

Definition at line 400 of file ada_c.cpp.

References get_instance().

◆ ada_has_non_empty_username()

bool ada_has_non_empty_username ( ada_url result)
noexcept

Definition at line 392 of file ada_c.cpp.

References get_instance().

◆ ada_has_password()

bool ada_has_password ( ada_url result)
noexcept

Definition at line 416 of file ada_c.cpp.

References get_instance().

◆ ada_has_port()

bool ada_has_port ( ada_url result)
noexcept

Definition at line 408 of file ada_c.cpp.

References get_instance().

◆ ada_has_search()

bool ada_has_search ( ada_url result)
noexcept

Definition at line 432 of file ada_c.cpp.

References get_instance().

◆ ada_idna_to_ascii()

ada_owned_string ada_idna_to_ascii ( const char * input,
size_t length )

Definition at line 459 of file ada_c.cpp.

References ada_owned_string::length, and ada::idna::to_ascii().

◆ ada_idna_to_unicode()

ada_owned_string ada_idna_to_unicode ( const char * input,
size_t length )

Definition at line 450 of file ada_c.cpp.

References ada_owned_string::length, and ada::idna::to_unicode().

◆ ada_is_valid()

bool ada_is_valid ( ada_url result)
noexcept

Definition at line 105 of file ada_c.cpp.

References get_instance().

◆ ada_parse()

ada_url ada_parse ( const char * input,
size_t length )
noexcept

Definition at line 67 of file ada_c.cpp.

References ada::parse().

◆ ada_parse_search_params()

ada_url_search_params ada_parse_search_params ( const char * input,
size_t length )

Definition at line 468 of file ada_c.cpp.

References ada::parse().

◆ 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 at line 72 of file ada_c.cpp.

References ada::parse().

◆ 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 at line 508 of file ada_c.cpp.

◆ ada_search_params_entries_iter_has_next()

bool ada_search_params_entries_iter_has_next ( ada_url_search_params_entries_iter result)

Definition at line 727 of file ada_c.cpp.

◆ ada_search_params_entries_iter_next()

ada_string_pair ada_search_params_entries_iter_next ( ada_url_search_params_entries_iter result)

Definition at line 714 of file ada_c.cpp.

References ada_string_create().

◆ ada_search_params_get()

ada_string ada_search_params_get ( ada_url_search_params result,
const char * key,
size_t key_length )

Definition at line 572 of file ada_c.cpp.

References ada_string_create().

◆ 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 at line 586 of file ada_c.cpp.

◆ ada_search_params_get_entries()

ada_url_search_params_entries_iter ada_search_params_get_entries ( ada_url_search_params result)

Definition at line 620 of file ada_c.cpp.

References ada::parse().

◆ ada_search_params_get_keys()

ada_url_search_params_keys_iter ada_search_params_get_keys ( ada_url_search_params result)

Definition at line 598 of file ada_c.cpp.

References ada::parse().

◆ ada_search_params_get_values()

ada_url_search_params_values_iter ada_search_params_get_values ( ada_url_search_params result)

Definition at line 609 of file ada_c.cpp.

References ada::parse().

◆ ada_search_params_has()

bool ada_search_params_has ( ada_url_search_params result,
const char * key,
size_t key_length )

Definition at line 550 of file ada_c.cpp.

◆ 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 at line 560 of file ada_c.cpp.

◆ ada_search_params_keys_iter_has_next()

bool ada_search_params_keys_iter_has_next ( ada_url_search_params_keys_iter result)

Definition at line 671 of file ada_c.cpp.

◆ ada_search_params_keys_iter_next()

ada_string ada_search_params_keys_iter_next ( ada_url_search_params_keys_iter result)

Definition at line 658 of file ada_c.cpp.

References ada_string_create().

◆ ada_search_params_remove()

void ada_search_params_remove ( ada_url_search_params result,
const char * key,
size_t key_length )

Definition at line 530 of file ada_c.cpp.

◆ 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 at line 539 of file ada_c.cpp.

◆ 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 at line 519 of file ada_c.cpp.

◆ ada_search_params_size()

size_t ada_search_params_size ( ada_url_search_params result)

Definition at line 491 of file ada_c.cpp.

◆ ada_search_params_sort()

void ada_search_params_sort ( ada_url_search_params result)

Definition at line 500 of file ada_c.cpp.

◆ ada_search_params_to_string()

ada_owned_string ada_search_params_to_string ( ada_url_search_params result)

Definition at line 479 of file ada_c.cpp.

References ada_owned_string::length.

◆ ada_search_params_values_iter_has_next()

bool ada_search_params_values_iter_has_next ( ada_url_search_params_values_iter result)

Definition at line 699 of file ada_c.cpp.

◆ ada_search_params_values_iter_next()

ada_string ada_search_params_values_iter_next ( ada_url_search_params_values_iter result)

Definition at line 686 of file ada_c.cpp.

References ada_string_create().

◆ ada_set_hash()

void ada_set_hash ( ada_url result,
const char * input,
size_t length )
noexcept

Update the hash/fragment of the URL.

If a URL has # as the hash value, passing empty string to this function does not remove the attribute. If you need to remove it, please use ada_clear_hash method.

Definition at line 328 of file ada_c.cpp.

References get_instance().

◆ ada_set_host()

bool ada_set_host ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 246 of file ada_c.cpp.

References get_instance().

◆ ada_set_hostname()

bool ada_set_hostname ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 254 of file ada_c.cpp.

References get_instance().

◆ ada_set_href()

bool ada_set_href ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 238 of file ada_c.cpp.

References get_instance().

◆ ada_set_password()

bool ada_set_password ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 281 of file ada_c.cpp.

References get_instance().

◆ ada_set_pathname()

bool ada_set_pathname ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 298 of file ada_c.cpp.

References get_instance().

◆ ada_set_port()

bool ada_set_port ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 290 of file ada_c.cpp.

References get_instance().

◆ ada_set_protocol()

bool ada_set_protocol ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 263 of file ada_c.cpp.

References get_instance().

◆ ada_set_search()

void ada_set_search ( ada_url result,
const char * input,
size_t length )
noexcept

Update the search/query of the URL.

If a URL has ? as the search value, passing empty string to this function does not remove the attribute. If you need to remove it, please use ada_clear_search method.

Definition at line 314 of file ada_c.cpp.

References get_instance().

◆ ada_set_username()

bool ada_set_username ( ada_url result,
const char * input,
size_t length )
noexcept

Definition at line 272 of file ada_c.cpp.

References get_instance().

◆ ada_strings_get()

ada_string ada_strings_get ( ada_strings result,
size_t index )

Definition at line 644 of file ada_c.cpp.

References ada_string_create().

◆ ada_strings_size()

size_t ada_strings_size ( ada_strings result)

Definition at line 636 of file ada_c.cpp.