Skip to content

Commit

Permalink
// update url::get_part_view, is_empty, is_null doxygen comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed Oct 22, 2023
1 parent d9894b9 commit cf2b126
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This library is up to date with the URL Standard published on
It implements:
1. [URL class](https://url.spec.whatwg.org/#url-class): `upa::url`
2. [URLSearchParams class](https://url.spec.whatwg.org/#interface-urlsearchparams): `upa::url_search_params`
3. [URL record](https://url.spec.whatwg.org/#concept-url): `upa::url` has functions to examine URL record members
3. [URL record](https://url.spec.whatwg.org/#concept-url): `upa::url` has functions to examine URL record members: `get_part_view(PartType t)`, `is_empty(PartType t)` and `is_null(PartType t)`
4. [URL equivalence](https://url.spec.whatwg.org/#url-equivalence): `upa::equals` function

It has some differences from the standard:
Expand Down
22 changes: 22 additions & 0 deletions include/upa/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,17 +518,39 @@ class url {
/// @return `true` if URL is valid, `false` otherwise
bool is_valid() const noexcept;

/// @brief Gets URL's part (URL record member) as string
///
/// Function to get ASCII string of any URL's part (URL record member) defined here:
/// https://url.spec.whatwg.org/#url-representation
///
/// * `get_part_view(url::SCHEME)` - get a URL’s **scheme** string
/// * `get_part_view(url::USERNAME)` - get a URL’s **username** string
/// * `get_part_view(url::PASSWORD)` - get a URL’s **password** string
/// * `get_part_view(url::HOST)` - get a URL’s **host** serialized to string
/// * `get_part_view(url::PORT)` - get a URL’s **port** serialized to string
/// * `get_part_view(url::PATH)` - get a URL’s **path** serialized to string
/// * `get_part_view(url::QUERY)` - get a URL’s **query** string
/// * `get_part_view(url::FRAGMENT)` - get a URL’s **fragment** string
///
/// @param[in] t URL's part
/// @return URL's part string; it is empty if part is empty or null
string_view get_part_view(PartType t) const;

/// @brief Checks whether the URL's part (URL record member) is empty or null
///
/// @param[in] t URL's part
/// @return `true` if URL's part @a t is empty or null, `false` otherwise
bool is_empty(PartType t) const;

/// @brief Checks whether the URL's part (URL record member) is null
///
/// Only the following [URL record members](https://url.spec.whatwg.org/#concept-url)
/// can be null:
/// * **host** - check with `is_null(url::HOST)`
/// * **port** - check with `is_null(url::PORT)`
/// * **query** - check with `is_null(url::QUERY)`
/// * **fragment** - check with `is_null(url::FRAGMENT)`
///
/// @param[in] t URL's part
/// @return `true` if URL's part @a t is null, `false` otherwise
bool is_null(PartType t) const noexcept;
Expand Down

0 comments on commit cf2b126

Please sign in to comment.