Loading...
Searching...
No Matches
ada Namespace Reference

## Namespaces

namespace | idna
namespace | character_sets
| Includes the definitions for unicode character sets.
namespace | checkers
| Includes the definitions for validation functions.
namespace | helpers
| Includes the definitions for helper functions.
namespace | parser
| Internal URL parsing implementation.
namespace | scheme
| URL scheme utilities and constants.
namespace | serializers
| IP address serialization functions.
namespace | unicode
| Includes the declarations for unicode operations.

## Classes

struct | url
| Represents a parsed URL with individual string components. More...
struct | url_aggregator
| Memory-efficient URL representation using a single buffer. More...
struct | url_base
| Abstract base class for URL representations. More...
struct | url_components
| Stores byte offsets for URL components within a buffer. More...
struct | url_search_params_iter
| JavaScript-style iterator for url_search_params. More...
struct | url_search_params
| Class for parsing and manipulating URL query strings. More...

## Typedefs

template<class result_type = ada::url_aggregator>
using | result = tl::expected<result_type, ada::errors>
typedef std::pair< std::string_view, std::string_view > | key_value_view_pair
using | url_search_params_keys_iter
using | url_search_params_values_iter
using | url_search_params_entries_iter

## Enumerations

enum | { ADA_VERSION_MAJOR = 3 , ADA_VERSION_MINOR = 4 , ADA_VERSION_REVISION = 4 }
enum class | encoding_type { UTF8 , UTF_16LE , UTF_16BE }
| Character encoding types for URL processing. More...
enum class | errors : uint8_t { type_error }
| Error codes for URL parsing operations. More...
enum class | state { AUTHORITY , SCHEME_START , SCHEME , HOST , NO_SCHEME , FRAGMENT , RELATIVE_SCHEME , RELATIVE_SLASH , FILE , FILE_HOST , FILE_SLASH , PATH_OR_AUTHORITY , SPECIAL_AUTHORITY_IGNORE_SLASHES , SPECIAL_AUTHORITY_SLASHES , SPECIAL_RELATIVE_OR_AUTHORITY , QUERY , PATH , PATH_START , OPAQUE_PATH , PORT }
| States in the URL parsing state machine. More...
enum | url_host_type : uint8_t { DEFAULT = 0 , IPV4 = 1 , IPV6 = 2 }
| Enum representing the type of host in a URL. More...
enum class | url_search_params_iter_type { KEYS , VALUES , ENTRIES }
| Iterator types for url_search_params iteration. More...

## Functions

void | unreachable ()
ada_warn_unused std::string_view | to_string (encoding_type type)
template<class result_type = ada::url_aggregator>
ada_warn_unused ada::result< result_type > | parse (std::string_view input, const result_type *base_url=nullptr)
template ada::result< url > | parse< url > (std::string_view input, const url *base_url)
template ada::result< url_aggregator > | parse< url_aggregator > (std::string_view input, const url_aggregator *base_url)
bool | can_parse (std::string_view input, const std::string_view *base_input=nullptr)
std::string | href_from_file (std::string_view path)
ada_warn_unused std::string | to_string (ada::state s)
std::ostream & | operator<< (std::ostream &out, const ada::url &u)
std::ostream & | operator<< (std::ostream &out, const ada::url_aggregator &u)
template<class result_type>
ada_warn_unused tl::expected< result_type, errors > | parse (std::string_view input, const result_type *base_url)

## Variables

template<typename T, ada::url_search_params_iter_type Type>
url_search_params | url_search_params_iter< T, Type >::EMPTY

## Detailed Description

Forward declarations

## Typedef Documentation

## key_value_view_pair

typedef std::pair<std::string_view, std::string_view> ada::key_value_view_pair

Type alias for a key-value pair of string views.

Definition at line 34 of file url_search_params.h.

## result

template<class result_type = ada::url_aggregator>

using ada::result = tl::expected<result_type, ada::errors>

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

Definition at line 44 of file implementation.h.

## url_search_params_entries_iter

using ada::url_search_params_entries_iter

Initial value:
url_search_params_iter<key_value_view_pair,
url_search_params_iter_type::ENTRIES>
ada::url_search_params_iter_type::ENTRIES
@ ENTRIES
Definition url_search_params.h:27
ada::key_value_view_pair
std::pair< std::string_view, std::string_view > key_value_view_pair
Definition url_search_params.h:34
ada::url_search_params_iter
JavaScript-style iterator for url_search_params.
Definition url_search_params.h:224

Iterator over search parameter key-value pairs.

Definition at line 44 of file url_search_params.h.

## url_search_params_keys_iter

using ada::url_search_params_keys_iter

Initial value:
url_search_params_iter<std::string_view, url_search_params_iter_type::KEYS>

Iterator over search parameter keys.

Definition at line 37 of file url_search_params.h.

## url_search_params_values_iter

using ada::url_search_params_values_iter

Initial value:
url_search_params_iter<std::string_view,
url_search_params_iter_type::VALUES>
ada::url_search_params_iter_type::VALUES
@ VALUES
Definition url_search_params.h:26

Iterator over search parameter values.

Definition at line 40 of file url_search_params.h.

## Enumeration Type Documentation

## anonymous enum

anonymous enum

Enumerator
ADA_VERSION_MAJOR |
ADA_VERSION_MINOR |
ADA_VERSION_REVISION |

Definition at line 12 of file ada_version.h.

## encoding_type

enum class ada::encoding_type

strong

Character encoding types for URL processing.

Specifies the character encoding used for percent-decoding and other string operations. UTF-8 is the most commonly used encoding for URLs.

See also
  https://encoding.spec.whatwg.org/#encodings

Enumerator
UTF8 | UTF-8 encoding (default for URLs)
UTF_16LE | UTF-16 Little Endian encoding
UTF_16BE | UTF-16 Big Endian encoding

Definition at line 25 of file encoding_type.h.

## errors

enum class ada::errors : uint8_t

strong

Error codes for URL parsing operations.

Used with tl::expected to indicate why a URL parsing operation failed.

Enumerator
type_error | A type error occurred (e.g., invalid URL syntax).

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

Definition at line 17 of file errors.h.

## state

enum class ada::state

strong

States in the URL parsing state machine.

The URL parser processes input through a sequence of states, each handling a specific part of the URL syntax.

See also
  https://url.spec.whatwg.org/#url-parsing

Enumerator

AUTHORITY

See also
  https://url.spec.whatwg.org/#authority-state

SCHEME_START

See also
  https://url.spec.whatwg.org/#scheme-start-state

SCHEME

See also
  https://url.spec.whatwg.org/#scheme-state

HOST

See also
  https://url.spec.whatwg.org/#host-state

NO_SCHEME

See also
  https://url.spec.whatwg.org/#no-scheme-state

FRAGMENT

See also
  https://url.spec.whatwg.org/#fragment-state

RELATIVE_SCHEME

See also
  https://url.spec.whatwg.org/#relative-state

RELATIVE_SLASH

See also
  https://url.spec.whatwg.org/#relative-slash-state

FILE

See also
  https://url.spec.whatwg.org/#file-state

FILE_HOST

See also
  https://url.spec.whatwg.org/#file-host-state

FILE_SLASH

See also
  https://url.spec.whatwg.org/#file-slash-state

PATH_OR_AUTHORITY

See also
  https://url.spec.whatwg.org/#path-or-authority-state

SPECIAL_AUTHORITY_IGNORE_SLASHES

See also
  https://url.spec.whatwg.org/#special-authority-ignore-slashes-state

SPECIAL_AUTHORITY_SLASHES

See also
  https://url.spec.whatwg.org/#special-authority-slashes-state

SPECIAL_RELATIVE_OR_AUTHORITY

See also
  https://url.spec.whatwg.org/#special-relative-or-authority-state

QUERY

See also
  https://url.spec.whatwg.org/#query-state

PATH

See also
  https://url.spec.whatwg.org/#path-state

PATH_START

See also
  https://url.spec.whatwg.org/#path-start-state

OPAQUE_PATH

See also
  https://url.spec.whatwg.org/#cannot-be-a-base-url-path-state

PORT

See also
  https://url.spec.whatwg.org/#port-state

Definition at line 27 of file state.h.

## url_host_type

enum ada::url_host_type : uint8_t

Enum representing the type of host in a URL.

Used to distinguish between regular domain names, IPv4 addresses, and IPv6 addresses for proper parsing and serialization.

Enumerator
DEFAULT | Regular domain name (e.g., "www.example.com")
IPV4 | IPv4 address (e.g., "127.0.0.1")
IPV6 | IPv6 address (e.g., "[::1]" or "[2001:db8::1]")

Definition at line 26 of file url_base.h.

## url_search_params_iter_type

enum class ada::url_search_params_iter_type

strong

Iterator types for url_search_params iteration.

Enumerator
KEYS | Iterate over parameter keys only
VALUES | Iterate over parameter values only
ENTRIES | Iterate over key-value pairs

Definition at line 24 of file url_search_params.h.

## Function Documentation

## can_parse()

bool ada::can_parse | ( | std::string_view | input,
|  | const std::string_view * | base_input = nullptr )

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

Definition at line 51 of file implementation.cpp.

References ada::url_base::is_valid, and ada::parser::parse_url_impl().

Referenced by ada_can_parse(), ada_can_parse_with_base(), and LLVMFuzzerTestOneInput().

## href_from_file()

std::string ada::href_from_file | ( | std::string_view | path | ) |

Converts a file system path to a file:// URL.

Creates a properly formatted file URL from a local file system path. Handles platform-specific path separators and percent-encoding.

Parameters

  path | The file system path to convert. Must be valid ASCII or UTF-8.

Returns
  A file:// URL string representing the given path.

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

Definition at line 28 of file implementation.cpp.

References ada::scheme::FILE.

Referenced by LLVMFuzzerTestOneInput().

## operator<<() [1/2]

std::ostream & ada::operator<< | ( | std::ostream & | out,
|  | const ada::url & | u )

inline

Definition at line 38 of file url-inl.h.

References ada::url::to_string().

## operator<<() [2/2]

std::ostream & ada::operator<< | ( | std::ostream & | out,
|  | const ada::url_aggregator & | u )

inline

Definition at line 1109 of file url_aggregator-inl.h.

References ada::url_aggregator::to_string().

## parse() [1/2]

template<class result_type>

ada_warn_unused tl::expected< result_type, errors > ada::parse | ( | std::string_view | input,
|  | const result_type * | base_url )

Definition at line 13 of file implementation.cpp.

References ada_warn_unused, ada::parser::parse_url_impl(), and type_error.

Referenced by ada_parse(), ada_parse_with_base(), exercise_exec_and_test(), ada::url::get_origin(), ada::url_aggregator::get_origin(), LLVMFuzzerTestOneInput(), and ada::url::set_href().

## parse() [2/2]

template<class result_type = ada::url_aggregator>

ada_warn_unused ada::result< result_type > ada::parse | ( | std::string_view | input,
|  | const result_type * | base_url = nullptr )

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada.h, and /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

Definition at line 13 of file implementation.cpp.

References ada_warn_unused, ada::parser::parse_url_impl(), and type_error.

Referenced by ada_parse(), ada_parse_with_base(), exercise_exec_and_test(), ada::url::get_origin(), ada::url_aggregator::get_origin(), LLVMFuzzerTestOneInput(), and ada::url::set_href().

## parse< url >()

template ada::result< url > ada::parse< url > | ( | std::string_view | input,
|  | const url * | base_url )

extern

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

## parse< url_aggregator >()

template ada::result< url_aggregator > ada::parse< url_aggregator > | ( | std::string_view | input,
|  | const url_aggregator * | base_url )

extern

Examples
  /build/ada-url-QhggFk/ada-url-3.4.4/include/ada/implementation.h.

References ada_warn_unused.

Referenced by ada::url_aggregator::set_href().

## to_string() [1/2]

ada_warn_unused std::string ada::to_string | ( | ada::state | s | ) |

Converts a parser state to its string name for debugging.

Parameters

  s | The state to convert.

Returns
  A string representation of the state.

Definition at line 1063 of file helpers.cpp.

References ada_warn_unused, and ada::helpers::get_state().

## to_string() [2/2]

ada_warn_unused std::string_view ada::to_string | ( | ada::encoding_type | type | ) |

Converts an encoding_type to its string representation.

Parameters

  type | The encoding type to convert.

Returns
  A string view of the encoding name.

Definition at line 70 of file implementation.cpp.

References ada_warn_unused, unreachable(), UTF8, UTF_16BE, and UTF_16LE.

Referenced by ada::parser::parse_url_impl().

## unreachable()

void ada::unreachable | ( |  | ) |

inline

Definition at line 161 of file common_defs.h.

Referenced by ada::parser::parse_url_impl(), and to_string().

## Variable Documentation

## url_search_params_iter< T, Type >::EMPTY

template<typename T, ada::url_search_params_iter_type Type>

url_search_params ada::url_search_params_iter< T, Type >::EMPTY

Definition at line 23 of file url_search_params-inl.h.