= Reference :mrdocs: == Namespaces [cols=1] |=== | Name | <> |=== == Namespaces [cols=1] |=== | Name | <> |=== == Namespaces [cols=1] |=== | Name | <> | <> | <> |=== == Types [cols=2] |=== | Name | Description | <> | A non‐owning reference to a valid authority | <> | A reference to a valid, percent‐encoded string | <> | Percent‐encoding options | <> | A temporary reference to a formatting argument | <> | An optional parameter to determine case‐sensitivity | <> | An IP version 4 style address. | <> | An IP version 6 style address. | <> | A temporary reference to a named formatting argument | <> | The type of xref:#boost-urls-no_value[no_value] | <> | The type of optional used by the library | <> | A query parameter | <> | A view of a percent‐encoded query parameter | <> | A view of a query parameter | <> | Common functionality for containers | <> | Common functionality for containers | <> | A view representing query parameters in a URL | <> | A view representing query parameters in a URL | <> | A view representing query parameters in a URL | <> | A view representing query parameters in a URL | <> | A reference to a valid percent‐encoded string | <> | Common functionality for containers | <> | Common functionality for containers | <> | A view representing path segments in a URL | <> | A view representing path segments in a URL | <> | A view representing path segments in a URL | <> | A view representing path segments in a URL | <> | A modifiable container for a URL. | <> | Common implementation for all static URLs | <> | The type of string_view used by the library | <> | A modifiable container for a URL. | <> | Common functionality for containers | <> | A non‐owning reference to a valid URL | <> | Common functionality for containers | <> | The type of variant used by the library |=== == Enums [cols=2] |=== | Name | Description | <> | Error codes returned the library | <> | Identifies the type of host in a URL. | <> | Identifies a known URL scheme |=== == Functions [cols=2] |=== | Name | Description | <> | Designate a named argument for a replacement field | <> | Return the default port for a known scheme | <> | Apply percent‐encoding to a string Return a percent‐encoded string | <> | Return the buffer size needed for percent‐encoding | <> | Format arguments into a URL | <> | Format arguments into a URL | <> | Return a valid percent‐encoded string | <> | Compare two decode views for inequality Return the result of comparing two URLs Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. Return true if two addresses are not equal | <> | Compare two decode views for less than Return the result of comparing two URLs Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Format the address to an output stream Format the address to an output stream. Format the encoded authority to the output stream Format the string with percent‐decoding applied to the output stream Format the url to the output stream Format to an output stream | <> | Compare two decode views for less than or equal Return the result of comparing two URLs Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Compare two decode views for equality Return the result of comparing two URLs Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. Return true if two addresses are equal | <> | Compare two decode views for greater than Return the result of comparing two URLs Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Compare two decode views for greater than or equal Return the result of comparing two URLs Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Return a reference to a parsed URL string | <> | Parse an authority | <> | Return an IPv4 address from an IP address string in dotted decimal form | <> | Parse a string containing an IPv6 address. | <> | Return a reference to a parsed URL string | <> | Parse a string and return an encoded segment view | <> | Parse a string and return an encoded params view | <> | Return a reference to a parsed URL string | <> | Return a reference to a parsed URL string | <> | Return a reference to a parsed URL string | <> | Rule for a string with percent‐encoded escapes | <> | Resolve a URL reference against a base URL | <> | Return the known scheme for a non‐normalized string, if known | <> | Swap | <> | Return the normalized string for a known scheme |=== == Variables [cols=2] |=== | Name | Description | <> | Rule for absolute‐URI | <> | Rule for authority | <> | The gen‐delims character set | <> | Ignore case when comparing | <> | Rule for an IP version 4 style address | <> | Rule for An IP version 6 style address | <> | Constant indicating no value in a param | <> | Rule for origin‐form | <> | The path character set | <> | Rule for query | <> | Rule for relative‐ref | <> | The reserved character set | <> | The sub‐delims character set | <> | The unreserved character set | <> | Rule for URI‐reference | <> | Rule for URI |=== == Using Directives [cols=1] |=== | Name | <> |=== == Namespace Aliases [cols=2] |=== | Name | Description | <> | The set of constants used for cross‐platform error codes |=== == Types [cols=2] |=== | Name | Description | <> | The type of error category used by the library | <> | The type of error code used by the library | <> | The type of error condition used by the library | <> | The type of result returned by library functions | <> | The type of system error thrown by the library |=== The type of error category used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L43[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using error_category = <>::system::error_category; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `system::error_category` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. The type of error code used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L65[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using error_code = <>::system::error_code; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `system::error_code` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. The type of error condition used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L87[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using error_condition = <>::system::error_condition; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `system::error_condition` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. The type of result returned by library functions == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L310[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using result = <>::system::result<T, system::error_code>; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `system::result` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. This is an alias template used as the return type for functions that can either return a container, or fail with an error code. This is a brief synopsis of the type: === Declaration [,cpp] ---- template< class T > class result { public: // // Return true if the result contains an error // constexpr bool has_error() const noexcept; // // Return the error // constexpr system::error_code error() const noexcept; // // Return true if the result contains a value // constexpr bool has_value() const noexcept; constexpr explicit operator bool() const noexcept; // // Return the value, or throw an exception // constexpr T& value(); constexpr T const& value() const; // Return the value. // Precondition: has_value()==true // constexpr T& operator*() noexcept; constexpr T* operator->() noexcept; constexpr T const& operator*() const noexcept; constexpr T const* operator->() const noexcept; ...more ---- === Usage Given the function xref:#boost-urls-parse_uri[parse_uri] with this signature: [,cpp] ---- system::result< url_view > parse_uri( core::string_view s ) noexcept; ---- The following statement captures the value in a variable upon success, otherwise throws: [,cpp] ---- url_view u = parse_uri( "http://example.com/path/to/file.txt" ).value(); ---- This statement captures the result in a local variable and inspects the error condition: [,cpp] ---- system::result< url_view > rv = parse_uri( "http://example.com/path/to/file.txt" ); if(! rv ) std::cout << rv.error(); else std::cout << *rv; ---- * link:https://boost.org/libs/system/doc/html/system.html#ref_resultt_e[`boost::system::result`] == Template Parameters |=== | Name | Description | *T* | The type of value held by the result. |=== == See Also The type of system error thrown by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L109[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using system_error = <>::system::system_error; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `system::system_error` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. The set of constants used for cross‐platform error codes == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L217[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- namespace errc = <>::system::errc; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `core::string_view` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. A function to return the generic error category used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L153[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using <>::system::generic_category; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `core::string_view` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. == Introduced Symbols |=== | Name | generic_category |=== A function to return the system error category used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error_types.hpp#L196[boost/url/error_types.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using <>::system::system_category; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `core::string_view` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. == Introduced Symbols |=== | Name | system_category |=== == Namespace Aliases [cols=1] |=== | Name | <> |=== == Types [cols=2] |=== | Name | Description | <> | Provides an aligned storage buffer aligned for T | <> | A case‐insensitive equals predicate for strings | <> | A case‐insensitive hash function object for strings | <> | A case‐insensitive less predicate for strings | <> | Alias for `std::true_type` if T satisfies xref:#boost-urls-grammar-CharSet[CharSet]. | <> | Determine if T meets the requirements of xref:#boost-urls-grammar-Rule[Rule] | <> | Match a string literal exactly | <> | A set of characters | <> | A forward range of parsed elements | <> | A thread‐safe collection of instances of T | <> | A pointer to a shared instance of T | <> | Common functionality for string views | <> | Match an unsigned decimal |=== == Enums [cols=2] |=== | Name | Description | <> | Error conditions for errors received from rules | <> | Error codes returned when using rules |=== == Functions [cols=2] |=== | Name | Description | <> | Return the case‐insensitive comparison of s0 and s1 | <> | Return the case‐insensitive digest of a string | <> | Return true if s0 equals s1 using case‐insensitive comparison | <> | Return true if s0 is less than s1 using case‐insensitive comparison | <> | Match a character literal Match a single character from a character set | <> | Find the first character in the string that is in the set. | <> | Find the first character in the string that is not in CharSet | <> | Return the decimal value of a hex character | <> | Match another rule, if the result is not empty | <> | Compare two string views for inequality | <> | Return the union of two character sets. | <> | Return a new character set by subtracting | <> | Compare two string views for less than | <> | Format a string to an output stream | <> | Compare two string views for less than or equal | <> | Compare two string views for equality | <> | Compare two string views for greater than | <> | Compare two string views for greater than or equal | <> | Match a rule, or the empty string | <> | Parse a character buffer using a rule | <> | Match a repeating number of elements | <> | Return a reference to a character set Return a reference to a rule | <> | Squelch the value of a rule | <> | Return c converted to lowercase | <> | Return c converted to uppercase | <> | Match a non‐empty string of characters from a set | <> | Match a series of rules in order | <> | Match one of a set of rules |=== == Variables [cols=2] |=== | Name | Description | <> | The set of all characters | <> | The set of letters and digits | <> | The set of all letters | <> | Match a decimal octet | <> | The set of decimal digits | <> | The set of hexadecimal digits | <> | The set of visible characters |=== == Concepts [cols=2] |=== | Name | Description | <> | Concept for a CharSet | <> | Concept for a grammar Rule |=== Match a string literal exactly == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/literal_rule.hpp#L44[boost/url/grammar/literal_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class literal_rule; ---- == Types [cols=1] |=== | Name | <> |=== == Member Functions [cols=1] |=== | Name | <> [.small]#[constructor]# | <> |=== == Description If there is no more input, or if the end of the input is reached, and a prefix of the literal matches exactly, the error returned is xref:#boost-urls-grammar-error[error::need_more]. === Value Type [,cpp] ---- using value_type = core::string_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-literal_rule-parse[parse]. [,cpp] ---- system::result< core::string_view > rv = parse( "HTTP", literal_rule( "HTTP" ) ); ---- == See Also xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-literal_rule-parse[parse]. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/literal_rule.hpp#L62[boost/url/grammar/literal_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit literal_rule(char const* s) noexcept; ---- == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/literal_rule.hpp#L72[boost/url/grammar/literal_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse( char const*& it, char const* end) const noexcept; ---- == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/literal_rule.hpp#L60[boost/url/grammar/literal_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = core::string_view; ---- A set of characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L64[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class lut_chars; ---- == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Constructor Constructor. | <> | Return true if ch is in the character set. | <> | Return a new character set which is the complement of another character set. |=== == Friends [cols=2] |=== | Name | Description | <> | Return the union of two character sets. | <> | Return a new character set by subtracting |=== == Description The characters defined by instances of this set are provided upon construction. The `constexpr` implementation allows these to become compile‐time constants. === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- constexpr lut_chars vowel_chars = "AEIOU" "aeiou"; system::result< core::string_view > rv = parse( "Aiea", token_rule( vowel_chars ) ); ---- == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L157[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(char ch) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(char const* s) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Pred> requires detail::is_pred<Pred>::value && ! std::is_base_of< lut_chars, Pred>::value constexpr <>(Pred const& pred) noexcept; ---- [.small]#<># == Description This function constructs a character set which has as a single member, the character `ch`. === Example [,cpp] ---- constexpr lut_chars asterisk( '*' ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *ch* | A character. | *s* | A null‐terminated string. | *pred* | The function object to use for determining membership in the character set. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L157[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr lut_chars(char ch) noexcept; ---- == Description This function constructs a character set which has as a single member, the character `ch`. === Example [,cpp] ---- constexpr lut_chars asterisk( '*' ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *ch* | A character. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L188[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr lut_chars(char const* s) noexcept; ---- == Description This function constructs a character set which has as members, all of the characters present in the null‐terminated string `s`. === Example [,cpp] ---- constexpr lut_chars digits = "0123456789"; ---- === Complexity Linear in `::strlen(s)`, or constant if `s` is a constant expression. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *s* | A null‐terminated string. |=== Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L227[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Pred> requires detail::is_pred<Pred>::value && ! std::is_base_of< lut_chars, Pred>::value constexpr lut_chars(Pred const& pred) noexcept; ---- == Description This function constructs a character set which has as members, every value of `char ch` for which the expression `pred(ch)` returns `true`. === Example [,cpp] ---- struct is_digit { constexpr bool operator()(char c ) const noexcept { return c >= '0' && c <= '9'; } }; constexpr lut_chars digits( is_digit{} ); ---- === Complexity Linear in `pred`, or constant if `pred(ch)` is a constant expression. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *pred* | The function object to use for determining membership in the character set. |=== Return true if ch is in the character set. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L256[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(unsigned char ch) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char ch) const noexcept; ---- [.small]#<># == Description This function returns true if the character `ch` is in the set, otherwise it returns false. === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *ch* | The character to test. |=== Return true if ch is in the character set. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L256[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator()(unsigned char ch) const noexcept; ---- == Description This function returns true if the character `ch` is in the set, otherwise it returns false. === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *ch* | The character to test. |=== Return true if ch is in the character set. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L265[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator()(char ch) const noexcept; ---- == Description This function returns true if the character `ch` is in the set, otherwise it returns false. === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *ch* | The character to test. |=== Return a new character set which is the complement of another character set. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L371[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> operator~() const noexcept; ---- == Description This function returns a new character set which contains all of the characters that are not in `*this`. === Example This statement declares a character set containing everything but vowels: [,cpp] ---- constexpr lut_chars not_vowels = ~lut_chars( "AEIOU" "aeiou" ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Return Value The new character set. Return the union of two character sets. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L299[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr <> operator+( <> const& cs0, <> const& cs1) noexcept; ---- == Description This function returns a new character set which contains all of the characters in `cs0` as well as all of the characters in `cs`. === Example This creates a character set which includes all letters and numbers [,cpp] ---- constexpr lut_chars alpha_chars( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"); constexpr lut_chars alnum_chars = alpha_chars + "0123456789"; ---- === Complexity Constant. == Return Value The new character set. == Parameters |=== | Name | Description | *cs0* | A character to join | *cs1* | A character to join |=== Return a new character set by subtracting == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L336[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr <> operator‐( <> const& cs0, <> const& cs1) noexcept; ---- == Description This function returns a new character set which is formed from all of the characters in `cs0` which are not in `cs`. === Example This statement declares a character set containing all the lowercase letters which are not vowels: [,cpp] ---- constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou"; ---- === Complexity Constant. == Return Value The new character set. == Parameters |=== | Name | Description | *cs0* | A character set to join. | *cs1* | A character set to join. |=== A forward range of parsed elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L62[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class range; ---- == Types [cols=2] |=== | Name | Description | <> | A constant, forward iterator to elements of the range | <> | The type of each element of the range | <> | The type used to represent signed integers | <> | A constant, forward iterator to elements of the range | <> | Provided for compatibility, unused | <> | The type of each element of the range | <> | The type used to represent unsigned integers | <> | The type of each element of the range |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return an iterator to the beginning | <> | Return true if the range is empty | <> | Return an iterator to the end | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Return the number of elements in the range | <> | Return the matching part of the string | <> [.small]#[destructor]# | Destructor |=== == Description Objects of this type are forward ranges returned when parsing using the xref:#boost-urls-grammar-range_rule-06[range_rule]. Iteration is performed by re‐parsing the underlying character buffer. Ownership of the buffer is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by the range. [NOTE] The implementation may use temporary, recycled storage for type‐erasure. Objects of type `range` are intended to be used ephemerally. That is, for short durations such as within a function scope. If it is necessary to store the range for a long period of time or with static storage duration, it is necessary to copy the contents to an object of a different type. == Template Parameters |=== | Name | Description | *T* | The value type of the range |=== == See Also xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-range_rule-06[range_rule]. A constant, forward iterator to elements of the range == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L160[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class iterator; ---- Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L245[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> begin() const noexcept; ---- Return true if the range is empty == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L253[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L249[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> end() const noexcept; ---- Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L224[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<>&&) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const&) noexcept; ---- [.small]#<># == Description After the move, this references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The moved‐from object becomes as if default‐constructed. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L224[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<>&&) noexcept; ---- == Description After the move, this references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The moved‐from object becomes as if default‐constructed. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L240[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const&) noexcept; ---- == Description The copy references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L178[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>&&) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const&) noexcept; ---- [.small]#<># == Description Default‐constructed ranges have zero elements. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L178[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- range() noexcept; ---- == Description Default‐constructed ranges have zero elements. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L194[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- range(<>&&) noexcept; ---- == Description The new range references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The moved‐from object becomes as if default‐constructed. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L209[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- range(<> const&) noexcept; ---- == Description The copy references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Exception Safety Throws nothing. Return the number of elements in the range == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L261[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- Return the matching part of the string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L269[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view string() const noexcept; ---- Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L168[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- ~range(); ---- A constant, forward iterator to elements of the range == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L164[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = <>; ---- The type of each element of the range == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L144[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_reference = T const&; ---- The type used to represent signed integers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L156[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using difference_type = std::ptrdiff_t; ---- Provided for compatibility, unused == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L148[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using pointer = void const*; ---- The type of each element of the range == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L140[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using reference = T const&; ---- The type used to represent unsigned integers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L152[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using size_type = std::size_t; ---- The type of each element of the range == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L136[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = T; ---- A thread‐safe collection of instances of T == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L71[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class recycled; ---- == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Constructor | <> [.small]#[destructor]# | Destructor |=== == Description Instances of this type may be used to control where recycled instances of T come from when used with xref:#boost-urls-grammar-recycled_ptr[recycled_ptr]. === Example [,cpp] ---- static recycled< std::string > bin; recycled_ptr< std::string > ps( bin ); // Put the string into a known state ps->clear(); ---- == See Also xref:#boost-urls-grammar-recycled_ptr[recycled_ptr]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L86[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr recycled() = default; ---- Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L82[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- ~recycled(); ---- == Description All recycled instances of T are destroyed. Undefined behavior results if there are any xref:#boost-urls-grammar-recycled_ptr[recycled_ptr] which reference this recycle bin. A pointer to a shared instance of T == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L148[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class recycled_ptr; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the referenced object | <> | Return the referenced recycle bin | <> | Return true if this does not reference an object | <> | Return the referenced object | <> | Return true if this references an object | <> | Return the referenced object | <> | Return the referenced object | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Release the referenced object | <> [.small]#[destructor]# | Destructor |=== == Description This is a smart pointer container which can acquire shared ownership of an instance of `T` upon or after construction. The instance is guaranteed to be in a valid, but unknown state. Every recycled pointer references a valid recycle bin. === Example [,cpp] ---- static recycled< std::string > bin; recycled_ptr< std::string > ps( bin ); // Put the string into a known state ps->clear(); ---- == Template Parameters |=== | Name | Description | *T* | the type of object to acquire, which must be _DefaultConstructible_. |=== Return the referenced object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L483[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- T& acquire(); ---- == Description If this references an object, it is returned. Otherwise, exclusive ownership of a new object of type `T` is acquired and returned. === Postconditions [,cpp] ---- not this->empty() ---- Return the referenced recycle bin == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L429[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <><T>& bin() const noexcept; ---- == Description === Exception Safety Throws nothing. Return true if this does not reference an object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L402[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description === Exception Safety Throws nothing. Return the referenced object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L442[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- T* get() const noexcept; ---- == Description If this is empty, `nullptr` is returned. === Exception Safety Throws nothing. Return true if this references an object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L418[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit operator bool() const noexcept; ---- == Description === Effects [,cpp] ---- return ! this->empty(); ---- === Exception Safety Throws nothing. Return the referenced object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L466[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- T& operator*() const noexcept; ---- == Description === Preconditions [,cpp] ---- not this->empty() ---- Return the referenced object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L454[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- T* operator‐>() const noexcept; ---- == Description If this is empty, `nullptr` is returned. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L366[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<>&& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other) noexcept; ---- [.small]#<># == Description If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved‐from object is empty. === Effects [,cpp] ---- this->release() ---- === Postconditions [,cpp] ---- &this->bin() == &other->bin() ---- === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The pointer to move from |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L366[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<>&& other) noexcept; ---- == Description If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved‐from object is empty. === Effects [,cpp] ---- this->release() ---- === Postconditions [,cpp] ---- &this->bin() == &other->bin() ---- === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The pointer to move from |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L393[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other) noexcept; ---- == Description If `other` references an object, this acquires shared ownership and references the same recycle bin as `other`. The previous object if any is released. === Effects [,cpp] ---- this->release() ---- === Postconditions [,cpp] ---- &this->bin() == &other->bin() && this->get() == other.get() ---- === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The pointer to copy from |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L208[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(<><T>& bin); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( <><T>& bin, std::nullptr_t) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(std::nullptr_t) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>&& other) noexcept; ---- [.small]#<># == Description Upon construction, this acquires exclusive access to an object of type `T` which is either recycled from the specified bin, or newly allocated. The object is in an unknown but valid state. === Example [,cpp] ---- static recycled< std::string > bin; recycled_ptr< std::string > ps( bin ); // Put the string into a known state ps->clear(); ---- === Postconditions [,cpp] ---- &this->bin() == &bin && ! this->empty() ---- == Parameters |=== | Name | Description | *bin* | The recycle bin to use | *other* | The pointer to copy |=== == See Also xref:#boost-urls-grammar-recycled[recycled]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L208[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit recycled_ptr(<><T>& bin); ---- == Description Upon construction, this acquires exclusive access to an object of type `T` which is either recycled from the specified bin, or newly allocated. The object is in an unknown but valid state. === Example [,cpp] ---- static recycled< std::string > bin; recycled_ptr< std::string > ps( bin ); // Put the string into a known state ps->clear(); ---- === Postconditions [,cpp] ---- &this->bin() == &bin && ! this->empty() ---- == Parameters |=== | Name | Description | *bin* | The recycle bin to use |=== == See Also xref:#boost-urls-grammar-recycled[recycled]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L242[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- recycled_ptr( <><T>& bin, std::nullptr_t) noexcept; ---- == Description After construction, this is empty and refers to the specified recycle bin. === Example [,cpp] ---- static recycled< std::string > bin; recycled_ptr< std::string > ps( bin, nullptr ); // Acquire a string and put it into a known state ps->acquire(); ps->clear(); ---- === Postconditions [,cpp] ---- &this->bin() == &bin && this->empty() ---- === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *bin* | The recycle bin to use |=== == See Also xref:#boost-urls-grammar-recycled_ptr-acquire[acquire], xref:#boost-urls-grammar-recycled[recycled], xref:#boost-urls-grammar-recycled_ptr-release[release]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L271[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- recycled_ptr(); ---- == Description Upon construction, this acquires exclusive access to an object of type `T` which is either recycled from a global recycle bin, or newly allocated. The object is in an unknown but valid state. === Example [,cpp] ---- recycled_ptr< std::string > ps; // Put the string into a known state ps->clear(); ---- === Postconditions [,cpp] ---- &this->bin() != nullptr && ! this->empty() ---- == See Also xref:#boost-urls-grammar-recycled[recycled]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L300[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- recycled_ptr(std::nullptr_t) noexcept; ---- == Description After construction, this is empty and refers to a global recycle bin. === Example [,cpp] ---- recycled_ptr< std::string > ps( nullptr ); // Acquire a string and put it into a known state ps->acquire(); ps->clear(); ---- === Postconditions [,cpp] ---- &this->bin() != nullptr && this->empty() ---- === Exception Safety Throws nothing. == See Also xref:#boost-urls-grammar-recycled_ptr-acquire[acquire], xref:#boost-urls-grammar-recycled[recycled], xref:#boost-urls-grammar-recycled_ptr-release[release]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L321[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- recycled_ptr(<> const& other) noexcept; ---- == Description If `other` references an object, the newly constructed pointer acquires shared ownership. Otherwise this is empty. The new pointer references the same recycle bin as `other`. === Postconditions [,cpp] ---- &this->bin() == &other->bin() && this->get() == other.get() ---- === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The pointer to copy |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L341[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- recycled_ptr(<>&& other) noexcept; ---- == Description If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved‐from object is empty. === Postconditions [,cpp] ---- &this->bin() == &other->bin() && ! this->empty() && other.empty() ---- === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The pointer to move from |=== Release the referenced object == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L500[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void release() noexcept; ---- == Description If this references an object, it is released to the referenced recycle bin. The pointer continues to reference the same recycle bin. === Postconditions [,cpp] ---- this->empty() ---- === Exception Safety Throws nothing. Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L177[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- ~recycled_ptr(); ---- == Description If this is not empty, shared ownership of the pointee is released. If this was the last reference, the object is returned to the original recycle bin. === Effects [,cpp] ---- this->release(); ---- Common functionality for string views == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L36[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class string_view_base; ---- == Types [cols=2] |=== | Name | Description | <> | The const iterator type | <> | The const pointer type | <> | The const reference type | <> | The const reverse iterator type | <> | The difference type | <> | The iterator type | <> | The pointer type | <> | The reference type | <> | The reverse iterator type | <> | The size type | <> | The character traits | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Access a character | <> | Return the last character | <> | Return an iterator to the beginning | <> | Return an iterator to the beginning | <> | Return an iterator to the end | <> | Return the result of comparing to another string | <> | Return true if matching characters are found | <> | Copy the characters to another buffer | <> | Return a reverse iterator to the end | <> | Return a reverse iterator to the beginning | <> | Return a pointer to the character buffer | <> | Return true if the string is empty | <> | Return an iterator to the end | <> | Return true if a matching suffix exists | <> | Return the position of matching characters | <> | Return the position of the first non‐match | <> | Return the position of the first match | <> | Return the position of the last non‐match | <> | Return the position of the last match | <> | Return the first character | <> | Return the size | <> | Return the maximum allowed size | <> | Conversion | <> | Conversion | <> | Access a character | <> | Return a reverse iterator to the end | <> | Return a reverse iterator to the beginning | <> | Return the position of matching characters | <> | Return the size | <> | Return true if a matching prefix exists | <> | Return a view to part of the string |=== == Static Data Members [cols=2] |=== | Name | Description | <> | A constant used to represent "no position" |=== == Friends [cols=2] |=== | Name | Description | <> | Compare two string views for inequality | <> | Compare two string views for less than | <> | Format a string to an output stream | <> | Compare two string views for less than or equal | <> | Compare two string views for equality | <> | Compare two string views for greater than | <> | Compare two string views for greater than or equal |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Swap |=== == Protected Data Members [cols=2] |=== | Name | Description | <> | The referenced character buffer |=== == Description This base class is used to provide common member functions for reference types that behave like string views. This cannot be instantiated directly; Instead, derive from the type and provide constructors which offer any desired preconditions and invariants. Access a character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L283[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> at(<> pos) const; ---- == Description See `core::string_view::at` Return the last character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L303[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> back() const noexcept; ---- == Description See `core::string_view::back` Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L157[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> begin() const noexcept; ---- == Description See `core::string_view::begin` Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L175[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> cbegin() const noexcept; ---- == Description See `core::string_view::cbegin` Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L184[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> cend() const noexcept; ---- == Description See `core::string_view::cend` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L347[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>(core::string_view str) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>( <> pos1, <> n1, core::string_view str) const; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>( <> pos1, <> n1, core::string_view str, <> pos2, <> n2) const; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>(char const* s) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>( <> pos1, <> n1, char const* s) const; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>( <> pos1, <> n1, char const* s, <> n2) const; ---- [.small]#<># == Description See `core::string_view::compare` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L347[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare(core::string_view str) const noexcept; ---- == Description See `core::string_view::compare` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L357[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare( <> pos1, <> n1, core::string_view str) const; ---- == Description See `core::string_view::compare` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L367[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare( <> pos1, <> n1, core::string_view str, <> pos2, <> n2) const; ---- == Description See `core::string_view::compare` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L378[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare(char const* s) const noexcept; ---- == Description See `core::string_view::compare` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L388[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare( <> pos1, <> n1, char const* s) const; ---- == Description See `core::string_view::compare` Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L398[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare( <> pos1, <> n1, char const* s, <> n2) const; ---- == Description See `core::string_view::compare` Return true if matching characters are found == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L727[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(core::string_view sv) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char c) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char const* s) const noexcept; ---- [.small]#<># == Description See `core::string_view::contains` Return true if matching characters are found == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L727[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool contains(core::string_view sv) const noexcept; ---- == Description See `core::string_view::contains` Return true if matching characters are found == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L736[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool contains(char c) const noexcept; ---- == Description See `core::string_view::contains` Return true if matching characters are found == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L745[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool contains(char const* s) const noexcept; ---- == Description See `core::string_view::contains` Copy the characters to another buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L325[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> copy( char* s, <> n, <> pos = 0) const; ---- == Description See `core::string_view::copy` Return a reverse iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L213[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> crbegin() const noexcept; ---- == Description See `core::string_view::crbegin` Return a reverse iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L223[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> crend() const noexcept; ---- == Description See `core::string_view::crend` Return a pointer to the character buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L313[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> data() const noexcept; ---- == Description See `core::string_view::data` Return true if the string is empty == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L262[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool empty() const noexcept; ---- == Description See `core::string_view::size` Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L166[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> end() const noexcept; ---- == Description See `core::string_view::end` Return true if a matching suffix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L443[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(core::string_view x) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char x) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char const* x) const noexcept; ---- [.small]#<># == Description See `core::string_view::ends_with` Return true if a matching suffix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L443[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool ends_with(core::string_view x) const noexcept; ---- == Description See `core::string_view::ends_with` Return true if a matching suffix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L453[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool ends_with(char x) const noexcept; ---- == Description See `core::string_view::ends_with` Return true if a matching suffix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L463[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool ends_with(char const* x) const noexcept; ---- == Description See `core::string_view::ends_with` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L475[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( core::string_view str, <> pos = 0) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char c, <> pos = 0) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos, <> n) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos = 0) const noexcept; ---- [.small]#<># == Description See `core::string_view::find` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L475[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find( core::string_view str, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L485[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find( char c, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L495[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find( char const* s, <> pos, <> n) const noexcept; ---- == Description See `core::string_view::find` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L505[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find( char const* s, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find` Return the position of the first non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L643[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( core::string_view str, <> pos = 0) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char c, <> pos = 0) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos, <> n) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos = 0) const noexcept; ---- [.small]#<># == Description See `core::string_view::find_first_not_of` Return the position of the first non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L643[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_not_of( core::string_view str, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find_first_not_of` Return the position of the first non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L653[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_not_of( char c, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find_first_not_of` Return the position of the first non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L663[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_not_of( char const* s, <> pos, <> n) const noexcept; ---- == Description See `core::string_view::find_first_not_of` Return the position of the first non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L673[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_not_of( char const* s, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find_first_not_of` Return the position of the first match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L559[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( core::string_view str, <> pos = 0) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char c, <> pos = 0) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos, <> n) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos = 0) const noexcept; ---- [.small]#<># == Description See `core::string_view::find_first_of` Return the position of the first match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L559[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_of( core::string_view str, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find_first_of` Return the position of the first match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L569[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_of( char c, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find_first_of` Return the position of the first match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L579[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_of( char const* s, <> pos, <> n) const noexcept; ---- == Description See `core::string_view::find_first_of` Return the position of the first match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L589[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_first_of( char const* s, <> pos = 0) const noexcept; ---- == Description See `core::string_view::find_first_of` Return the position of the last non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L685[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( core::string_view str, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char c, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos, <> n) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># == Description See `core::string_view::find_last_not_of` Return the position of the last non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L685[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_not_of( core::string_view str, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::find_last_not_of` Return the position of the last non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L695[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_not_of( char c, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::find_last_not_of` Return the position of the last non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L705[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_not_of( char const* s, <> pos, <> n) const noexcept; ---- == Description See `core::string_view::find_last_not_of` Return the position of the last non‐match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L715[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_not_of( char const* s, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::find_last_not_of` Return the position of the last match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L601[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( core::string_view str, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char c, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos, <> n) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># == Description See `core::string_view::find_last_of` Return the position of the last match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L601[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_of( core::string_view str, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::find_last_of` Return the position of the last match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L611[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_of( char c, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::find_last_of` Return the position of the last match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L621[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_of( char const* s, <> pos, <> n) const noexcept; ---- == Description See `core::string_view::find_last_of` Return the position of the last match == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L631[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> find_last_of( char const* s, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::find_last_of` Return the first character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L293[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> front() const noexcept; ---- == Description See `core::string_view::front` Return the size == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L244[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> length() const noexcept; ---- == Description See `core::string_view::length` Return the maximum allowed size == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L253[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> max_size() const noexcept; ---- == Description See `core::string_view::max_size` Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L142[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit operator std::string() const noexcept; ---- == Description Conversion to std::string is explicit because assigning to string using an implicit constructor does not preserve capacity. Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L119[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator std::string_view() const noexcept; ---- Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L82[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const&) = default; ---- Access a character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L273[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> operator[](<> pos) const noexcept; ---- == Description See `core::string_view::operator[]` Return a reverse iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L193[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> rbegin() const noexcept; ---- == Description See `core::string_view::rbegin` Return a reverse iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L203[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> rend() const noexcept; ---- == Description See `core::string_view::rend` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L517[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( core::string_view str, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char c, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos, <> n) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> <>( char const* s, <> pos = core::string_view::npos) const noexcept; ---- [.small]#<># == Description See `core::string_view::rfind` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L517[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> rfind( core::string_view str, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::rfind` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L527[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> rfind( char c, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::rfind` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L537[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> rfind( char const* s, <> pos, <> n) const noexcept; ---- == Description See `core::string_view::rfind` Return the position of matching characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L547[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> rfind( char const* s, <> pos = core::string_view::npos) const noexcept; ---- == Description See `core::string_view::rfind` Return the size == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L235[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> size() const noexcept; ---- == Description See `core::string_view::size` Return true if a matching prefix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L411[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(core::string_view x) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char x) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>(char const* x) const noexcept; ---- [.small]#<># == Description See `core::string_view::starts_with` Return true if a matching prefix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L411[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool starts_with(core::string_view x) const noexcept; ---- == Description See `core::string_view::starts_with` Return true if a matching prefix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L421[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool starts_with(char x) const noexcept; ---- == Description See `core::string_view::starts_with` Return true if a matching prefix exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L431[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool starts_with(char const* x) const noexcept; ---- == Description See `core::string_view::starts_with` Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L45[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(core::string_view s) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>( char const* data, std::size_t size) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const&) = default; ---- [.small]#<># Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L45[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr string_view_base(core::string_view s) noexcept; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L54[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr string_view_base( char const* data, std::size_t size) noexcept; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L73[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr string_view_base() = default; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L77[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr string_view_base(<> const&) = default; ---- Return a view to part of the string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L335[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr core::string_view substr( <> pos = 0, <> n = core::string_view::npos) const; ---- == Description See `core::string_view::substr` Swap == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L65[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void swap(<>& s) noexcept; ---- The const iterator type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L99[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef char const* const_iterator; ---- The const pointer type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L93[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef char const* const_pointer; ---- The const reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L97[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef char const& const_reference; ---- The const reverse iterator type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L103[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef std::reverse_iterator<<>> const_reverse_iterator; ---- The difference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L110[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef std::ptrdiff_t difference_type; ---- The iterator type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L101[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef <> iterator; ---- The pointer type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L91[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef char* pointer; ---- The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L95[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef char& reference; ---- The reverse iterator type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L106[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef <> reverse_iterator; ---- The size type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L108[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef std::size_t size_type; ---- The character traits == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L87[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef std::char_traits<char> traits_type; ---- The value type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L89[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- typedef char value_type; ---- A constant used to represent "no position" == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L113[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr static std::size_t npos = core::string_view::npos; ---- The referenced character buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L41[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view s_; ---- Compare two string views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L788[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> friend constexpr bool operator!=( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L803[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> friend constexpr bool operator<( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Format a string to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L863[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend std::ostream& operator<<( std::ostream& os, <> const& s); ---- Compare two string views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L818[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> friend constexpr bool operator<=( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L773[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> friend constexpr bool operator==( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L833[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> friend constexpr bool operator>( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L848[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> friend constexpr bool operator>=( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Match an unsigned decimal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/unsigned_rule.hpp#L82[boost/url/grammar/unsigned_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Unsigned> struct unsigned_rule; ---- == Types [cols=1] |=== | Name | <> |=== == Member Functions [cols=1] |=== | Name | <> |=== == Description Extra leading zeroes are disallowed. === Value Type [,cpp] ---- using value_type = Unsigned; ---- === Example Rules are used with the function xref:#boost-urls-grammar-unsigned_rule-parse[parse]. [,cpp] ---- system::result< unsigned short > rv = parse( "32767", unsigned_rule< unsigned short >{} ); ---- === BNF [,cpp] ---- unsigned = "0" / ( ["1"..."9"] *DIGIT ) ---- == Template Parameters |=== | Name | Description | *Unsigned* | The unsigned integer type used to store the result. |=== == See Also xref:#boost-urls-grammar-parse-02[grammar::parse]. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/unsigned_rule.hpp#L93[boost/url/grammar/unsigned_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse( char const*& it, char const* end) const noexcept; ---- == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/unsigned_rule.hpp#L91[boost/url/grammar/unsigned_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = Unsigned; ---- Return the case‐insensitive comparison of s0 and s1 == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L120[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int ci_compare( core::string_view s0, core::string_view s1) noexcept; ---- == Description This returns the lexicographical comparison of two strings, ignoring case. The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- assert( ci_compare( "boost", "Boost" ) == 0 ); ---- === Exception Safety Throws nothing. == Return Value 0 if the strings are equal, ‐1 if `s0` is less than `s1`, or 1 if `s0` is greater than s1. == Parameters |=== | Name | Description | *s0* | The first string | *s1* | The second string |=== == See Also xref:#boost-urls-grammar-ci_is_equal-0a[ci_is_equal], xref:#boost-urls-grammar-ci_is_less[ci_is_less]. Return the case‐insensitive digest of a string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L140[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t ci_digest(core::string_view s) noexcept; ---- == Description The hash function is non‐cryptographic and not hardened against algorithmic complexity attacks. Returned digests are suitable for usage in unordered containers. The function is defined only for strings containing low‐ASCII characters. == Return Value The digest == Parameters |=== | Name | Description | *s* | The string |=== Return true if s0 equals s1 using case‐insensitive comparison == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L160[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class String0, class String1> bool <>( String0 const& s0, String1 const& s1); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( core::string_view s0, core::string_view s1) noexcept; ---- [.small]#<># == Description The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- assert( ci_is_equal( "Boost", "boost" ) ); ---- == See Also xref:#boost-urls-grammar-ci_compare[ci_compare], xref:#boost-urls-grammar-ci_is_less[ci_is_less]. Return true if s0 equals s1 using case‐insensitive comparison == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L196[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool ci_is_equal( core::string_view s0, core::string_view s1) noexcept; ---- == Description The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- assert( ci_is_equal( "Boost", "boost" ) ); ---- == See Also xref:#boost-urls-grammar-ci_compare[ci_compare], xref:#boost-urls-grammar-ci_is_less[ci_is_less]. Return true if s0 equals s1 using case‐insensitive comparison == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L160[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class String0, class String1> bool ci_is_equal( String0 const& s0, String1 const& s1); ---- == Description The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- assert( ci_is_equal( "Boost", "boost" ) ); ---- == See Also xref:#boost-urls-grammar-ci_compare[ci_compare], xref:#boost-urls-grammar-ci_is_less[ci_is_less]. Return true if s0 is less than s1 using case‐insensitive comparison == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L227[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool ci_is_less( core::string_view s0, core::string_view s1) noexcept; ---- == Description The comparison algorithm implements a case‐insensitive total order on the set of all strings; however, it is not a lexicographical comparison. The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- assert( ! ci_is_less( "Boost", "boost" ) ); ---- == See Also xref:#boost-urls-grammar-ci_compare[ci_compare], xref:#boost-urls-grammar-ci_is_equal-0a[ci_is_equal]. Match a character literal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/delim_rule.hpp#L78[boost/url/grammar/delim_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> <>(char ch) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> constexpr /* implementation-defined */::<><CS> <>(CS const& cs) noexcept; ---- [.small]#<># == Description This matches the specified character. The value is a reference to the character in the underlying buffer, expressed as a `core::string_view`. The function xref:#boost-urls-grammar-squelch[squelch] may be used to turn this into `void` instead. If there is no more input, the error code xref:#boost-urls-grammar-error[error::need_more] is returned. === Value Type [,cpp] ---- using value_type = core::string_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< core::string_view > rv = parse( ".", delim_rule('.') ); ---- === BNF [,cpp] ---- char = %00-FF ---- == Parameters |=== | Name | Description | *ch* | The character to match | *cs* | The character set to use. |=== == See Also xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-squelch[squelch]. Match a character literal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/delim_rule.hpp#L78[boost/url/grammar/delim_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> delim_rule(char ch) noexcept; ---- == Description This matches the specified character. The value is a reference to the character in the underlying buffer, expressed as a `core::string_view`. The function xref:#boost-urls-grammar-squelch[squelch] may be used to turn this into `void` instead. If there is no more input, the error code xref:#boost-urls-grammar-error[error::need_more] is returned. === Value Type [,cpp] ---- using value_type = core::string_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< core::string_view > rv = parse( ".", delim_rule('.') ); ---- === BNF [,cpp] ---- char = %00-FF ---- == Parameters |=== | Name | Description | *ch* | The character to match |=== == See Also xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-squelch[squelch]. Match a single character from a character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/delim_rule.hpp#L155[boost/url/grammar/delim_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> constexpr /* implementation-defined */::<><CS> delim_rule(CS const& cs) noexcept; ---- == Description This matches exactly one character which belongs to the specified character set. The value is a reference to the character in the underlying buffer, expressed as a `core::string_view`. The function xref:#boost-urls-grammar-squelch[squelch] may be used to turn this into `void` instead. If there is no more input, the error code xref:#boost-urls-grammar-error[error::need_more] is returned. === Value Type [,cpp] ---- using value_type = core::string_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< core::string_view > rv = parse( "X", delim_rule( alpha_chars ) ); ---- == Parameters |=== | Name | Description | *cs* | The character set to use. |=== == See Also xref:#boost-urls-grammar-alpha_chars[alpha_chars], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-squelch[squelch]. Find the first character in the string that is in the set. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L144[boost/url/grammar/charset.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> char const* find_if( char const const* first, char const const* last, CS const& cs) noexcept; ---- == Description === Exception Safety Throws nothing. == Return Value A pointer to the found character, otherwise the value `last`. == Parameters |=== | Name | Description | *first* | A pointer to the first character in the string to search. | *last* | A pointer to one past the last character in the string to search. | *cs* | The character set to use. |=== == See Also xref:#boost-urls-grammar-find_if_not[find_if_not]. Find the first character in the string that is not in CharSet == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L182[boost/url/grammar/charset.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> char const* find_if_not( char const const* first, char const const* last, CS const& cs) noexcept; ---- == Description === Exception Safety Throws nothing. == Return Value A pointer to the found character, otherwise the value `last`. == Parameters |=== | Name | Description | *first* | A pointer to the first character in the string to search. | *last* | A pointer to one past the last character in the string to search. | *cs* | The character set to use. |=== == See Also xref:#boost-urls-grammar-find_if_not[find_if_not]. Return the decimal value of a hex character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/hexdig_chars.hpp#L163[boost/url/grammar/hexdig_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- signed char hexdig_value(char ch) noexcept; ---- == Description This function returns the decimal value of a hexadecimal character, or ‐1 if the argument is not a valid hexadecimal digit. === BNF [,cpp] ---- HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" / "a" / "b" / "c" / "d" / "e" / "f" ---- == Return Value The decimal value or ‐1 == Parameters |=== | Name | Description | *ch* | The character to check |=== Match another rule, if the result is not empty == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/not_empty_rule.hpp#L71[boost/url/grammar/not_empty_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> not_empty_rule(R const& r); ---- == Description This adapts another rule such that when an empty string is successfully parsed, the result is an error. === Value Type [,cpp] ---- using value_type = typename Rule::value_type; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< decode_view > rv = parse( "Program%20Files", not_empty_rule( pct_encoded_rule( unreserved_chars ) ) ); ---- == Parameters |=== | Name | Description | *r* | The rule to match |=== == See Also xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule], xref:#boost-urls-unreserved_chars[unreserved_chars]. Compare two string views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L788[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> constexpr bool operator!=( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Return the union of two character sets. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L299[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> operator+( <> const& cs0, <> const& cs1) noexcept; ---- == Description This function returns a new character set which contains all of the characters in `cs0` as well as all of the characters in `cs`. === Example This creates a character set which includes all letters and numbers [,cpp] ---- constexpr lut_chars alpha_chars( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"); constexpr lut_chars alnum_chars = alpha_chars + "0123456789"; ---- === Complexity Constant. == Return Value The new character set. == Parameters |=== | Name | Description | *cs0* | A character to join | *cs1* | A character to join |=== Return a new character set by subtracting == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/lut_chars.hpp#L336[boost/url/grammar/lut_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> operator‐( <> const& cs0, <> const& cs1) noexcept; ---- == Description This function returns a new character set which is formed from all of the characters in `cs0` which are not in `cs`. === Example This statement declares a character set containing all the lowercase letters which are not vowels: [,cpp] ---- constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou"; ---- === Complexity Constant. == Return Value The new character set. == Parameters |=== | Name | Description | *cs0* | A character set to join. | *cs1* | A character set to join. |=== Compare two string views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L803[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> constexpr bool operator<( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Format a string to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L863[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& s); ---- Compare two string views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L818[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> constexpr bool operator<=( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L773[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> constexpr bool operator==( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L833[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> constexpr bool operator>( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Compare two string views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_view_base.hpp#L848[boost/url/grammar/string_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class S0, class S1> constexpr bool operator>=( S0 const& s0, S1 const& s1) noexcept; ---- == Description This function is only enabled if both arguments are convertible to `core::string_view` and at least one of the arguments is derived from `string_view_base`. Match a rule, or the empty string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/optional_rule.hpp#L83[boost/url/grammar/optional_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> optional_rule(R const& r); ---- == Description Optional BNF elements are denoted with square brackets. If the specified rule returns any error it is treated as if the rule did not match. === Value Type [,cpp] ---- using value_type = optional< typename Rule::value_type >; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< optional< core::string_view > > rv = parse( "", optional_rule( token_rule( alpha_chars ) ) ); ---- === BNF [,cpp] ---- optional = [ rule ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.8[3.8. Optional Sequence (rfc5234)] == Parameters |=== | Name | Description | *r* | The rule to match |=== == See Also xref:#boost-urls-grammar-alpha_chars[alpha_chars], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-optional[optional], xref:#boost-urls-grammar-token_rule[token_rule]. Parse a character buffer using a rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/parse.hpp#L37[boost/url/grammar/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> system::result<R::value_type> <>( char const*& it, char const* end, R const& r); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> system::result<R::value_type> <>( core::string_view s, R const& r); ---- [.small]#<># == Return Value The parsed value upon success, otherwise an error. == Parameters |=== | Name | Description | *it* | A pointer to the start. The caller's variable is changed to reflect the amount of input consumed. | *end* | A pointer to the end. | *r* | The rule to use | *s* | The input string |=== Parse a character buffer using a rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/parse.hpp#L37[boost/url/grammar/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> system::result<R::value_type> parse( char const*& it, char const* end, R const& r); ---- == Return Value The parsed value upon success, otherwise an error. == Parameters |=== | Name | Description | *it* | A pointer to the start. The caller's variable is changed to reflect the amount of input consumed. | *end* | A pointer to the end. | *r* | The rule to use |=== Parse a character buffer using a rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/parse.hpp#L58[boost/url/grammar/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> system::result<R::value_type> parse( core::string_view s, R const& r); ---- == Description This function parses a complete string into the specified sequence of rules. If the string is not completely consumed, an error is returned instead. == Return Value The parsed value upon success, otherwise an error. == Parameters |=== | Name | Description | *s* | The input string | *r* | The rule to use |=== Match a repeating number of elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L381[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> <>( R const& next, std::size_t N = 0, std::size_t M = std::size_t(‐1)) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< <> R1, <> R2> constexpr /* implementation-defined */::<><R1, R2> <>( R1 const& first, R2 const& next, std::size_t N = 0, std::size_t M = std::size_t(‐1)) noexcept; ---- [.small]#<># == Description Elements are matched using the passed rule. Normally when the rule returns an error, the range ends and the input is rewound to one past the last character that matched successfully. However, if the rule returns the special value xref:#boost-urls-grammar-error[error::end_of_range], the input is not rewound. This allows for rules which consume input without producing elements in the range. For example, to relax the grammar for a comma‐delimited list by allowing extra commas in between elements. === Value Type [,cpp] ---- using value_type = range< typename Rule::value_type >; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- // range = 1*( ";" token ) system::result< range > rv = parse( ";alpha;xray;charlie", range_rule( tuple_rule( squelch( delim_rule( ';' ) ), token_rule( alpha_chars ) ), 1 ) ); ---- === BNF [,cpp] ---- range = *next ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.6[3.6. Variable Repetition (rfc5234)] == Parameters |=== | Name | Description | *next* | The rule to use for matching each element. The range extends until this rule returns an error. | *N* | The minimum number of elements for the range to be valid. If omitted, this defaults to zero. | *M* | The maximum number of elements for the range to be valid. If omitted, this defaults to unlimited. | *first* | The rule to use for matching the first element. If this rule returns an error, the range is empty. |=== == See Also xref:#boost-urls-grammar-alpha_chars[alpha_chars], xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-error[error::end_of_range], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-range[range], xref:#boost-urls-grammar-tuple_rule[tuple_rule], xref:#boost-urls-grammar-squelch[squelch]. Match a repeating number of elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L381[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> range_rule( R const& next, std::size_t N = 0, std::size_t M = std::size_t(‐1)) noexcept; ---- == Description Elements are matched using the passed rule. Normally when the rule returns an error, the range ends and the input is rewound to one past the last character that matched successfully. However, if the rule returns the special value xref:#boost-urls-grammar-error[error::end_of_range], the input is not rewound. This allows for rules which consume input without producing elements in the range. For example, to relax the grammar for a comma‐delimited list by allowing extra commas in between elements. === Value Type [,cpp] ---- using value_type = range< typename Rule::value_type >; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- // range = 1*( ";" token ) system::result< range > rv = parse( ";alpha;xray;charlie", range_rule( tuple_rule( squelch( delim_rule( ';' ) ), token_rule( alpha_chars ) ), 1 ) ); ---- === BNF [,cpp] ---- range = *next ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.6[3.6. Variable Repetition (rfc5234)] == Parameters |=== | Name | Description | *next* | The rule to use for matching each element. The range extends until this rule returns an error. | *N* | The minimum number of elements for the range to be valid. If omitted, this defaults to zero. | *M* | The maximum number of elements for the range to be valid. If omitted, this defaults to unlimited. |=== == See Also xref:#boost-urls-grammar-alpha_chars[alpha_chars], xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-error[error::end_of_range], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-range[range], xref:#boost-urls-grammar-tuple_rule[tuple_rule], xref:#boost-urls-grammar-squelch[squelch]. Match a repeating number of elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/range_rule.hpp#L509[boost/url/grammar/range_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< <> R1, <> R2> constexpr /* implementation-defined */::<><R1, R2> range_rule( R1 const& first, R2 const& next, std::size_t N = 0, std::size_t M = std::size_t(‐1)) noexcept; ---- == Description Two rules are used for match. The rule `first` is used for matching the first element, while the `next` rule is used to match every subsequent element. Normally when the rule returns an error, the range ends and the input is rewound to one past the last character that matched successfully. However, if the rule returns the special value xref:#boost-urls-grammar-error[error::end_of_range], the input is not rewound. This allows for rules which consume input without producing elements in the range. For example, to relax the grammar for a comma‐delimited list by allowing extra commas in between elements. === Value Type [,cpp] ---- using value_type = range< typename Rule::value_type >; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- // range = [ token ] *( "," token ) system::result< range< core::string_view > > rv = parse( "whiskey,tango,foxtrot", range_rule( token_rule( alpha_chars ), // first tuple_rule( // next squelch( delim_rule(',') ), token_rule( alpha_chars ) ) ) ); ---- === BNF [,cpp] ---- range = <1>*<1>first / first *next ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.6[3.6. Variable Repetition (rfc5234)] == Parameters |=== | Name | Description | *first* | The rule to use for matching the first element. If this rule returns an error, the range is empty. | *next* | The rule to use for matching each subsequent element. The range extends until this rule returns an error. | *N* | The minimum number of elements for the range to be valid. If omitted, this defaults to zero. | *M* | The maximum number of elements for the range to be valid. If omitted, this defaults to unlimited. |=== == See Also xref:#boost-urls-grammar-alpha_chars[alpha_chars], xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-error[error::end_of_range], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-range[range], xref:#boost-urls-grammar-tuple_rule[tuple_rule], xref:#boost-urls-grammar-squelch[squelch]. Return a reference to a character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L251[boost/url/grammar/charset.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> constexpr /* implementation-defined */::<><CS> <>(CS const& cs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> <>(R const& r) noexcept; ---- [.small]#<># == Description This function returns a character set which references the specified object. This is used to reduce the number of bytes of storage (`sizeof`) required by a combinator when it stores a copy of the object. Ownership of the object is not transferred; the caller is responsible for ensuring the lifetime of the object is extended until it is no longer referenced. For best results, `ref` should only be used with compile‐time constants. == Parameters |=== | Name | Description | *r* | The rule to use |=== Return a reference to a character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L251[boost/url/grammar/charset.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> constexpr /* implementation-defined */::<><CS> ref(CS const& cs) noexcept; ---- == Description This function returns a character set which references the specified object. This is used to reduce the number of bytes of storage (`sizeof`) required by a combinator when it stores a copy of the object. Ownership of the object is not transferred; the caller is responsible for ensuring the lifetime of the object is extended until it is no longer referenced. For best results, `ref` should only be used with compile‐time constants. Return a reference to a rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/parse.hpp#L102[boost/url/grammar/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> ref(R const& r) noexcept; ---- == Description This function returns a rule which references the specified object. This is used to reduce the number of bytes of storage (`sizeof`) required by a combinator when it stores a copy of the object. Ownership of the object is not transferred; the caller is responsible for ensuring the lifetime of the object is extended until it is no longer referenced. For best results, `ref` should only be used with compile‐time constants. == Parameters |=== | Name | Description | *r* | The rule to use |=== Squelch the value of a rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/tuple_rule.hpp#L218[boost/url/grammar/tuple_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> R> constexpr /* implementation-defined */::<><R> squelch(R const& r) noexcept; ---- == Description This function returns a new rule which matches the specified rule, and converts its value type to `void`. This is useful for matching delimiters in a grammar, where the value for the delimiter is not needed. === Value Type [,cpp] ---- using value_type = void; ---- === Example 1 With `squelch`: [,cpp] ---- system::result< std::tuple< decode_view, core::string_view > > rv = parse( "www.example.com:443", tuple_rule( pct_encoded_rule(unreserved_chars + '-' + '.'), squelch( delim_rule( ':' ) ), token_rule( digit_chars ) ) ); ---- === Example 2 Without `squelch`: [,cpp] ---- system::result< std::tuple< decode_view, core::string_view, core::string_view > > rv = parse( "www.example.com:443", tuple_rule( pct_encoded_rule(unreserved_chars + '-' + '.'), delim_rule( ':' ), token_rule( digit_chars ) ) ); ---- == Parameters |=== | Name | Description | *r* | The rule to squelch |=== == See Also xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-digit_chars[digit_chars], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-tuple_rule[tuple_rule], xref:#boost-urls-grammar-token_rule[token_rule], xref:#boost-urls-decode_view[decode_view], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule], xref:#boost-urls-unreserved_chars[unreserved_chars]. Return c converted to lowercase == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L53[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr char to_lower(char c) noexcept; ---- == Description This function returns the character, converting it to lowercase if it is uppercase. The function is defined only for low‐ASCII characters. === Example [,cpp] ---- assert( to_lower( 'A' ) == 'a' ); ---- === Exception Safety Throws nothing. == Return Value The converted character == Parameters |=== | Name | Description | *c* | The character to convert |=== == See Also xref:#boost-urls-grammar-to_upper[to_upper]. Return c converted to uppercase == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L83[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr char to_upper(char c) noexcept; ---- == Description This function returns the character, converting it to uppercase if it is lowercase. The function is defined only for low‐ASCII characters. === Example [,cpp] ---- assert( to_upper( 'a' ) == 'A' ); ---- === Exception Safety Throws nothing. == Return Value The converted character == Parameters |=== | Name | Description | *c* | The character to convert |=== == See Also xref:#boost-urls-grammar-to_lower[to_lower]. Match a non‐empty string of characters from a set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/token_rule.hpp#L78[boost/url/grammar/token_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<> CS> constexpr /* implementation-defined */::<><CS> token_rule(CS const& cs) noexcept; ---- == Description If there is no more input, the error code xref:#boost-urls-grammar-error[error::need_more] is returned. === Value Type [,cpp] ---- using value_type = core::string_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< core::string_view > rv = parse( "abcdef", token_rule( alpha_chars ) ); ---- === BNF [,cpp] ---- token = 1*( ch ) ---- == Parameters |=== | Name | Description | *cs* | The character set to use |=== == See Also xref:#boost-urls-grammar-alpha_chars[alpha_chars], xref:#boost-urls-grammar-parse-02[parse]. Match a series of rules in order == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/tuple_rule.hpp#L122[boost/url/grammar/tuple_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< <> R0, <>... Rn> constexpr /* implementation-defined */::<><R0, Rn...> tuple_rule( R0 const& r0, Rn const&... rn) noexcept; ---- == Description This matches a series of rules in the order specified. Upon success the input is adjusted to point to the first unconsumed character. There is no implicit specification of linear white space between each rule. === Value Type [,cpp] ---- using value_type = __see_below__; ---- The sequence rule usually returns a `std::tuple` containing the the `value_type` of each corresponding rule in the sequence, except that `void` values are removed. However, if there is exactly one non‐void value type `T`, then the sequence rule returns `system::result<T>` instead of `system::result<tuple<...>>`. === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< std::tuple< unsigned char, unsigned char, unsigned char, unsigned char > > rv = parse( "192.168.0.1", tuple_rule( dec_octet_rule, squelch( delim_rule('.') ), dec_octet_rule, squelch( delim_rule('.') ), dec_octet_rule, squelch( delim_rule('.') ), dec_octet_rule ) ); ---- === BNF [,cpp] ---- sequence = rule1 rule2 rule3... ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.1[3.1. Concatenation (rfc5234)] == Parameters |=== | Name | Description | *rn* | A list of one or more rules to match |=== == See Also xref:#boost-urls-grammar-dec_octet_rule[dec_octet_rule], xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-squelch[squelch]. Match one of a set of rules == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/variant_rule.hpp#L101[boost/url/grammar/variant_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< <> R0, <>... Rn> constexpr /* implementation-defined */::<><R0, Rn...> variant_rule( R0 const& r0, Rn const&... rn) noexcept; ---- == Description Each specified rule is tried in sequence. When the first match occurs, the result is stored and returned in the variant. If no match occurs, an error is returned. === Value Type [,cpp] ---- using value_type = variant< typename Rules::value_type... >; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- // request-target = origin-form // / absolute-form // / authority-form // / asterisk-form system::result< variant< url_view, url_view, authority_view, core::string_view > > rv = grammar::parse( "/index.html?width=full", variant_rule( origin_form_rule, absolute_uri_rule, authority_rule, delim_rule('*') ) ); ---- === BNF [,cpp] ---- variant = rule1 / rule2 / rule3... ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.2[3.2. Alternatives (rfc5234)] * link:https://datatracker.ietf.org/doc/html/rfc7230#section-5.3[5.3. Request Target (rfc7230)] == See Also xref:#boost-urls-absolute_uri_rule[absolute_uri_rule], xref:#boost-urls-authority_rule[authority_rule], xref:#boost-urls-grammar-delim_rule-01[delim_rule], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-origin_form_rule[origin_form_rule], xref:#boost-urls-url_view[url_view]. Error conditions for errors received from rules == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/error.hpp#L114[boost/url/grammar/error.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- enum class condition : int; ---- == Members [,cols=2] |=== |Name |Description |`fatal` |A fatal error in syntax was encountered. |=== == See Also xref:#boost-urls-grammar-error[error], xref:#boost-urls-grammar-parse-02[parse]. Error codes returned when using rules == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/error.hpp#L26[boost/url/grammar/error.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- enum class error : int; ---- == Members [,cols=2] |=== |Name |Description |`need_more` |More input is needed to match the rule |`mismatch` |The rule did not match the input. |`end_of_range` |A rule reached the end of a range |`leftover` |Leftover input remaining after match. |`invalid` |A rule encountered unrecoverable invalid input. |`out_of_range` |An integer overflowed during parsing. |`syntax` |An unspecified syntax error was found. |=== == See Also xref:#boost-urls-grammar-condition[condition], xref:#boost-urls-grammar-parse-02[parse]. Provides an aligned storage buffer aligned for T == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/recycled.hpp#L43[boost/url/grammar/recycled.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using aligned_storage = /* implementation-defined */::aligned_storage_impl<implementation_defined::nearest_pow2(sizeof(T), 64), (alignof(::max_align_t) > alignof(T)) ? alignof(::max_align_t) : alignof(T)>; ---- == Description [,cpp] ---- template struct aligned_storage { /// Return a pointer to the aligned storage area void* addr() noexcept; /// Return a pointer to the aligned storage area void const* addr() const noexcept; }; ---- A case‐insensitive equals predicate for strings == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L314[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using ci_equal = /* implementation-defined */::<>; ---- == Description The function object returns `true` when two strings are equal, ignoring case. This is a suitable equality predicate for unordered containers. The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- boost::unordered_map< std::string, std::string, ci_hash, ci_equal > m1; std::unordered_map < std::string, std::string, ci_hash, ci_equal > m2; // (since C++20) ---- == See Also xref:#boost-urls-grammar-ci_hash[ci_hash], xref:#boost-urls-grammar-ci_less[ci_less]. A case‐insensitive hash function object for strings == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L275[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using ci_hash = /* implementation-defined */::<>; ---- == Description The hash function is non‐cryptographic and not hardened against algorithmic complexity attacks. This is a suitable hash function for unordered containers. The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- boost::unordered_map< std::string, std::string, ci_hash, ci_equal > m1; std::unordered_map < std::string, std::string, ci_hash, ci_equal > m2; // (since C++20) ---- == See Also xref:#boost-urls-grammar-ci_equal[ci_equal], xref:#boost-urls-grammar-ci_less[ci_less]. A case‐insensitive less predicate for strings == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/ci_string.hpp#L353[boost/url/grammar/ci_string.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using ci_less = /* implementation-defined */::<>; ---- == Description The comparison algorithm implements a case‐insensitive total order on the set of all ASCII strings; however, it is not a lexicographical comparison. This is a suitable predicate for ordered containers. The function is defined only for strings containing low‐ASCII characters. === Example [,cpp] ---- boost::container::map< std::string, std::string, ci_less > m1; std::map< std::string, std::string, ci_less > m2; // (since C++14) ---- == See Also xref:#boost-urls-grammar-ci_equal[ci_equal], xref:#boost-urls-grammar-ci_hash[ci_hash]. Alias for `std::true_type` if T satisfies xref:#boost-urls-grammar-CharSet[CharSet]. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L66[boost/url/grammar/charset.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using is_charset = /* implementation-defined */::<><T>; ---- == Description This metafunction determines if the type `T` meets these requirements of _CharSet_: * An instance of `T` is invocable with this equivalent function signature: [,cpp] ---- bool T::operator()( char ) const noexcept; ---- === Example Use with `enable_if` on the return value: [,cpp] ---- template< class CharSet > typename std::enable_if< is_charset::value >::type func( CharSet const& cs ); ---- == Template Parameters |=== | Name | Description | *T* | the type to check. |=== Determine if T meets the requirements of xref:#boost-urls-grammar-Rule[Rule] == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/type_traits.hpp#L62[boost/url/grammar/type_traits.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using is_rule = /* implementation-defined */::<><T>; ---- == Description This is an alias for `std::true_type` if `T` meets the requirements, otherwise it is an alias for `std::false_type`. === Example [,cpp] ---- struct U { struct value_type; auto parse( char const*& it, char const* end) const -> system::result }; static_assert( is_rule::value, "Requirements not met" ); ---- == See Also xref:#boost-urls-grammar-parse-02[parse]. The set of all characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/all_chars.hpp#L99[boost/url/grammar/all_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr /* implementation-defined */::<> all_chars = all_chars{}; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- system::result< core::string_view > rv = parse( "JohnDoe", token_rule( all_chars ) ); ---- === BNF [,cpp] ---- ALL = %x00-FF ---- == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. The set of letters and digits == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/alnum_chars.hpp#L118[boost/url/grammar/alnum_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> alnum_chars = {}; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- system::result< core::string_view > = parse( "Johnny42", token_rule( alnumchars ) ); ---- === BNF [,cpp] ---- ALNUM = ALPHA / DIGIT ALPHA = %x41-5A / %x61-7A ; A-Z / a-z DIGIT = %x30-39 ; 0-9 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1[B.1. Core Rules (rfc5234)] == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. The set of all letters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/alpha_chars.hpp#L110[boost/url/grammar/alpha_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> alpha_chars = alpha_chars{}; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- system::result< core::string_view > rv = parse( "JohnDoe", token_rule( alpha_chars ) ); ---- === BNF [,cpp] ---- ALPHA = %x41-5A / %x61-7A ; A-Z / a-z ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1[B.1. Core Rules (rfc5234)] == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. Match a decimal octet == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/dec_octet_rule.hpp#L104[boost/url/grammar/dec_octet_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> dec_octet_rule = {}; ---- == Description A decimal octet is precise way of saying a number from 0 to 255. These are commonly used in IPv4 addresses. === Value Type [,cpp] ---- using value_type = unsigned char; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[parse]. [,cpp] ---- system::result< unsigned char > rv = parse( "255", dec_octet_rule ); ---- === BNF [,cpp] ---- dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == See Also xref:#boost-urls-grammar-parse-02[parse]. The set of decimal digits == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/digit_chars.hpp#L105[boost/url/grammar/digit_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> digit_chars = {}; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- system::result< core::string_view > rv = parse( "2022", token_rule( digit_chars ) ); ---- === BNF [,cpp] ---- DIGIT = %x30-39 ; 0-9 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1[B.1. Core Rules (rfc5234)] == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. The set of hexadecimal digits == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/hexdig_chars.hpp#L136[boost/url/grammar/hexdig_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> hexdig_chars = {}; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- system::result< core::string_view > rv = parse( "8086FC19", token_rule( hexdig_chars ) ); ---- === BNF [,cpp] ---- HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" / "a" / "b" / "c" / "d" / "e" / "f" ---- [NOTE] The RFCs are inconsistent on the case sensitivity of hexadecimal digits. Existing uses suggest case‐insensitivity is a de‐facto standard. === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1[B.1. Core Rules (rfc5234)] * link:https://datatracker.ietf.org/doc/html/rfc7230#section-1.2[1.2. Syntax Notation (rfc7230)] * link:https://datatracker.ietf.org/doc/html/rfc5952#section-2.3[2.3. Uppercase or Lowercase (rfc5952)] * link:https://datatracker.ietf.org/doc/html/rfc5952#section-4.3[4.3. Lowercase (rfc5952)] == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-hexdig_value[hexdig_value], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. The set of visible characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/vchars.hpp#L105[boost/url/grammar/vchars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> vchars = {}; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[find_if] and xref:#boost-urls-grammar-find_if_not[find_if_not]. [,cpp] ---- system::result< core::string_view > rv = parse( "JohnDoe", token_rule( vchars ) ); ---- === BNF [,cpp] ---- VCHAR = 0x21-0x7E ; visible (printing) characters ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1[B.1. Core Rules (rfc5234)] == See Also xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not], xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-token_rule[token_rule]. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L467[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- namespace string_token = <>::<>::<>; ---- Concept for a CharSet == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L114[boost/url/grammar/charset.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> concept CharSet = requires (T const t, char c) { { t(c) } ‐> std::convertible_to<bool>; }; ---- == Description A `CharSet` is a unary predicate which is invocable with this equivalent signature: [,cpp] ---- bool( char ch ) const noexcept; ---- The predicate returns `true` if `ch` is a member of the set, or `false` otherwise. === Exemplar For best results, it is suggested that all constructors and member functions for character sets be marked `constexpr`. [,cpp] ---- struct CharSet { bool operator()( char c ) const noexcept; // These are both optional. If either or both are left // unspecified, a default implementation will be used. // char const* find_if( char const* first, char const* last ) const noexcept; char const* find_if_not( char const* first, char const* last ) const noexcept; }; ---- === Models * alnum_chars * alpha_chars * digit_chars * hexdig_chars * lut_chars == See Also xref:#boost-urls-grammar-is_charset[is_charset], xref:#boost-urls-grammar-find_if[find_if], xref:#boost-urls-grammar-find_if_not[find_if_not]. Concept for a grammar Rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/type_traits.hpp#L119[boost/url/grammar/type_traits.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> concept Rule = requires (T t, char const*& it, char const* end) { typename T::value_type; { t.parse(it, end) } ‐> std::same_as<system::result<typename T::value_type>>; }; ---- == Description This concept is satisfied if `T` is a valid grammar Rule A `Rule` defines an algorithm used to match an input buffer of ASCII characters against a set of syntactical specifications. Each rule represents either a terminal symbol or a composition in the represented grammar. The library comes with a set of rules for productions typically found in RFC documents. Rules are not invoked directly; instead, rule variables are used with overloads of xref:#boost-urls-grammar-parse-02[parse] which provide a convenient, uniform front end. === Exemplar For best results, it is suggested that all constructors for rules be marked `constexpr`. [,cpp] ---- struct Rule { struct value_type; constexpr Rule( Rule const& ) noexcept = default; auto parse( char const*& it, char const* end ) const -> result< value_type >; }; // Declare a variable of type Rule for notational convenience constexpr Rule rule{}; ---- === Model * dec_octet_rule * delim_rule * not_empty_rule * optional_rule * range_rule * token_rule * tuple_rule * unsigned_rule * variant_rule == See Also xref:#boost-urls-grammar-parse-02[parse], xref:#boost-urls-grammar-is_rule[is_rule]. == Types [cols=2] |=== | Name | Description | <> | Base class for string tokens, and algorithm parameters | <> | Trait to determine if a type is a string token | <> | A string token for returning a plain string |=== == Functions [cols=2] |=== | Name | Description | <> | Create a string token for appending to a plain string | <> | Create a string token for assigning to a plain string | <> | Create a string token for a durable core::string_view |=== == Concepts [cols=2] |=== | Name | Description | <> | Concept for a string token |=== Base class for string tokens, and algorithm parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L51[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct arg; ---- == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Default constructor Default move constructor Deleted copy constructor | <> [.small]#[deleted]# | Deleted copy assignment Deleted move assignment | <> [.small]#[virtual]# | Return a modifiable character buffer | <> [.small]#[destructor]# [.small]#[virtual]# | Virtual destructor |=== == Description This abstract interface provides a means for an algorithm to generically obtain a modifiable, contiguous character buffer of prescribed size. A xref:#boost-urls-string_token-StringToken[StringToken] should be derived from this class. As the author of an algorithm using a xref:#boost-urls-string_token-StringToken[StringToken], simply declare an rvalue reference as a parameter type. Instances of this type are intended only to be used once and then destroyed. === Example The declared function accepts any temporary instance of `arg` to be used for writing: [,cpp] ---- void algorithm( string_token::arg&& dest ); ---- To implement the interface for your type or use‐case, derive from the class and implement the prepare function. Default constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L76[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<>&&) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const&) = delete; ---- [.small]#<># Default constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L76[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr arg() = default; ---- Default move constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L79[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr arg(<>&&) = default; ---- Deleted copy constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L82[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- arg(<> const&) = delete; ---- Deleted move assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L85[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<>&&) = delete; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const&) = delete; ---- [.small]#<># Deleted move assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L85[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<>&&) = delete; ---- Deleted copy assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L88[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const&) = delete; ---- Return a modifiable character buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L70[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- virtual char* prepare(std::size_t n) = 0; ---- == Description This function attempts to obtain a character buffer with space for at least `n` characters. Upon success, a pointer to the beginning of the buffer is returned. Ownership is not transferred; the caller should not attempt to free the storage. The buffer shall remain valid until `this` is destroyed. [NOTE] This function may only be called once. After invoking the function, the only valid operation is destruction. Virtual destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L73[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr virtual ~arg() = default; ---- Create a string token for appending to a plain string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L326[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Alloc = std::allocator<char>> /* implementation-defined */::<><Alloc> append_to(std::basic_string<char, std::char_traits<char>, Alloc>& s); ---- == Description This function creates a xref:#boost-urls-string_token-StringToken[StringToken] which appends to an existing plain string. Functions using this token will append the result to the existing string and return a reference to it. Create a string token for assigning to a plain string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L386[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Alloc = std::allocator<char>> /* implementation-defined */::<><Alloc> assign_to(std::basic_string<char, std::char_traits<char>, Alloc>& s); ---- == Description This function creates a xref:#boost-urls-string_token-StringToken[StringToken] which assigns to an existing plain string. Functions using this token will assign the result to the existing string and return a reference to it. Create a string token for a durable core::string_view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L452[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Alloc = std::allocator<char>> /* implementation-defined */::<><Alloc> preserve_size(std::basic_string<char, std::char_traits<char>, Alloc>& s); ---- == Description This function creates a xref:#boost-urls-string_token-StringToken[StringToken] which assigns to an existing plain string. Functions using this token will assign the result to the existing string and return a `core::string_view` to it. Trait to determine if a type is a string token == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L127[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using is_token = /* implementation-defined */::<><T>; ---- == Description This trait returns `true` if `T` is a valid xref:#boost-urls-string_token-StringToken[StringToken] type, and `false` otherwise. === Example [,cpp] ---- static_assert( string_token::is_token::value ); ---- A string token for returning a plain string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L274[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using return_string = /* implementation-defined */::<>; ---- == Description This xref:#boost-urls-string_token-StringToken[StringToken] is used to customize a function to return a plain string. This is default token type used by the methods of xref:#boost-urls-url_view_base[url_view_base] that return decoded strings. Concept for a string token == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/string_token.hpp#L228[boost/url/grammar/string_token.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> concept StringToken = std::derived_from<T, string_token::arg> && requires (T t, std::size_t n) { typename T::result_type; { t.prepare(n) } ‐> std::same_as<char*>; { t.result() } ‐> std::convertible_to<typename T::result_type>; }; ---- == Description This concept is satisfied if `T` is a valid string token type. A string token is an rvalue passed to a function template which customizes the return type of the function and also controls how a modifiable character buffer is obtained and presented. The string token's lifetime extends only for the duration of the function call in which it appears as a parameter. A string token cannot be copied, moved, or assigned, and must be destroyed when the function returns or throws. === Semantics `T::result_type` determines the return type of functions that accept a string token. The `prepare()` function overrides the virtual function in the base class xref:#boost-urls-string_token-arg[arg]. It must return a pointer to a character buffer of at least size `n`, otherwise throw an exception. This function is called only once or not at all. The `result()` function is invoked by the algorithm to receive the result from the string token. It is only invoked if `prepare()` returned successfully and the string token was not destroyed. It is only called after `prepare()` returns successfully, and the string token is destroyed when the algorithm completes or if an exception is thrown. String tokens cannot be reused. === Exemplars String token prototype: [,cpp] ---- struct StringToken : string_token::arg { using result_type = std::string; char* prepare( std::size_t n ) override; result_type result(); }; ---- Algorithm prototype: [,cpp] ---- namespace detail { // Algorithm implementation may be placed // out of line, and written as an ordinary // function (no template required). void algorithm_impl( string_token::arg& token ) { std::size_t n = 0; // calculate space needed in n // ... // acquire a destination buffer char* dest = token.prepare( n ); // write the characters to the buffer } } // detail // public interface is a function template, // defaulting to return std::string. template< class StringToken = string_token::return_string > auto algorithm( StringToken&& token = {} ) -> typename StringToken::result_type { // invoke the algorithm with the token algorithm_impl( token ); // return the result from the token return token.result(); } ---- === Models The following classes and functions implement and generate string tokens. * return_string * assign_to * preserve_size A non‐owning reference to a valid authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L82[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class authority_view; ---- == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Construct from a string. Constructor | <> | Return the complete authority | <> | Return the result of comparing this with another authority | <> | Return a pointer to the first character | <> | Return true if the authority is empty | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the password | <> | Return the user | <> | Return the userinfo | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Assignment | <> | Return the password | <> | Return the port | <> | Return the port | <> | Return the number of characters in the authority | <> | Return the user | <> | Return the userinfo | <> [.small]#[destructor]# [.small]#[virtual]# | Destructor |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Format the encoded authority to the output stream | <> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. | <> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |=== == Description Objects of this type represent valid authority strings constructed from a parsed, external character buffer whose storage is managed by the caller. That is, it acts like a `core::string_view` in terms of ownership. The caller is responsible for ensuring that the lifetime of the underlying character buffer extends until it is no longer referenced. === Example 1 Construction from a string parses the input as an _authority_ and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred. [,cpp] ---- authority_view a( "user:pass@www.example.com:8080" ); ---- === Example 2 The parsing function xref:#boost-urls-parse_authority[parse_authority] returns a result containing either a valid xref:#boost-urls-authority_view-2constructor-0e[authority_view] upon succcess, otherwise it contain an error. The error can be converted to an exception by the caller if desired: [,cpp] ---- system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" ); ---- === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == See Also xref:#boost-urls-parse_authority[parse_authority]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L121[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const&) noexcept; ---- [.small]#<># == Description Default constructed authorities refer to a string with zero length, which is always valid. This matches the grammar for a zero‐length host. === Exception Safety Throws nothing. === Specification Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L121[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- authority_view() noexcept; ---- == Description Default constructed authorities refer to a string with zero length, which is always valid. This matches the grammar for a zero‐length host. === Exception Safety Throws nothing. === Specification Construct from a string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L158[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit authority_view(core::string_view s); ---- == Description This function attempts to construct an authority from the string `s`, which must be a valid ['authority] or else an exception is thrown. Upon successful construction, the view refers to the characters in the buffer pointed to by `s`. Ownership is not transferred; The caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == See Also xref:#boost-urls-parse_authority[parse_authority]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L163[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- authority_view(<> const&) noexcept; ---- Return the complete authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L253[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view buffer() const noexcept; ---- == Description This function returns the authority as a percent‐encoded string. === Example [,cpp] ---- assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" ); ---- === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] Return the result of comparing this with another authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1232[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int compare(<> const& other) const noexcept; ---- == Description This function compares two authorities according to Syntax‐Based comparison algorithm. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `‐1` if `*this < other`, `0` if `this == other`, and 1 if `this > other`. Return a pointer to the first character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L225[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char const* data() const noexcept; ---- == Description This function returns a pointer to the beginning of the view, which is not guaranteed to be null‐terminated. === Exception Safety Throws nothing. Return true if the authority is empty == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L210[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description An empty authority has an empty host, no userinfo, and no port. === Example [,cpp] ---- assert( authority_view( "" ).empty() ); ---- === Exception Safety Throws nothing. Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L743[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host() const noexcept; ---- == Description This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L857[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host_address() const noexcept; ---- == Description The value returned by this function depends on the type of host returned from the function xref:#boost-urls-authority_view-host_type[host_type]. * If the type is host_type::ipv4 , then the IPv4 address string is returned. * If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets. * If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets. * If the type is host_type::name , then the host name string is returned. Any percent‐escapes in the string are decoded first. * If the type is host_type::none , then an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host and port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1207[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host_and_port() const noexcept; ---- == Description If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-authority_view-has_port[has_port], xref:#boost-urls-authority_view-port[port], xref:#boost-urls-authority_view-port_number[port_number]. Return the host name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1057[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host_name() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::name], this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L627[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_password() const noexcept; ---- == Description This function returns the password portion of the userinfo as a percent‐encoded string. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-user[user], xref:#boost-urls-authority_view-userinfo[userinfo]. Return the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L494[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_user() const noexcept; ---- == Description If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-user[user], xref:#boost-urls-authority_view-userinfo[userinfo]. Return the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L396[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_userinfo() const noexcept; ---- == Description If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" ); ---- === Complexity Constant. === Exception Safety Throws nothing === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-user[user], xref:#boost-urls-authority_view-userinfo[userinfo]. Return true if a password is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L535[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_password() const noexcept; ---- == Description This function returns true if the userinfo is present and contains a password. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-user[user], xref:#boost-urls-authority_view-userinfo[userinfo]. Return true if a port is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1098[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_port() const noexcept; ---- == Description This function returns true if an authority is present and contains a port. === Example [,cpp] ---- assert( url_view( "wss://www.example.com:443" ).has_port() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-authority_view-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-authority_view-port[port], xref:#boost-urls-authority_view-port_number[port_number]. Return true if a userinfo is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L302[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_userinfo() const noexcept; ---- == Description This function returns true if this contains a userinfo. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-user[user], xref:#boost-urls-authority_view-userinfo[userinfo]. Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L700[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type host(StringToken&& token); ---- == Description This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" ); ---- === Complexity Linear in `this‐>host().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L795[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type host_address(StringToken&& token); ---- == Description The value returned by this function depends on the type of host returned from the function xref:#boost-urls-authority_view-host_type[host_type]. * If the type is host_type::ipv4 , then the IPv4 address string is returned. * If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets. * If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets. * If the type is host_type::name , then the host name string is returned. Any percent‐escapes in the string are decoded first. * If the type is host_type::none , then an empty string is returned. === Example [,cpp] ---- assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" ); ---- === Complexity Linear in `this‐>host_address().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPv4 address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L896[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> host_ipv4_address() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipv4], this function returns the address as a value of type xref:#boost-urls-ipv4_address[ipv4_address]. Otherwise, if the host type is not an IPv4 address, it returns a default‐constructed value which is equal to the unspecified address "0.0.0.0". === Example [,cpp] ---- assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPv6 address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L943[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> host_ipv6_address() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the address as a value of type xref:#boost-urls-ipv6_address[ipv6_address]. Otherwise, if the host type is not an IPv6 address, it returns a default‐constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0". === Example [,cpp] ---- assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPvFuture address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L975[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view host_ipvfuture() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipvfuture], this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string. === Example [,cpp] ---- assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1012[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type host_name(StringToken&& token); ---- == Description If the host type is xref:#boost-urls-host_type[host_type::name], this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" ); ---- === Complexity Linear in `this‐>host_name().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L662[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>::<> host_type() const noexcept; ---- == Description This function returns one of the following constants representing the type of host present. * host_type::ipv4 * host_type::ipv6 * host_type::ipvfuture * host_type::name === Example [,cpp] ---- assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L168[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const&) noexcept; ---- Return the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L579[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type password(StringToken&& token); ---- == Description If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" ); ---- === Complexity Linear in `this‐>password().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-user[user], xref:#boost-urls-authority_view-userinfo[userinfo]. Return the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1133[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view port() const noexcept; ---- == Description If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string. === Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port() == "8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-authority_view-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-authority_view-has_port[has_port], xref:#boost-urls-authority_view-port_number[port_number]. Return the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1168[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::uint16_t port_number() const noexcept; ---- == Description If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned. === Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-authority_view-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-authority_view-has_port[has_port], xref:#boost-urls-authority_view-port[port]. Return the number of characters in the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L191[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- == Description This function returns the number of characters in the authority. === Example [,cpp] ---- assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 ); ---- === Exception Safety Throws nothing. Return the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L442[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type user(StringToken&& token); ---- == Description If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" ); ---- === Complexity Linear in `this‐>user().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-userinfo[userinfo]. Return the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L345[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type userinfo(StringToken&& token); ---- == Description If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" ); ---- === Complexity Linear in `this‐>userinfo().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-authority_view-has_password[has_password], xref:#boost-urls-authority_view-has_userinfo[has_userinfo], xref:#boost-urls-authority_view-encoded_password[encoded_password], xref:#boost-urls-authority_view-encoded_user[encoded_user], xref:#boost-urls-authority_view-encoded_userinfo[encoded_userinfo], xref:#boost-urls-authority_view-password[password], xref:#boost-urls-authority_view-user[user]. Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L106[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- virtual ~authority_view(); ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1266[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator!=( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1286[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator<( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Format the encoded authority to the output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1375[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend std::ostream& operator<<( std::ostream& os, <> const& a); ---- == Description This hidden friend function serializes the encoded URL to the output stream. === Example [,cpp] ---- authority_view a( "www.example.com" ); std::cout << a << std::endl; ---- == Return Value A reference to the output stream, for chaining == Parameters |=== | Name | Description | *os* | The output stream to write to | *a* | The URL to write |=== Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1306[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator<=( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1246[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator==( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1326[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator>( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1346[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator>=( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing A reference to a valid, percent‐encoded string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L72[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class decode_view; ---- == Types [cols=2] |=== | Name | Description | <> | An iterator of constant, decoded characters. | <> | The reference type | <> | The signed integer type | <> | An iterator of constant, decoded characters. | <> | The reference type | <> | The unsigned integer type | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return the last character | <> | Return an iterator to the beginning | <> | Return the result of comparing to another string | <> [.small]#[constructor]# | Constructor | <> | Return true if the string is empty | <> | Return an iterator to the end | <> | Checks if the string ends with the given prefix | <> | Finds the first occurrence of character in this view | <> | Return the first character | <> | Return the decoding options | <> | Remove the first characters | <> | Remove the last characters | <> | Finds the first occurrence of character in this view | <> | Return the number of decoded characters | <> | Checks if the string begins with the given prefix |=== == Friends [cols=2] |=== | Name | Description | <> | Compare two decode views for inequality | <> | Compare two decode views for inequality | <> | Compare two decode views for inequality | <> | Compare two decode views for less than | <> | Compare two decode views for less than | <> | Compare two decode views for less than | <> | Format the string with percent‐decoding applied to the output stream | <> | Compare two decode views for less than or equal | <> | Compare two decode views for less than or equal | <> | Compare two decode views for less than or equal | <> | Compare two decode views for equality | <> | Compare two decode views for equality | <> | Compare two decode views for equality | <> | Compare two decode views for greater than | <> | Compare two decode views for greater than | <> | Compare two decode views for greater than | <> | Compare two decode views for greater than or equal | <> | Compare two decode views for greater than or equal | <> | Compare two decode views for greater than or equal |=== == Description These views reference strings in parts of URLs or other components that are percent‐encoded. The special characters (those not in the allowed character set) are stored as three character escapes that consist of a percent sign ('%%') followed by a two‐digit hexadecimal number of the corresponding unescaped character code, which may be part of a UTF‐8 code point depending on the context. The view refers to the original character buffer and only decodes escaped sequences when needed. In particular these operations perform percent‐decoding automatically without the need to allocate memory: * Iteration of the string * Accessing the encoded character buffer * Comparison to encoded or plain strings These objects can only be constructed from strings that have a valid percent‐encoding, otherwise construction fails. The caller is responsible for ensuring that the lifetime of the character buffer from which the view is constructed extends unmodified until the view is no longer accessed. An iterator of constant, decoded characters. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L129[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class iterator { /* see-below */ }; ---- == Description This iterator is used to access the encoded string as a *bidirectional* range of characters with percent‐decoding applied. Escape sequences are not decoded until the iterator is dereferenced. Return the last character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L331[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> back() const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).back() == 's' ); ---- === Preconditions [,cpp] ---- not this->empty() ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L273[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> begin() const noexcept; ---- == Description === Example [,cpp] ---- auto it = this->begin(); ---- === Complexity Constant. === Exception Safety Throws nothing. Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L501[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>(core::string_view other) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int <>(<> other) const noexcept; ---- [.small]#<># == Description The length of the sequences to compare is the smaller of `size()` and `other.size()`. The function compares the two strings as if by calling `char_traits<char>::compare(to_string().data(), v.data(), rlen)`. This means the comparison is performed with percent‐decoding applied to the current string. == Return Value Negative value if this string is less than the other character sequence, zero if the both character sequences are equal, positive value if this string is greater than the other character sequence == Parameters |=== | Name | Description | *other* | string to compare |=== Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L501[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare(core::string_view other) const noexcept; ---- == Description The length of the sequences to compare is the smaller of `size()` and `other.size()`. The function compares the two strings as if by calling `char_traits<char>::compare(to_string().data(), v.data(), rlen)`. This means the comparison is performed with percent‐decoding applied to the current string. == Return Value Negative value if this string is less than the other character sequence, zero if the both character sequences are equal, positive value if this string is greater than the other character sequence == Parameters |=== | Name | Description | *other* | string to compare |=== Return the result of comparing to another string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L522[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr int compare(<> other) const noexcept; ---- == Description The length of the sequences to compare is the smaller of `size()` and `other.size()`. The function compares the two strings as if by calling `char_traits<char>::compare(to_string().data(), v.to_string().data(), rlen)`. This means the comparison is performed with percent‐decoding applied to the current string. == Return Value Negative value if this string is less than the other character sequence, zero if the both character sequences are equal, positive value if this string is greater than the other character sequence == Parameters |=== | Name | Description | *other* | string to compare |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L161[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() noexcept = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit <>( <> s, <> opt = {}) noexcept; ---- [.small]#<># == Description Default‐constructed views represent empty strings. === Example [,cpp] ---- decode_view ds; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *s* | A percent‐encoded string that has already been validated. Implicit conversion from other string types is supported but may throw exceptions. | *opt* | The options for decoding. If this parameter is omitted, the default options are used. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L161[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr decode_view() noexcept = default; ---- == Description Default‐constructed views represent empty strings. === Example [,cpp] ---- decode_view ds; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L199[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit decode_view( <> s, <> opt = {}) noexcept; ---- == Description This constructs a view from the character buffer `s`, which must remain valid and unmodified until the view is no longer accessed. === Example [,cpp] ---- decode_view ds( "Program%20Files" ); ---- === Postconditions [,cpp] ---- this->encoded() == s ---- === Complexity Linear in `s.size()`. === Exception Safety Although this function does not throw exceptions, implicitly constructing a xref:#boost-urls-pct_string_view[pct_string_view] for the first argument can throw exceptions on invalid input. == Parameters |=== | Name | Description | *s* | A percent‐encoded string that has already been validated. Implicit conversion from other string types is supported but may throw exceptions. | *opt* | The options for decoding. If this parameter is omitted, the default options are used. |=== Return true if the string is empty == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L230[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "" ).empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L289[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> end() const noexcept; ---- == Description === Example [,cpp] ---- auto it = this->end(); ---- === Complexity Constant. === Exception Safety Throws nothing. Checks if the string ends with the given prefix == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L365[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>(core::string_view s) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>(char ch) const noexcept; ---- [.small]#<># == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).ends_with("Files") ); ---- === Complexity Linear. === Exception Safety Throws nothing. Checks if the string ends with the given prefix == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L365[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool ends_with(core::string_view s) const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).ends_with("Files") ); ---- === Complexity Linear. === Exception Safety Throws nothing. Checks if the string ends with the given prefix == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L399[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool ends_with(char ch) const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).ends_with('s') ); ---- === Complexity Constant. === Exception Safety Throws nothing. Finds the first occurrence of character in this view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L411[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find(char ch) const noexcept; ---- == Description === Complexity Linear. === Exception Safety Throws nothing. Return the first character == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L310[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> front() const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).front() == 'P' ); ---- === Preconditions [,cpp] ---- not this->empty() ---- === Complexity Constant. === Exception Safety Throws nothing. Return the decoding options == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L470[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> options() const noexcept; ---- Remove the first characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L444[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void remove_prefix(<> n); ---- == Description === Example [,cpp] ---- decode_view d( "Program%20Files" ); d.remove_prefix( 8 ); assert( d == "Files" ); ---- === Preconditions [,cpp] ---- not this->empty() ---- === Complexity Linear. Remove the last characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L465[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void remove_suffix(<> n); ---- == Description === Example [,cpp] ---- decode_view d( "Program%20Files" ); d.remove_prefix( 6 ); assert( d == "Program" ); ---- === Preconditions [,cpp] ---- not this->empty() ---- === Complexity Linear. Finds the first occurrence of character in this view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L423[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> rfind(char ch) const noexcept; ---- == Description === Complexity Linear. === Exception Safety Throws nothing. Return the number of decoded characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L254[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> size() const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).size() == 13 ); ---- === Effects [,cpp] ---- return std::distance( this->begin(), this->end() ); ---- === Complexity Constant. === Exception Safety Throws nothing. Checks if the string begins with the given prefix == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L348[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>(core::string_view s) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>(char ch) const noexcept; ---- [.small]#<># == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).starts_with("Program") ); ---- === Complexity Linear. === Exception Safety Throws nothing. Checks if the string begins with the given prefix == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L348[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool starts_with(core::string_view s) const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).starts_with("Program") ); ---- === Complexity Linear. === Exception Safety Throws nothing. Checks if the string begins with the given prefix == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L382[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool starts_with(char ch) const noexcept; ---- == Description === Example [,cpp] ---- assert( decode_view( "Program%20Files" ).starts_with('P') ); ---- === Complexity Constant. === Exception Safety Throws nothing. An iterator of constant, decoded characters. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L132[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = <>; ---- == Description This iterator is used to access the encoded string as a *bidirectional* range of characters with percent‐decoding applied. Escape sequences are not decoded until the iterator is dereferenced. The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L111[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_reference = char; ---- The signed integer type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L119[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using difference_type = std::ptrdiff_t; ---- The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L108[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using reference = char; ---- The unsigned integer type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L115[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using size_type = std::size_t; ---- The value type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L104[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = char; ---- Compare two decode views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L630[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr bool operator!=( <> const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L641[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator!=( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L653[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator!=( S const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L677[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr bool operator<( <> const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L688[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator<( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L700[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator<( S const& lhs, <> const& rhs) noexcept; ---- Format the string with percent‐decoding applied to the output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L864[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend std::ostream& operator<<( std::ostream& os, <> const& s); ---- == Description This hidden friend function serializes the decoded view to the output stream. == Return Value A reference to the output stream, for chaining == Parameters |=== | Name | Description | *os* | The output stream to write to | *s* | The decoded view to write |=== Compare two decode views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L724[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr bool operator<=( <> const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L735[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator<=( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L747[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator<=( S const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L583[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr bool operator==( <> const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L594[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator==( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L606[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator==( S const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L771[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr bool operator>( <> const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L782[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator>( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L794[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator>( S const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L818[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend constexpr bool operator>=( <> const& lhs, <> const& rhs) noexcept; ---- Compare two decode views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L829[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator>=( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L841[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> friend constexpr bool operator>=( S const& lhs, <> const& rhs) noexcept; ---- Percent‐encoding options == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encoding_opts.hpp#L31[boost/url/encoding_opts.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct encoding_opts; ---- == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Constructs an `encoding_opts` object with the specified options. |=== == Data Members [cols=2] |=== | Name | Description | <> | True if nulls are not allowed | <> | True if hexadecimal digits are emitted as lower case | <> | True if spaces encode to and from plus signs |=== == Description These options are used to customize the behavior of algorithms which use percent escapes, such as encoding or decoding. == See Also xref:#boost-urls-encode-04[encode], xref:#boost-urls-encoded_size[encoded_size], xref:#boost-urls-pct_string_view[pct_string_view]. Constructs an `encoding_opts` object with the specified options. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encoding_opts.hpp#L76[boost/url/encoding_opts.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr encoding_opts( bool const space_as_plus = false, bool const lower_case = false, bool const disallow_null = false) noexcept; ---- == Parameters |=== | Name | Description | *space_as_plus* | If true, spaces will be encoded as plus signs. | *lower_case* | If true, hexadecimal digits will be emitted as lower case. | *disallow_null* | If true, null characters will not be allowed. |=== True if nulls are not allowed == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encoding_opts.hpp#L68[boost/url/encoding_opts.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool disallow_null = false; ---- == Description Normally all possible character values (from 0 to 255) are allowed, with reserved characters being replaced with escapes upon encoding. When this option is true, attempting to decode a null will result in an error. True if hexadecimal digits are emitted as lower case == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encoding_opts.hpp#L57[boost/url/encoding_opts.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool lower_case = false; ---- == Description By default, percent‐encoding algorithms emit hexadecimal digits A through F as uppercase letters. When this option is `true`, lowercase letters are used. True if spaces encode to and from plus signs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encoding_opts.hpp#L48[boost/url/encoding_opts.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool space_as_plus = false; ---- == Description This option controls whether or not the PLUS character ("+") is used to represent the SP character (" ") when encoding or decoding. Although not prescribed by the RFC, plus signs are commonly treated as spaces upon decoding when used in the query of URLs using well known schemes such as HTTP. === Specification * link:https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1[ application/x‐www‐form‐urlencoded (w3.org)] An optional parameter to determine case‐sensitivity == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ignore_case.hpp#L43[boost/url/ignore_case.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ignore_case_param; ---- == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Constructor | <> | True if an algorithm should ignore case |=== == Description Functions may use parameters of this type to allow the user to optionally indicate that comparisons should be case‐insensitive when the value xref:#boost-urls-ignore_case[ignore_case] is passed. == See Also xref:#boost-urls-params_ref[params_ref] Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ignore_case.hpp#L68[boost/url/ignore_case.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() noexcept = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(/* implementation-defined */::<>) noexcept; ---- [.small]#<># == Description By default, comparisons are case‐sensitive. === Example This function performs case‐sensitive comparisons when called with no arguments: [,cpp] ---- void f( ignore_case_param = {} ); ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ignore_case.hpp#L68[boost/url/ignore_case.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ignore_case_param() noexcept = default; ---- == Description By default, comparisons are case‐sensitive. === Example This function performs case‐sensitive comparisons when called with no arguments: [,cpp] ---- void f( ignore_case_param = {} ); ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ignore_case.hpp#L89[boost/url/ignore_case.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ignore_case_param(/* implementation-defined */::<>) noexcept; ---- == Description Construction from xref:#boost-urls-ignore_case[ignore_case] indicates that comparisons should be case‐insensitive. The first parameter to this function should be the variable xref:#boost-urls-ignore_case[ignore_case]. === Example When xref:#boost-urls-ignore_case[ignore_case] is passed as an argument, this function ignores case when performing comparisons: [,cpp] ---- void f( ignore_case_param(ignore_case) ); ---- True if an algorithm should ignore case == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ignore_case.hpp#L104[boost/url/ignore_case.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator bool() const noexcept; ---- == Description Values of type `ignore_case_param` evaluate to true when constructed with the constant xref:#boost-urls-ignore_case[ignore_case]. Otherwise, they are default‐constructed and evaluate to `false`. An IP version 4 style address. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L53[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ipv4_address; ---- == Types [cols=2] |=== | Name | Description | <> | The type used to represent an address as an array of bytes | <> | The type used to represent an address as an unsigned integer |=== == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Construct from a string. Construct from an array of bytes. Construct from an unsigned integer. Constructor. | <> | Return true if the address is a loopback address | <> | Return true if the address is a multicast address | <> | Return true if the address is unspecified | <> | Copy Assignment. | <> | Write a dotted decimal string representing the address to a buffer | <> | Return the address as bytes, in network byte order. | <> | Return the address as a string in dotted decimal format | <> | Return the address as an unsigned integer. |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return an address object that represents any address | <> | Return an address object that represents the broadcast address | <> | Return an address object that represents the loopback address |=== == Static Data Members [cols=2] |=== | Name | Description | <> | The number of characters in the longest possible IPv4 string. |=== == Friends [cols=2] |=== | Name | Description | <> | Return true if two addresses are not equal | <> | Format the address to an output stream. | <> | Return true if two addresses are equal |=== == Description Objects of this type are used to construct, parse, and manipulate IP version 6 addresses. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == See Also xref:#boost-urls-parse_ipv4_address[parse_ipv4_address], xref:#boost-urls-ipv6_address[ipv6_address]. Return an address object that represents any address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L263[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static <> any() noexcept; ---- Return an address object that represents the broadcast address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L281[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static <> broadcast() noexcept; ---- Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L76[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const&) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(<> u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(<> const& bytes) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(core::string_view s); ---- [.small]#<># == Exceptions |=== | Name | Thrown on | `system_error` | The input failed to parse correctly. |=== == Parameters |=== | Name | Description | *u* | The integer to construct from. | *bytes* | The value to construct from. | *s* | The string to parse. |=== Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L76[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ipv4_address() = default; ---- Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L80[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ipv4_address(<> const&) = default; ---- Construct from an unsigned integer. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L103[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit ipv4_address(<> u) noexcept; ---- == Description This function constructs an address from the unsigned integer `u`, where the most significant byte forms the first octet of the resulting address. == Parameters |=== | Name | Description | *u* | The integer to construct from. |=== Construct from an array of bytes. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L116[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit ipv4_address(<> const& bytes) noexcept; ---- == Description This function constructs an address from the array in `bytes`, which is interpreted in big‐endian. == Parameters |=== | Name | Description | *bytes* | The value to construct from. |=== Construct from a string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L145[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit ipv4_address(core::string_view s); ---- == Description This function constructs an address from the string `s`, which must contain a valid IPv4 address string or else an exception is thrown. [NOTE] For a non‐throwing parse function, use xref:#boost-urls-parse_ipv4_address[parse_ipv4_address]. === Exception Safety Exceptions thrown on invalid input. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The input failed to parse correctly. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== == See Also xref:#boost-urls-parse_ipv4_address[parse_ipv4_address]. Return true if the address is a loopback address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L224[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_loopback() const noexcept; ---- Return true if the address is a multicast address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L236[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_multicast() const noexcept; ---- Return true if the address is unspecified == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L230[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_unspecified() const noexcept; ---- Return an address object that represents the loopback address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L272[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static <> loopback() noexcept; ---- Copy Assignment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L85[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const&) = default; ---- Write a dotted decimal string representing the address to a buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L216[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view to_buffer( char* dest, std::size_t dest_size) const; ---- == Description The resulting buffer is not null‐terminated. == Exceptions |=== | Name | Thrown on | `std::length_error` | `dest_size < ipv4_address::max_str_len` |=== == Return Value The formatted string == Parameters |=== | Name | Description | *dest* | The buffer in which to write, which must have at least `dest_size` space. | *dest_size* | The size of the output buffer. |=== Return the address as bytes, in network byte order. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L152[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> to_bytes() const noexcept; ---- Return the address as a string in dotted decimal format == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L194[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type to_string(StringToken&& token = {}); ---- == Description When called with no arguments, the return type is `std::string`. Otherwise, the return type and style of output is determined by which string token is passed. === Example [,cpp] ---- assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" ); ---- === Complexity Constant. === Exception Safety Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.2[ 2.2. Text Representation of Addresses (rfc4291)] == Return Value The return type of the string token. If the token parameter is omitted, then a new `std::string` is returned. Otherwise, the function return type is the result type of the token. == Parameters |=== | Name | Description | *token* | An optional string token. |=== Return the address as an unsigned integer. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L158[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> to_uint() const noexcept; ---- The type used to represent an address as an array of bytes == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L71[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using bytes_type = std::array<unsigned char, 4>; ---- The type used to represent an address as an unsigned integer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L66[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using uint_type = std::uint_least32_t; ---- The number of characters in the longest possible IPv4 string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L60[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr static std::size_t max_str_len = 15; ---- == Description The longest ipv4 address string is "255.255.255.255". Return true if two addresses are not equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L252[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator!=( <> const& a1, <> const& a2) noexcept; ---- Format the address to an output stream. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L297[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend std::ostream& operator<<( std::ostream& os, <> const& addr); ---- == Description IPv4 addresses written to output streams are written in their dotted decimal format. == Parameters |=== | Name | Description | *os* | The output stream. | *addr* | The address to format. |=== Return true if two addresses are equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L241[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator==( <> const& a1, <> const& a2) noexcept; ---- An IP version 6 style address. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L64[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ipv6_address; ---- == Types [cols=2] |=== | Name | Description | <> | The type used to represent an address as an array of bytes. |=== == Member Functions [cols=2] |=== | Name | Description | <> [.small]#[constructor]# | Construct from a string. Construct from an IPv4 address. Construct from an array of bytes. Constructor. | <> | Return true if the address is a loopback address | <> | Return true if the address is unspecified | <> | Return true if the address is a mapped IPv4 address | <> | Copy Assignment | <> | Write a dotted decimal string representing the address to a buffer | <> | Return the address as bytes, in network byte order | <> | Return the address as a string. |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return an address object that represents the loopback address |=== == Static Data Members [cols=2] |=== | Name | Description | <> | The number of characters in the longest possible IPv6 string. |=== == Friends [cols=2] |=== | Name | Description | <> | Return true if two addresses are not equal | <> | Format the address to an output stream | <> | Return true if two addresses are equal |=== == Description Objects of this type are used to construct, parse, and manipulate IP version 6 addresses. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == See Also xref:#boost-urls-ipv4_address[ipv4_address], xref:#boost-urls-parse_ipv6_address[parse_ipv6_address]. Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L103[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const&) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& bytes) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& addr) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># == Description Default constructed objects represent the unspecified address. * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.2[2.5.2. The Unspecified Address] == Exceptions |=== | Name | Thrown on | `system_error` | The input failed to parse correctly. |=== == Parameters |=== | Name | Description | *bytes* | The value to construct from. | *addr* | The address to construct from. | *s* | The string to parse. |=== == See Also xref:#boost-urls-ipv6_address-is_unspecified[is_unspecified] Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L103[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ipv6_address() = default; ---- == Description Default constructed objects represent the unspecified address. * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.2[2.5.2. The Unspecified Address] == See Also xref:#boost-urls-ipv6_address-is_unspecified[is_unspecified] Constructor. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L107[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ipv6_address(<> const&) = default; ---- Construct from an array of bytes. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L125[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- ipv6_address(<> const& bytes) noexcept; ---- == Description This function constructs an address from the array in `bytes`, which is interpreted in big‐endian. == Parameters |=== | Name | Description | *bytes* | The value to construct from. |=== Construct from an IPv4 address. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L141[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- ipv6_address(<> const& addr) noexcept; ---- == Description This function constructs an IPv6 address from the IPv4 address `addr`. The resulting address is an IPv4‐Mapped IPv6 Address. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2[2.5.5.2. IPv4‐Mapped IPv6 Address (rfc4291)] == Parameters |=== | Name | Description | *addr* | The address to construct from. |=== Construct from a string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L170[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- ipv6_address(core::string_view s); ---- == Description This function constructs an address from the string `s`, which must contain a valid IPv6 address string or else an exception is thrown. [NOTE] For a non‐throwing parse function, use xref:#boost-urls-parse_ipv6_address[parse_ipv6_address]. === Exception Safety Exceptions thrown on invalid input. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The input failed to parse correctly. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== == See Also xref:#boost-urls-parse_ipv6_address[parse_ipv6_address]. Return true if the address is a loopback address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L275[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_loopback() const noexcept; ---- == Description The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.3[ 2.5.3. The Loopback Address (rfc4291)] Return true if the address is unspecified == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L261[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_unspecified() const noexcept; ---- == Description The address 0:0:0:0:0:0:0:0 is called the unspecified address. It indicates the absence of an address. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.2[ 2.5.2. The Unspecified Address (rfc4291)] Return true if the address is a mapped IPv4 address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L288[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_v4_mapped() const noexcept; ---- == Description This address type is used to represent the addresses of IPv4 nodes as IPv6 addresses. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2[ 2.5.5.2. IPv4‐Mapped IPv6 Address (rfc4291)] Return an address object that represents the loopback address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L324[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static <> loopback() noexcept; ---- == Description The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.3[ 2.5.3. The Loopback Address (rfc4291)] Copy Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L112[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const&) = default; ---- Write a dotted decimal string representing the address to a buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L245[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view to_buffer( char* dest, std::size_t dest_size) const; ---- == Description The resulting buffer is not null‐terminated. == Exceptions |=== | Name | Thrown on | `std::length_error` | `dest_size < ipv6_address::max_str_len` |=== == Return Value The formatted string == Parameters |=== | Name | Description | *dest* | The buffer in which to write, which must have at least `dest_size` space. | *dest_size* | The size of the output buffer. |=== Return the address as bytes, in network byte order == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L175[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> to_bytes() const noexcept; ---- Return the address as a string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L222[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type to_string(StringToken&& token); ---- == Description The returned string does not contain surrounding square brackets. When called with no arguments, the return type is `std::string`. Otherwise, the return type and style of output is determined by which string token is passed. === Example [,cpp] ---- ipv6_address::bytes_type b = {{ 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8 }}; ipv6_address a(b); assert(a.to_string() == "1:2:3:4:5:6:7:8"); assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" ); ---- === Complexity Constant. === Exception Safety Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.2[ 2.2. Text Representation of Addresses (rfc4291)] == Return Value The return type of the string token. If the token parameter is omitted, then a new `std::string` is returned. Otherwise, the function return type is the result type of the token. == Parameters |=== | Name | Description | *token* | An optional string token. |=== The type used to represent an address as an array of bytes. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L89[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using bytes_type = std::array<unsigned char, 16>; ---- == Description Octets are stored in network byte order. The number of characters in the longest possible IPv6 string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L81[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr static std::size_t max_str_len = 49; ---- == Description The longest IPv6 address is: [,cpp] ---- ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ---- == See Also xref:#boost-urls-ipv6_address-to_buffer[to_buffer]. Return true if two addresses are not equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L304[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator!=( <> const& a1, <> const& a2) noexcept; ---- Format the address to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L340[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend std::ostream& operator<<( std::ostream& os, <> const& addr); ---- == Description This hidden friend function writes the address to an output stream using standard notation. == Return Value The output stream, for chaining. == Parameters |=== | Name | Description | *os* | The output stream to write to. | *addr* | The address to write. |=== Return true if two addresses are equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L293[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator==( <> const& a1, <> const& a2) noexcept; ---- The type of xref:#boost-urls-no_value[no_value] == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L30[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct no_value_t { /* see-below */ }; ---- A query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L75[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct param; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Arrow support | <> | Assignment | <> [.small]#[constructor]# | Aggregate construction Constructor |=== == Data Members [cols=2] |=== | Name | Description | <> | True if a value is present | <> | The key | <> | The value |=== == Description Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by xref:#boost-urls-param-has_value[has_value] equal to true. An empty value is distinct from no value. Depending on where the object was obtained, the strings may or may not contain percent escapes. For most usages, key comparisons are case‐sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. === BNF [,cpp] ---- query-params = query-param *( "&" query-param ) query-param = key [ "=" value ] key = *qpchar value = *( qpchar / "=" ) ---- === Specification * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-param_view[param_view], xref:#boost-urls-param_pct_view[param_pct_view]. Arrow support == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L334[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> const* operator‐>() const noexcept; ---- == Description This operator returns the address of the object so that it can be used in pointer contexts. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L191[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<>&& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& <>(<> const&) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># == Description Upon assignment, this acquires ownership of the members of other via move assignment. The moved from object is as if default constructed. === Complexity Constant. === Exception Safety Throws nothing. === other The object to assign from. == Parameters |=== | Name | Description | *other* | The parameter to copy. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L191[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<>&& other) noexcept; ---- == Description Upon assignment, this acquires ownership of the members of other via move assignment. The moved from object is as if default constructed. === Complexity Constant. === Exception Safety Throws nothing. === other The object to assign from. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L224[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const&) = default; ---- == Description Upon assignment, this becomes a copy of `other`. === Postconditions [,cpp] ---- this->key == other.key && this->value == other.value && this->has_value == other.has_value ---- === Complexity Linear in `other.key.size() + other.value.size()`. === Exception Safety Calls to allocate may throw. === other The object to assign from. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L303[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The members of `other` are copied, re‐using already existing string capacity. === Postconditions [,cpp] ---- this->key == other.key && this->value == other.value && this->has_value == other.has_value ---- === Complexity Linear in `other.key.size() + other.value.size()`. === Exception Safety Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The parameter to copy. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L324[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The members of `other` are copied, re‐using already existing string capacity. === Postconditions [,cpp] ---- this->key == other.key && this->value == other.value && this->has_value == other.has_value ---- === Complexity Linear in `other.key.size() + other.value.size()`. === Exception Safety Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The parameter to copy. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L124[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>&& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class OptionalString> <>( core::string_view key, OptionalString const& value); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( core::string_view key, core::string_view value, bool has_value) noexcept; ---- [.small]#<># == Description Default constructed query parameters have an empty key and no value. === Example [,cpp] ---- param qp; ---- === Postconditions [,cpp] ---- this->key == "" && this->value == "" && this->has_value == false ---- === Complexity Constant. === Exception Safety Throws nothing. == Template Parameters |=== | Name | Description | *OptionalString* | An optional string type, such as `core::string_view`, `std::nullptr`, xref:#boost-urls-no_value_t[no_value_t], or `optional<core::string_view>`. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L124[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr param() = default; ---- == Description Default constructed query parameters have an empty key and no value. === Example [,cpp] ---- param qp; ---- === Postconditions [,cpp] ---- this->key == "" && this->value == "" && this->has_value == false ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L142[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- param(<>&& other) noexcept; ---- == Description Upon construction, this acquires ownership of the members of other via move construction. The moved from object is as if default constructed. === Complexity Constant. === Exception Safety Throws nothing. === other The object to construct from. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L173[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr param(<> const& other) = default; ---- == Description Upon construction, this becomes a copy of `other`. === Postconditions [,cpp] ---- this->key == other.key && this->value == other.value && this->has_value == other.has_value ---- === Complexity Linear in `other.key.size() + other.value.size()`. === Exception Safety Calls to allocate may throw. === other The object to construct from. Aggregate construction == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L341[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- param( core::string_view key, core::string_view value, bool has_value) noexcept; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L277[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class OptionalString> param( core::string_view key, OptionalString const& value); ---- == Description This constructs a parameter with a key and value. No validation is performed on the strings. Ownership of the key and value is acquired by making copies. === Example [,cpp] ---- param qp( "key", "value" ); ---- [,cpp] ---- param qp( "key", optional("value") ); ---- [,cpp] ---- param qp( "key", boost::none ); ---- [,cpp] ---- param qp( "key", nullptr ); ---- [,cpp] ---- param qp( "key", no_value ); ---- === Postconditions [,cpp] ---- this->key == key && this->value == value && this->has_value == true ---- === Complexity Linear in `key.size() + value.size()`. === Exception Safety Calls to allocate may throw. == Template Parameters |=== | Name | Description | *OptionalString* | An optional string type, such as `core::string_view`, `std::nullptr`, xref:#boost-urls-no_value_t[no_value_t], or `optional<core::string_view>`. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. |=== True if a value is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L101[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_value = false; ---- == Description The presence of a value is indicated by `has_value == true`. An empty value is distinct from no value. The key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L85[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::string key; ---- == Description For most usages, key comparisons are case‐sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. The value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L93[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::string value; ---- == Description The presence of a value is indicated by xref:#boost-urls-param-has_value[has_value] equal to true. An empty value is distinct from no value. A view of a percent‐encoded query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L646[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct param_pct_view; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Conversion | <> | Conversion to param_view | <> | Arrow support | <> [.small]#[constructor]# | Aggregate construction Construction Constructor |=== == Data Members [cols=2] |=== | Name | Description | <> | True if a value is present | <> | The key | <> | The value |=== == Description Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by xref:#boost-urls-param_pct_view-has_value[has_value] equal to true. An empty value is distinct from no value. The strings may have percent escapes, and offer an additional invariant: they never contain an invalid percent‐encoding. For most usages, key comparisons are case‐sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === BNF [,cpp] ---- query-params = query-param *( "&" query-param ) query-param = key [ "=" value ] key = *qpchar value = *( qpchar / "=" ) ---- === Specification * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-param[param], xref:#boost-urls-param_view[param_view]. Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L848[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit operator <>() const; ---- == Description This function performs a conversion from a reference‐like query parameter to one retaining ownership of the strings by making a copy. === Complexity Linear in `this‐>key.size() + this‐>value.size()`. === Exception Safety Calls to allocate may throw. Conversion to param_view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L867[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- == Description This function performs a conversion from a pct_string_view query parameter to one using a simple string_view. === Exception Safety Calls to allocate may throw. Arrow support == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L881[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> const* operator‐>() const noexcept; ---- == Description This operator returns the address of the object so that it can be used in pointer contexts. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L697[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( <> key, <> value) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class OptionalString> <>( <> key, OptionalString const& value); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(<> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( <> key, <> value, bool has_value) noexcept; ---- [.small]#<># == Description Default constructed query parameters have an empty key and no value. === Example [,cpp] ---- param_pct_view qp; ---- === Postconditions [,cpp] ---- this->key == "" && this->value == "" && this->has_value == false ---- === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | `key` or `value` contains an invalid percent‐encoding. |=== == Template Parameters |=== | Name | Description | *OptionalString* | An optional `core::string_view` type, such as `boost::optional<core::string_view>` or `std::optional<core::string_view>`. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. | *p* | The param to construct from. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L697[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr param_pct_view() = default; ---- == Description Default constructed query parameters have an empty key and no value. === Example [,cpp] ---- param_pct_view qp; ---- === Postconditions [,cpp] ---- this->key == "" && this->value == "" && this->has_value == false ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L733[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- param_pct_view( <> key, <> value) noexcept; ---- == Description This constructs a parameter with a key and value, which may both contain percent escapes. The new key and value reference the same corresponding underlying character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === Example [,cpp] ---- param_pct_view qp( "key", "value" ); ---- === Postconditions [,cpp] ---- this->key.data() == key.data() && this->value.data() == value.data() && this->has_value == true ---- === Complexity Linear in `key.size() + value.size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` or `value` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. |=== Construction == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L824[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit param_pct_view(<> const& p); ---- == Description This converts a param which may contain unvalidated percent‐escapes into a param whose key and value are guaranteed to contain strings with no invalid percent‐escapes, otherwise an exception is thrown. The new key and value reference the same corresponding underlying character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === Example [,cpp] ---- param_pct_view qp( param_view( "key", "value" ) ); ---- === Complexity Linear in `key.size() + value.size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` or `value` contains an invalid percent escape. |=== == Parameters |=== | Name | Description | *p* | The param to construct from. |=== Aggregate construction == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L888[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- param_pct_view( <> key, <> value, bool has_value) noexcept; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L783[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class OptionalString> param_pct_view( <> key, OptionalString const& value); ---- == Description This constructs a parameter with a key and optional value, which may both contain percent escapes. The new key and value reference the same corresponding underlying character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === Example [,cpp] ---- param_pct_view qp( "key", optional("value") ); ---- === Postconditions [,cpp] ---- this->key.data() == key.data() && this->value->data() == value->data() && this->has_value == true ---- === Complexity Linear in `key.size() + value‐>size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` or `value` contains an invalid percent‐encoding. |=== == Template Parameters |=== | Name | Description | *OptionalString* | An optional `core::string_view` type, such as `boost::optional<core::string_view>` or `std::optional<core::string_view>`. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. |=== True if a value is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L672[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_value = false; ---- == Description The presence of a value is indicated by `has_value == true`. An empty value is distinct from no value. The key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L656[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> key; ---- == Description For most usages, key comparisons are case‐sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. The value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L664[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> value; ---- == Description The presence of a value is indicated by xref:#boost-urls-param_pct_view-has_value[has_value] equal to true. An empty value is distinct from no value. A view of a query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L408[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct param_view; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Conversion | <> | Arrow support | <> [.small]#[constructor]# | Aggregate construction Constructor |=== == Data Members [cols=2] |=== | Name | Description | <> | True if a value is present | <> | The key | <> | The value |=== == Description Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by xref:#boost-urls-param_view-has_value[has_value] equal to true. An empty value is distinct from no value. Depending on where the object was obtained, the strings may or may not contain percent escapes. For most usages, key comparisons are case‐sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === BNF [,cpp] ---- query-params = query-param *( "&" query-param ) query-param = key [ "=" value ] key = *qpchar value = *( qpchar / "=" ) ---- === Specification * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-param[param], xref:#boost-urls-param_pct_view[param_pct_view]. Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L558[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit operator <>(); ---- == Description This function performs a conversion from a reference‐like query parameter to one retaining ownership of the strings by making a copy. No validation is performed on the strings. === Complexity Linear in `this‐>key.size() + this‐>value.size()`. === Exception Safety Calls to allocate may throw. Arrow support == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L572[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> const* operator‐>() const noexcept; ---- == Description This operator returns the address of the object so that it can be used in pointer contexts. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L459[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class OptionalString> <>( core::string_view key, OptionalString const& value) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( core::string_view key_, core::string_view value_, bool has_value_) noexcept; ---- [.small]#<># == Description Default constructed query parameters have an empty key and no value. === Example [,cpp] ---- param_view qp; ---- === Postconditions [,cpp] ---- this->key == "" && this->value == "" && this->has_value == false ---- === Complexity Constant. === Exception Safety Throws nothing. == Template Parameters |=== | Name | Description | *OptionalString* | An optional string type, such as `core::string_view`, `std::nullptr`, xref:#boost-urls-no_value_t[no_value_t], or `optional<core::string_view>`. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. | *other* | The param to reference |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L459[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr param_view() = default; ---- == Description Default constructed query parameters have an empty key and no value. === Example [,cpp] ---- param_view qp; ---- === Postconditions [,cpp] ---- this->key == "" && this->value == "" && this->has_value == false ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L535[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- param_view(<> const& other) noexcept; ---- == Description This function constructs a param which references the character buffers representing the key and value in another container. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === Example [,cpp] ---- param qp( "key", "value" ); param_view qpv( qp ); ---- === Postconditions [,cpp] ---- this->key == key && this->value == value && this->has_value == other.has_value ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The param to reference |=== Aggregate construction == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L579[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- param_view( core::string_view key_, core::string_view value_, bool has_value_) noexcept; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L497[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class OptionalString> param_view( core::string_view key, OptionalString const& value) noexcept; ---- == Description This constructs a parameter with a key and value. No validation is performed on the strings. The new key and value reference the same corresponding underlying character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced. === Example [,cpp] ---- param_view qp( "key", "value" ); ---- === Postconditions [,cpp] ---- this->key.data() == key.data() && this->value.data() == value.data() && this->has_value == true ---- === Complexity Constant. === Exception Safety Throws nothing. == Template Parameters |=== | Name | Description | *OptionalString* | An optional string type, such as `core::string_view`, `std::nullptr`, xref:#boost-urls-no_value_t[no_value_t], or `optional<core::string_view>`. |=== == Parameters |=== | Name | Description | *key,* | value The key and value to set. |=== True if a value is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L434[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_value = false; ---- == Description The presence of a value is indicated by `has_value == true`. An empty value is distinct from no value. The key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L418[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view key; ---- == Description For most usages, key comparisons are case‐sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. The value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L426[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view value; ---- == Description The presence of a value is indicated by xref:#boost-urls-param_view-has_value[has_value] equal to true. An empty value is distinct from no value. Common functionality for containers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L46[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class params_base; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | An unsigned integer type to represent sizes. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Return true if a matching key exists | <> | Return the number of matching keys | <> | Return true if there are no params | <> | Return an iterator to the end | <> | Find a matching key | <> | Find a matching key | <> | Return the number of params |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * params_ref * params_view * params_encoded_ref * params_encoded_view A Bidirectional iterator to a query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L95[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class iterator { /* see-below */ }; ---- == Description Objects of this type allow iteration through the parameters in the query. Any percent‐escapes in returned strings are decoded first. The values returned are read‐only; changes to parameters must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced belong to the iterator and become invalidated when that particular iterator is incremented, decremented, or destroyed. [NOTE] The implementation may use temporary, recycled storage to store decoded strings. These iterators are meant to be used ephemerally. That is, for short durations such as within a function scope. Do not store iterators with static storage duration or as long‐lived objects. Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L221[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> begin() const noexcept; ---- == Description === Complexity Linear in the size of the first param. === Exception Safety Throws nothing. Return the referenced character buffer. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L178[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> buffer() const noexcept; ---- == Description This function returns the character buffer referenced by the view. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).params().buffer() == "?first=John&last=Doe" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return true if a matching key exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L265[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool contains( core::string_view key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).params().contains( "first" ) ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Return the number of matching keys == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L299[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t count( core::string_view key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find the number of matches for the specified key. The comparison is performed as if all escaped characters were decoded first. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).params().count( "first" ) == 1 ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Return true if there are no params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L194[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description === Example [,cpp] ---- assert( ! url_view( "?key=value" ).params().empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L232[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> end() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L344[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( core::string_view key, <> ic = {}) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, core::string_view key, <> ic = {}) const noexcept; ---- [.small]#<># == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. The search starts from the first param and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( (*url_view( "?first=John&last=Doe" ).params().find( "First", ignore_case )).value == "John" ); ---- === Effects [,cpp] ---- return this->find( this->begin(), key, ic ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. | *from* | The position to begin the search from. This can be `end()`. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L344[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find( core::string_view key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. The search starts from the first param and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( (*url_view( "?first=John&last=Doe" ).params().find( "First", ignore_case )).value == "John" ); ---- === Effects [,cpp] ---- return this->find( this->begin(), key, ic ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L389[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find( <> from, core::string_view key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. The search starts at `from` and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- url_view u( "?First=John&Last=Doe" ); assert( u.params().find( "first" ) != u.params().find( "first", ignore_case ) ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *from* | The position to begin the search from. This can be `end()`. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L430[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( core::string_view key, <> ic = {}) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, core::string_view key, <> ic = {}) const noexcept; ---- [.small]#<># == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. The search starts from the last param and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( (*url_view( "?first=John&last=Doe" ).params().find_last( "last" )).value == "Doe" ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. | *before* | One past the position to begin the search from. This can be `end()`. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L430[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find_last( core::string_view key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. The search starts from the last param and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( (*url_view( "?first=John&last=Doe" ).params().find_last( "last" )).value == "Doe" ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L476[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find_last( <> before, core::string_view key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first. The search starts prior to `before` and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- url_view u( "?First=John&Last=Doe" ); assert( u.params().find_last( "last" ) != u.params().find_last( "last", ignore_case ) ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *before* | One past the position to begin the search from. This can be `end()`. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Return the maximum number of characters possible == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L152[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr static std::size_t max_size() noexcept; ---- == Description This represents the largest number of characters that are possible in a path, not including any null terminator. === Exception Safety Throws nothing. Return the number of params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L210[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- == Description === Example [,cpp] ---- assert( url_view( "?key=value").params().size() == 1 ); ---- === Complexity Constant. === Exception Safety Throws nothing. A Bidirectional iterator to a query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L98[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = <>; ---- == Description Objects of this type allow iteration through the parameters in the query. Any percent‐escapes in returned strings are decoded first. The values returned are read‐only; changes to parameters must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced belong to the iterator and become invalidated when that particular iterator is incremented, decremented, or destroyed. [NOTE] The implementation may use temporary, recycled storage to store decoded strings. These iterators are meant to be used ephemerally. That is, for short durations such as within a function scope. Do not store iterators with static storage duration or as long‐lived objects. The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L127[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_reference = <>; ---- == Description This is the type of value returned when iterators of the view are dereferenced. == See Also xref:#boost-urls-param_view[param_view]. A signed integer type used to represent differences. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L135[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using difference_type = std::ptrdiff_t; ---- The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L124[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using reference = <>; ---- == Description This is the type of value returned when iterators of the view are dereferenced. == See Also xref:#boost-urls-param_view[param_view]. An unsigned integer type to represent sizes. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L131[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using size_type = std::size_t; ---- The value type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L114[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = <>; ---- == Description Values of this type represent parameters whose strings retain unique ownership by making a copy. === Example [,cpp] ---- params_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) ); ---- == See Also xref:#boost-urls-param[param]. Common functionality for containers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L38[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class params_encoded_base; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | An unsigned integer type to represent sizes. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return an iterator to the beginning | <> | Return the query corresponding to these params | <> | Return true if a matching key exists | <> | Return the number of matching keys | <> | Return true if there are no params | <> | Return an iterator to the end | <> | Find a matching key | <> | Find a matching key | <> | Return the number of params |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * params_ref * params_view * params_encoded_ref * params_encoded_view A Bidirectional iterator to a query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L103[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class iterator { /* see-below */ }; ---- == Description Objects of this type allow iteration through the parameters in the query. Strings returned by iterators may contain percent escapes. The values returned are read‐only; changes to parameters must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced refer to the underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by any container or iterator. Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L242[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> begin() const noexcept; ---- == Description === Complexity Linear in the size of the first param. === Exception Safety Throws nothing. Return the query corresponding to these params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L199[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> buffer() const noexcept; ---- == Description This function returns the query string referenced by the container. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().buffer() == "first=John&last=Doe" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query-params = query-param *( "&" query-param ) query-param = key [ "=" value ] key = *qpchar value = *( qpchar / "=" ) ---- === Specification * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return true if a matching key exists == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L290[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool contains( <> key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().contains( "first" ) ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Return the number of matching keys == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L327[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t count( <> key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find the number of matches for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().count( "first" ) == 1 ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Return true if there are no params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L215[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description === Example [,cpp] ---- assert( ! url_view( "?key=value" ).encoded_params().empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L253[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> end() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L379[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> key, <> ic = {}) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> key, <> ic = {}) const noexcept; ---- [.small]#<># == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. The search starts from the first param and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().find( "First", ignore_case )->value == "John" ); ---- === Effects [,cpp] ---- return this->find( this->begin(), key, ic ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. | *from* | The position to begin the search from. This can be `end()`. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L379[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find( <> key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. The search starts from the first param and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().find( "First", ignore_case )->value == "John" ); ---- === Effects [,cpp] ---- return this->find( this->begin(), key, ic ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L431[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find( <> from, <> key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. The search starts at `from` and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- url_view u( "?First=John&Last=Doe" ); assert( u.encoded_params().find( "first" ) != u.encoded_params().find( "first", ignore_case ) ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value an iterator to the param == Parameters |=== | Name | Description | *from* | The position to begin the search from. This can be `end()`. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L479[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> key, <> ic = {}) const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, <> key, <> ic = {}) const noexcept; ---- [.small]#<># == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. The search starts from the last param and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().find_last( "last" )->value == "Doe" ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. | *before* | One past the position to begin the search from. This can be `end()`. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L479[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find_last( <> key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. The search starts from the last param and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- assert( url_view( "?first=John&last=Doe" ).encoded_params().find_last( "last" )->value == "Doe" ); ---- === Complexity Linear in `this‐>buffer().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value an iterator to the param == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Find a matching key == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L526[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> find_last( <> before, <> key, <> ic = {}) const noexcept; ---- == Description This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. The search starts prior to `before` and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned. === Example [,cpp] ---- url_view u( "?First=John&Last=Doe" ); assert( u.encoded_params().find_last( "last" ) != u.encoded_params().find_last( "last", ignore_case ) ); ---- === Complexity Linear in `this‐>buffer().size()`. == Return Value an iterator to the param == Parameters |=== | Name | Description | *before* | One past the position to begin the search from. This can be `end()`. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Return the maximum number of characters possible == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L161[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr static std::size_t max_size() noexcept; ---- == Description This represents the largest number of characters that are possible in a path, not including any null terminator. === Exception Safety Throws nothing. Return the number of params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L231[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- == Description === Example [,cpp] ---- assert( url_view( "?key=value").encoded_params().size() == 1 ); ---- === Complexity Constant. === Exception Safety Throws nothing. A Bidirectional iterator to a query parameter == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L107[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = <>; ---- == Description Objects of this type allow iteration through the parameters in the query. Strings returned by iterators may contain percent escapes. The values returned are read‐only; changes to parameters must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced refer to the underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by any container or iterator. The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L136[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_reference = <>; ---- == Description This is the type of value returned when iterators of the view are dereferenced. == See Also xref:#boost-urls-param_view[param_view]. A signed integer type used to represent differences. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L144[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using difference_type = std::ptrdiff_t; ---- The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L133[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using reference = <>; ---- == Description This is the type of value returned when iterators of the view are dereferenced. == See Also xref:#boost-urls-param_view[param_view]. An unsigned integer type to represent sizes. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L140[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using size_type = std::size_t; ---- The value type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L123[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = <>; ---- == Description Values of this type represent parameters whose strings retain unique ownership by making a copy. === Example [,cpp] ---- params_encoded_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) ); ---- == See Also xref:#boost-urls-param[param]. A view representing query parameters in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L73[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class params_encoded_ref : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | An unsigned integer type to represent sizes. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Append params | <> | Assign params | <> | Return an iterator to the beginning | <> | Return the query corresponding to these params | <> | Clear the contents of the container | <> | Return true if a matching key exists | <> | Return the number of matching keys | <> | Return true if there are no params | <> | Return an iterator to the end | <> | Erase params | <> | Find a matching key | <> | Find a matching key | <> | Insert params | <> | Conversion | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Replace params | <> | Set a value | <> | Return the number of params | <> | Remove the value on an element | <> | Return the referenced url |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description Objects of this type are used to interpret the query parameters as a bidirectional view of key value pairs. The view does not retain ownership of the elements and instead references the original url. The caller is responsible for ensuring that the lifetime of the referenced url extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_encoded_ref p = u.encoded_params(); ---- Strings produced when elements are returned have type xref:#boost-urls-param_pct_view[param_pct_view] and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some iterators to the underlying character buffer: * append : Only `end()` . * assign , clear , `operator=` : All params. * erase : Erased params and all params after (including `end()` ). * insert : All params at or after the insertion point (including `end()` ). * replace , set : Modified params and all params after (including `end()` ). A view representing query parameters in a URL Objects of this type are used to interpret the query parameters as a bidirectional view of key value pairs. The view does not retain ownership of the elements and instead references the original url. The caller is responsible for ensuring that the lifetime of the referenced url extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_encoded_ref p = u.encoded_params(); ---- Strings produced when elements are returned have type xref:#boost-urls-param_pct_view[param_pct_view] and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some iterators to the underlying character buffer: * append : Only `end()` . * assign , clear , `operator=` : All params. * erase : Erased params and all params after (including `end()` ). * insert : All params at or after the insertion point (including `end()` ). * replace , set : Modified params and all params after (including `end()` ). Append params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L362[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( FwdIt first, FwdIt last); ---- [.small]#<># == Description This function appends a param to the view. The `end()` iterator is invalidated. === Example [,cpp] ---- url u; u.encoded_params().append( { "first", "John" } ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `p` contains an invalid percent‐encoding. |=== == Return Value An iterator to the new element. == Parameters |=== | Name | Description | *p* | The param to append. | *init* | The list of params to append. | *first,* | last The range of params to append. |=== Append params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L362[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> append(<> const& p); ---- == Description This function appends a param to the view. The `end()` iterator is invalidated. === Example [,cpp] ---- url u; u.encoded_params().append( { "first", "John" } ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `p` contains an invalid percent‐encoding. |=== == Return Value An iterator to the new element. == Parameters |=== | Name | Description | *p* | The param to append. |=== Append params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L396[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> append(std::initializer_list<<>> init); ---- == Description This function appends the params in an _initializer‐list_ to the view. The `end()` iterator is invalidated. === Example [,cpp] ---- url u; u.encoded_params().append({ {"first", "John"}, {"last", "Doe"} }); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Return Value An iterator to the first new element. == Parameters |=== | Name | Description | *init* | The list of params to append. |=== Append params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L435[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> append( FwdIt first, FwdIt last); ---- == Description This function appends a range of params to the view. The `end()` iterator is invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Return Value An iterator to the first new element. == Parameters |=== | Name | Description | *first,* | last The range of params to append. |=== Assign params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L289[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void <>(std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last, std::forward_iterator_tag); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last, std::input_iterator_tag) = delete; ---- [.small]#<># == Description This function replaces the entire contents of the view with the params in the _initializer‐list_. All iterators are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.encoded_params().assign({ { "first", "John" }, { "last", "Doe" } }); ---- === Complexity Linear in `init.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *init* | The list of params to assign. | *first,* | last The range of params to assign. |=== Assign params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L289[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void assign(std::initializer_list<<>> init); ---- == Description This function replaces the entire contents of the view with the params in the _initializer‐list_. All iterators are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.encoded_params().assign({ { "first", "John" }, { "last", "Doe" } }); ---- === Complexity Linear in `init.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *init* | The list of params to assign. |=== Assign params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L327[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void assign( FwdIt first, FwdIt last); ---- == Description This function replaces the entire contents of the view with the params in the range. All iterators are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true ---- === Complexity Linear in the size of the range. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *first,* | last The range of params to assign. |=== Clear the contents of the container == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L250[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void clear() noexcept; ---- == Description All iterators are invalidated. === Effects [,cpp] ---- this->url().remove_query(); ---- === Postconditions [,cpp] ---- this->empty() == true && this->url().has_query() == false ---- === Complexity Constant. === Exception Safety Throws nothing. Erase params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L597[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> pos) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> first, <> last) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t <>( <> key, <> ic = {}) noexcept; ---- [.small]#<># == Description This function removes an element from the container. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_encoded_ref::iterator it = u.encoded_params().erase( u.encoded_params().begin() ); assert( u.encoded_query() == "last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value An iterator to one past the removed element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *first,* | last The range of params to erase. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Erase params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L597[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase(<> pos) noexcept; ---- == Description This function removes an element from the container. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_encoded_ref::iterator it = u.encoded_params().erase( u.encoded_params().begin() ); assert( u.encoded_query() == "last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. |=== Erase params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L621[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase( <> first, <> last) noexcept; ---- == Description This function removes a range of params from the container. All iterators that are equal to `first` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed range. == Parameters |=== | Name | Description | *first,* | last The range of params to erase. |=== Erase params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L657[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t erase( <> key, <> ic = {}) noexcept; ---- == Description All iterators are invalidated. === Postconditions [,cpp] ---- this->count( key, ic ) == 0 ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` contains an invalid percent‐encoding. |=== == Return Value The number of params removed from the container. == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Insert params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L471[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, <> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::forward_iterator_tag); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::input_iterator_tag) = delete; ---- [.small]#<># == Description This function inserts a param before the specified position. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `p` contains an invalid percent‐encoding. |=== == Return Value An iterator to the inserted element. == Parameters |=== | Name | Description | *before* | An iterator before which the param is inserted. This may be equal to `end()`. | *p* | The param to insert. | *init* | The list of params to insert. | *first,* | last The range of params to insert. |=== Insert params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L471[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, <> const& p); ---- == Description This function inserts a param before the specified position. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `p` contains an invalid percent‐encoding. |=== == Return Value An iterator to the inserted element. == Parameters |=== | Name | Description | *before* | An iterator before which the param is inserted. This may be equal to `end()`. | *p* | The param to insert. |=== Insert params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L512[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, std::initializer_list<<>> init); ---- == Description This function inserts the params in an _initializer‐list_ before the specified position. All iterators that are equal to `before` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Return Value An iterator to the first element inserted, or `before` if `init.size() == 0`. == Parameters |=== | Name | Description | *before* | An iterator before which the element is inserted. This may be equal to `end()`. | *init* | The list of params to insert. |=== Insert params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L559[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> insert( <> before, FwdIt first, FwdIt last); ---- == Description This function inserts a range of params before the specified position. All iterators that are equal to `before` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Return Value An iterator to the first element inserted, or `before` if `first == last`. == Parameters |=== | Name | Description | *before* | An iterator before which the element is inserted. This may be equal to `end()`. | *first,* | last The range of params to insert. |=== Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L191[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L142[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(std::initializer_list<<>> init); ---- [.small]#<># == Description The previous contents of this are replaced by the contents of other. All iterators are invalidated. [NOTE] The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *other* | The params to assign. | *init* | The list of params to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L142[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The previous contents of this are replaced by the contents of other. All iterators are invalidated. [NOTE] The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The params to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L179[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(std::initializer_list<<>> init); ---- == Description After assignment, the previous contents of the query parameters are replaced by the contents of the initializer‐list. All iterators are invalidated. === Preconditions None of character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( init.begin(), init.end() ); ---- === Complexity Linear in `init.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *init* | The list of params to assign. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L80[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url(); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L112[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr params_encoded_ref(<> const& other) = default; ---- == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url(); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Replace params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L705[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> pos, <> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> to, std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> from, <> to, FwdIt first, FwdIt last); ---- [.small]#<># == Description This function replaces the contents of the element at `pos` with the specified param. All iterators that are equal to `pos` or come after are invalidated. [NOTE] The strings passed in must not come from the element being replaced, or else the behavior is undefined. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); u.encoded_params().replace( u.encoded_params().begin(), { "title", "Mr" }); assert( u.encoded_query() == "title=Mr&last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `p` contains an invalid percent‐encoding. |=== == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *p* | The param to assign. | *from,to* | The range of params to replace. | *init* | The list of params to assign. | *first,* | last The range of params to assign. |=== Replace params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L705[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> pos, <> const& p); ---- == Description This function replaces the contents of the element at `pos` with the specified param. All iterators that are equal to `pos` or come after are invalidated. [NOTE] The strings passed in must not come from the element being replaced, or else the behavior is undefined. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); u.encoded_params().replace( u.encoded_params().begin(), { "title", "Mr" }); assert( u.encoded_query() == "title=Mr&last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `p` contains an invalid percent‐encoding. |=== == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *p* | The param to assign. |=== Replace params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L745[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> from, <> to, std::initializer_list<<>> init); ---- == Description This function replaces a range of params with the params in an _initializer‐list_. All iterators that are equal to `from` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `init` contains an invalid percent‐encoding. |=== == Return Value An iterator to the first element inserted, or one past `to` if `init.size() == 0`. == Parameters |=== | Name | Description | *from,to* | The range of params to replace. | *init* | The list of params to assign. |=== Replace params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L792[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> replace( <> from, <> to, FwdIt first, FwdIt last); ---- == Description This function replaces a range of params with a range of params. All iterators that are equal to `from` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Return Value An iterator to the first element inserted, or one past `to` if `first == last`. == Parameters |=== | Name | Description | *from,to* | The range of params to replace. | *first,* | last The range of params to assign. |=== Set a value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L879[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> pos, <> value); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> key, <> value, <> ic = {}); ---- [.small]#<># == Description This function replaces the value of an element at the specified position. All iterators that are equal to `pos` or come after are invalidated. [NOTE] The string passed in must not come from the element being replaced, or else the behavior is undefined. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.encoded_params().set( u.encoded_params().begin(), "none" ); assert( u.encoded_query() == "id=none&id=69" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `value` contains an invalid percent‐encoding. |=== == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Set a value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L879[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> set( <> pos, <> value); ---- == Description This function replaces the value of an element at the specified position. All iterators that are equal to `pos` or come after are invalidated. [NOTE] The string passed in must not come from the element being replaced, or else the behavior is undefined. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.encoded_params().set( u.encoded_params().begin(), "none" ); assert( u.encoded_query() == "id=none&id=69" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `value` contains an invalid percent‐encoding. |=== == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. |=== Set a value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L951[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> set( <> key, <> value, <> ic = {}); ---- == Description This function performs one of two actions depending on the value of `this‐>contains( key, ic )`. * If key is contained in the view then one of the matching params has its value changed to the specified value. The remaining params with a matching key are erased. Otherwise, * If `key` is not contained in the view, then the function apppends the param `{ key, value }` . All iterators are invalidated. [NOTE] The strings passed in must not come from the element being replaced, or else the behavior is undefined. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.encoded_params().set( "id", "none" ); assert( u.encoded_params().count( "id" ) == 1 ); ---- === Postconditions [,cpp] ---- this->count( key, ic ) == 1 && this->find( key, ic )->value == value ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. Set a value This function performs one of two actions depending on the value of `this‐>contains( key, ic )`. * If key is contained in the view then one of the matching params has its value changed to the specified value. The remaining params with a matching key are erased. Otherwise, * If `key` is not contained in the view, then the function apppends the param `{ key, value }` . All iterators are invalidated. [NOTE] The strings passed in must not come from the element being replaced, or else the behavior is undefined. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.encoded_params().set( "id", "none" ); assert( u.encoded_params().count( "id" ) == 1 ); ---- === Postconditions [,cpp] ---- this->count( key, ic ) == 1 && this->find( key, ic )->value == value ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | `key` or `value` contain an invalid percent‐encoding. | `system_error` | `key` or `value` contain an invalid percent‐encoding. |=== == Return Value An iterator to the appended or modified element. == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Remove the value on an element == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L832[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> unset(<> pos) noexcept; ---- == Description This function removes the value of an element at the specified position. After the call returns, `has_value` for the element is false. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); u.encoded_params().unset( u.encoded_params().begin() ); assert( u.encoded_query() == "first&last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. |=== Return the referenced url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_ref.hpp#L217[boost/url/params_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& url() const noexcept; ---- == Description This function returns the url referenced by the view. === Example [,cpp] ---- url u( "?key=value" ); assert( &u.encoded_params().url() == &u ); ---- === Exception Safety [,cpp] ---- Throws nothing. ---- A view representing query parameters in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L58[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class params_encoded_view : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | An unsigned integer type to represent sizes. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return an iterator to the beginning | <> | Return the query corresponding to these params | <> | Return true if a matching key exists | <> | Return the number of matching keys | <> | Return true if there are no params | <> | Return an iterator to the end | <> | Find a matching key | <> | Find a matching key | <> | Conversion | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Return the number of params |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=1] |=== | Name | <> |=== == Description Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- url_view u( "?first=John&last=Doe" ); params_encoded_view p = u.encoded_params(); ---- Strings produced when elements are returned have type xref:#boost-urls-param_pct_view[param_pct_view] and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L227[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- == Description This conversion returns a new view which references the same underlying character buffer, and whose iterators and members return ordinary strings with decoding applied to any percent escapes. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- params_view qp = parse_path( "/path/to/file.txt" ).value(); ---- === Postconditions [,cpp] ---- params_view( *this ).buffer().data() == this->buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L194[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const&) = default; ---- == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L91[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># == Description Default‐constructed params have zero elements. === Example [,cpp] ---- params_encoded_view qp; ---- === Effects [,cpp] ---- return params_encoded_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid query parameter string. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L91[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr params_encoded_view() = default; ---- == Description Default‐constructed params have zero elements. === Example [,cpp] ---- params_encoded_view qp; ---- === Effects [,cpp] ---- return params_encoded_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L114[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr params_encoded_view(<> const& other) = default; ---- == Description After construction both views reference the same character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L169[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- params_encoded_view(core::string_view s); ---- == Description This function constructs params from a valid query parameter string, which can contain percent escapes. Unlike the parameters in URLs, the string passed here should not start with "?". Upon construction, the view references the character buffer pointed to by `s`. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- params_encoded_view qp( "first=John&last=Doe" ); ---- === Effects [,cpp] ---- return parse_query( s ).value(); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- query-params = [ query-param ] *( "&" query-param ) query-param = key [ "=" value ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid query parameter string. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L232[boost/url/params_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend system::result<<>> parse_query(core::string_view s) noexcept; ---- A view representing query parameters in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L80[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class params_ref : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | An unsigned integer type to represent sizes. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Append elements | <> | Assign elements | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Clear the contents of the container | <> | Return true if a matching key exists | <> | Return the number of matching keys | <> | Return true if there are no params | <> | Return an iterator to the end | <> | Erase elements | <> | Find a matching key | <> | Find a matching key | <> | Insert elements | <> | Conversion | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Replace elements | <> | Set a value | <> | Return the number of params | <> | Remove the value on an element | <> | Return the referenced url |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs. The view does not retain ownership of the elements and instead references the original url. The caller is responsible for ensuring that the lifetime of the referenced url extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent‐escaped. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_ref p = u.params(); ---- === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators: * append : Only `end()` . * assign , clear , `operator=` : All elements. * erase : Erased elements and all elements after (including `end()` ). * insert : All elements at or after the insertion point (including `end()` ). * replace , set : Modified elements and all elements after (including `end()` ). A view representing query parameters in a URL Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs. The view does not retain ownership of the elements and instead references the original url. The caller is responsible for ensuring that the lifetime of the referenced url extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent‐escaped. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_ref p = u.params(); ---- === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators: * append : Only `end()` . * assign , clear , `operator=` : All elements. * erase : Erased elements and all elements after (including `end()` ). * insert : All elements at or after the insertion point (including `end()` ). * replace , set : Modified elements and all elements after (including `end()` ). Append elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L380[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( FwdIt first, FwdIt last); ---- [.small]#<># == Description This function appends a param to the view. The `end()` iterator is invalidated. === Example [,cpp] ---- url u; u.params().append( { "first", "John" } ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the new element. == Parameters |=== | Name | Description | *p* | The param to append. | *init* | The list of params to append. | *first,* | last The range of params to append. |=== Append elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L380[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> append(<> const& p); ---- == Description This function appends a param to the view. The `end()` iterator is invalidated. === Example [,cpp] ---- url u; u.params().append( { "first", "John" } ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the new element. == Parameters |=== | Name | Description | *p* | The param to append. |=== Append elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L410[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> append(std::initializer_list<<>> init); ---- == Description This function appends the params in an _initializer‐list_ to the view. The `end()` iterator is invalidated. === Example [,cpp] ---- url u; u.params().append({ { "first", "John" }, { "last", "Doe" } }); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first new element. == Parameters |=== | Name | Description | *init* | The list of params to append. |=== Append elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L445[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> append( FwdIt first, FwdIt last); ---- == Description This function appends a range of params to the view. The `end()` iterator is invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first new element. == Parameters |=== | Name | Description | *first,* | last The range of params to append. |=== Assign elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L315[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void <>(std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last, std::forward_iterator_tag); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last, std::input_iterator_tag) = delete; ---- [.small]#<># == Description This function replaces the entire contents of the view with the params in the _initializer‐list_. All iterators are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.params().assign( {{ "first", "John" }, { "last", "Doe" }} ); ---- === Complexity Linear in `init.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *init* | The list of params to assign. | *first,* | last The range of params to assign. |=== Assign elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L315[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void assign(std::initializer_list<<>> init); ---- == Description This function replaces the entire contents of the view with the params in the _initializer‐list_. All iterators are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.params().assign( {{ "first", "John" }, { "last", "Doe" }} ); ---- === Complexity Linear in `init.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *init* | The list of params to assign. |=== Assign elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L349[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void assign( FwdIt first, FwdIt last); ---- == Description This function replaces the entire contents of the view with the params in the range. All iterators are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true ---- === Complexity Linear in the size of the range. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *first,* | last The range of params to assign. |=== Clear the contents of the container == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L280[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void clear() noexcept; ---- == Description All iterators are invalidated. === Effects [,cpp] ---- this->url().remove_query(); ---- === Postconditions [,cpp] ---- this->empty() == true && this->url().has_query() == false ---- === Complexity Constant. === Exception Safety Throws nothing. Erase elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L595[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> pos) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> first, <> last) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t <>( core::string_view key, <> ic = {}) noexcept; ---- [.small]#<># == Description This function removes an element from the container. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_ref::iterator it = u.params().erase( u.params().begin() ); assert( u.encoded_query() == "last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *first,* | last The range of elements to erase. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Erase elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L595[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase(<> pos) noexcept; ---- == Description This function removes an element from the container. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); params_ref::iterator it = u.params().erase( u.params().begin() ); assert( u.encoded_query() == "last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. |=== Erase elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L619[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase( <> first, <> last) noexcept; ---- == Description This function removes a range of elements from the container. All iterators that are equal to `first` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed range. == Parameters |=== | Name | Description | *first,* | last The range of elements to erase. |=== Erase elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L652[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t erase( core::string_view key, <> ic = {}) noexcept; ---- == Description All iterators are invalidated. === Postconditions [,cpp] ---- this->count( key, ic ) == 0 ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value The number of elements removed from the container. == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Insert elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L477[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, <> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::forward_iterator_tag); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::input_iterator_tag) = delete; ---- [.small]#<># == Description This function inserts a param before the specified position. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the inserted element. == Parameters |=== | Name | Description | *before* | An iterator before which the param is inserted. This may be equal to `end()`. | *p* | The param to insert. | *init* | The list of params to insert. | *first,* | last The range of params to insert. |=== Insert elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L477[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, <> const& p); ---- == Description This function inserts a param before the specified position. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the inserted element. == Parameters |=== | Name | Description | *before* | An iterator before which the param is inserted. This may be equal to `end()`. | *p* | The param to insert. |=== Insert elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L514[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, std::initializer_list<<>> init); ---- == Description This function inserts the params in an _initializer‐list_ before the specified position. All iterators that are equal to `before` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first element inserted, or `before` if `init.size() == 0`. == Parameters |=== | Name | Description | *before* | An iterator before which the element is inserted. This may be equal to `end()`. | *init* | The list of params to insert. |=== Insert elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L557[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> insert( <> before, FwdIt first, FwdIt last); ---- == Description This function inserts a range of params before the specified position. All iterators that are equal to `before` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first element inserted, or `before` if `first == last`. == Parameters |=== | Name | Description | *before* | An iterator before which the element is inserted. This may be equal to `end()`. | *first,* | last The range of params to insert. |=== Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L221[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L184[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(std::initializer_list<<>> init); ---- [.small]#<># == Description The previous contents of this are replaced by the contents of other. All iterators are invalidated. [NOTE] The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The params to assign. | *init* | The list of params to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L184[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The previous contents of this are replaced by the contents of other. All iterators are invalidated. [NOTE] The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The params to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L214[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(std::initializer_list<<>> init); ---- == Description After assignment, the previous contents of the query parameters are replaced by the contents of the initializer‐list. === Preconditions None of character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( init ); ---- === Complexity Linear in `init.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *init* | The list of params to assign. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L87[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( <>& u, <> opt) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( <> const& other, <> opt) noexcept; ---- [.small]#<># == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url() ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. | *opt* | The options for decoding. If this parameter is omitted, `space_as_plus` is used. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L120[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr params_ref(<> const& other) = default; ---- == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url() ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L153[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- params_ref( <> const& other, <> opt) noexcept; ---- == Description After construction, both views will reference the same url but this instance will use the specified xref:#boost-urls-encoding_opts[encoding_opts] when the values are decoded. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url() ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. | *opt* | The options for decoding. If this parameter is omitted, `space_as_plus` is used. |=== Replace elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L691[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> pos, <> const& p); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> to, std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> from, <> to, FwdIt first, FwdIt last); ---- [.small]#<># == Description This function replaces the contents of the element at `pos` with the specified param. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); u.params().replace( u.params().begin(), { "title", "Mr" }); assert( u.encoded_query() == "title=Mr&last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *p* | The param to assign. | *from,to* | The range of elements to replace. | *init* | The list of params to assign. | *first,* | last The range of params to assign. |=== Replace elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L691[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> pos, <> const& p); ---- == Description This function replaces the contents of the element at `pos` with the specified param. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); u.params().replace( u.params().begin(), { "title", "Mr" }); assert( u.encoded_query() == "title=Mr&last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *p* | The param to assign. |=== Replace elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L727[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> from, <> to, std::initializer_list<<>> init); ---- == Description This function replaces a range of elements with the params in an _initializer‐list_. All iterators that are equal to `from` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first element inserted, or one past `to` if `init.size() == 0`. == Parameters |=== | Name | Description | *from,to* | The range of elements to replace. | *init* | The list of params to assign. |=== Replace elements == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L770[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> replace( <> from, <> to, FwdIt first, FwdIt last); ---- == Description This function replaces a range of elements with a range of params. All iterators that are equal to `from` or come after are invalidated. [NOTE] The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first element inserted, or one past `to` if `first == last`. == Parameters |=== | Name | Description | *from,to* | The range of elements to replace. | *first,* | last The range of params to assign. |=== Set a value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L848[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> pos, core::string_view value); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( core::string_view key, core::string_view value, <> ic = {}); ---- [.small]#<># == Description This function replaces the value of an element at the specified position. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.params().set( u.params().begin(), "none" ); assert( u.encoded_query() == "id=none&id=69" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Set a value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L848[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> set( <> pos, core::string_view value); ---- == Description This function replaces the value of an element at the specified position. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.params().set( u.params().begin(), "none" ); assert( u.encoded_query() == "id=none&id=69" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. |=== Set a value == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L910[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> set( core::string_view key, core::string_view value, <> ic = {}); ---- == Description This function performs one of two actions depending on the value of `this‐>contains( key, ic )`. * If key is contained in the view then one of the matching elements has its value changed to the specified value. The remaining elements with a matching key are erased. Otherwise, * If `key` is not contained in the view, then the function apppends the param `{ key, value }` . All iterators are invalidated. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.params().set( "id", "none" ); assert( u.params().count( "id" ) == 1 ); ---- === Postconditions [,cpp] ---- this->count( key, ic ) == 1 && this->find( key, ic )->value == value ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Set a value This function performs one of two actions depending on the value of `this‐>contains( key, ic )`. * If key is contained in the view then one of the matching elements has its value changed to the specified value. The remaining elements with a matching key are erased. Otherwise, * If `key` is not contained in the view, then the function apppends the param `{ key, value }` . All iterators are invalidated. === Example [,cpp] ---- url u( "?id=42&id=69" ); u.params().set( "id", "none" ); assert( u.params().count( "id" ) == 1 ); ---- === Postconditions [,cpp] ---- this->count( key, ic ) == 1 && this->find( key, ic )->value == value ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the appended or modified element. == Parameters |=== | Name | Description | *key* | The key to match. By default, a case‐sensitive comparison is used. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. | *key* | The key to match. By default, a case‐sensitive comparison is used. | *value* | The value to assign. The empty string still counts as a value. That is, `has_value` for the element is true. | *ic* | An optional parameter. If the value xref:#boost-urls-ignore_case[ignore_case] is passed here, the comparison is case‐insensitive. |=== Remove the value on an element == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L810[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> unset(<> pos) noexcept; ---- == Description This function removes the value of an element at the specified position. After the call returns, `has_value` for the element is false. All iterators that are equal to `pos` or come after are invalidated. === Example [,cpp] ---- url u( "?first=John&last=Doe" ); u.params().unset( u.params().begin() ); assert( u.encoded_query() == "first&last=Doe" ); ---- === Complexity Linear in `this‐>url().encoded_query().size()`. === Exception Safety Throws nothing. == Return Value An iterator to the element. == Parameters |=== | Name | Description | *pos* | An iterator to the element. |=== Return the referenced url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#L247[boost/url/params_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& url() const noexcept; ---- == Description This function returns the url referenced by the view. === Example [,cpp] ---- url u( "?key=value" ); assert( &u.segments().url() == &u ); ---- === Exception Safety [,cpp] ---- Throws nothing. ---- A view representing query parameters in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L47[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class params_view : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a query parameter | <> | The reference type | <> | An unsigned integer type to represent sizes. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Return true if a matching key exists | <> | Return the number of matching keys | <> | Return true if there are no params | <> | Return an iterator to the end | <> | Find a matching key | <> | Find a matching key | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Return the number of params |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- url_view u( "?first=John&last=Doe" ); params_view p = u.params(); ---- Percent escapes in strings returned when dereferencing iterators are automatically decoded. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L278[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const&) = default; ---- == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L80[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( <> const& other, <> opt) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( core::string_view s, <> opt); ---- [.small]#<># == Description Default‐constructed params have zero elements. === Example [,cpp] ---- params_view qp; ---- === Effects [,cpp] ---- return params_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid query parameter string. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *opt* | The options for decoding. If this parameter is omitted, `space_as_plus` is used. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L80[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- params_view() = default; ---- == Description Default‐constructed params have zero elements. === Example [,cpp] ---- params_view qp; ---- === Effects [,cpp] ---- return params_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L103[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr params_view(<> const& other) = default; ---- == Description After construction both views reference the same character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L130[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- params_view( <> const& other, <> opt) noexcept; ---- == Description After construction both views will reference the same character buffer but this instance will use the specified xref:#boost-urls-encoding_opts[encoding_opts] when the values are decoded. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L186[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- params_view(core::string_view s); ---- == Description This function constructs params from a valid query parameter string, which can contain percent escapes. Unlike the parameters in URLs, the string passed here should not start with "?". Upon construction, the view references the character buffer pointed to by `s`. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- params_view qp( "first=John&last=Doe" ); ---- === Effects [,cpp] ---- return parse_query( s ).value(); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- query-params = [ query-param ] *( "&" query-param ) query-param = key [ "=" value ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid query parameter string. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_view.hpp#L253[boost/url/params_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- params_view( core::string_view s, <> opt); ---- == Description This function constructs params from a valid query parameter string, which can contain percent escapes. This instance will use the specified xref:#boost-urls-encoding_opts[encoding_opts] when the values are decoded. Unlike the parameters in URLs, the string passed here should not start with "?". Upon construction, the view will reference the character buffer pointed to by `s`. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- encoding_opts opt; opt.space_as_plus = true; params_view qp( "name=John+Doe", opt ); ---- === Effects [,cpp] ---- return params_view(parse_query( s ).value(), opt); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- query-params = [ query-param ] *( "&" query-param ) query-param = key [ "=" value ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid query parameter string. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *opt* | The options for decoding. If this parameter is omitted, `space_as_plus` is used. |=== A reference to a valid percent‐encoded string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L59[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class pct_string_view : public <>::<>; ---- == Types [cols=2] |=== | Name | Description | <> | The const iterator type | <> | The const pointer type | <> | The const reference type | <> | The const reverse iterator type | <> | The difference type | <> | The iterator type | <> | The pointer type | <> | The reference type | <> | The reverse iterator type | <> | The size type | <> | The character traits | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Access a character | <> | Return the last character | <> | Return an iterator to the beginning | <> | Return an iterator to the beginning | <> | Return an iterator to the end | <> | Return the result of comparing to another string | <> | Return true if matching characters are found | <> | Copy the characters to another buffer | <> | Return a reverse iterator to the end | <> | Return a reverse iterator to the beginning | <> | Return a pointer to the character buffer | <> | Return the string with percent‐decoding | <> | Return the decoded size | <> | Return true if the string is empty | <> | Return an iterator to the end | <> | Return true if a matching suffix exists | <> | Return the position of matching characters | <> | Return the position of the first non‐match | <> | Return the position of the first match | <> | Return the position of the last non‐match | <> | Return the position of the last match | <> | Return the first character | <> | Return the size | <> | Return the maximum allowed size | <> | Conversion | <> | Conversion | <> | Return the string as a range of decoded characters | <> | Arrow support | <> | Assignment | <> | Access a character | <> [.small]#[constructor]# | Constructor Constructor (deleted) | <> | Return a reverse iterator to the end | <> | Return a reverse iterator to the beginning | <> | Return the position of matching characters | <> | Return the size | <> | Return true if a matching prefix exists | <> | Return a view to part of the string | <> | Swap |=== == Static Data Members [cols=2] |=== | Name | Description | <> | A constant used to represent "no position" |=== == Friends [cols=2] |=== | Name | Description | <> | | <> | Compare two string views for inequality | <> | Compare two string views for less than | <> | Format a string to an output stream | <> | Compare two string views for less than or equal | <> | Compare two string views for equality | <> | Compare two string views for greater than | <> | Compare two string views for greater than or equal |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Assignment | <> | Swap |=== == Protected Data Members [cols=2] |=== | Name | Description | <> | The referenced character buffer |=== == Description Objects of this type behave like a `core::string_view` and have the same interface, but offer an additional invariant: they can only be constructed from strings containing valid percent‐escapes. Attempting construction from a string containing invalid or malformed percent escapes results in an exception. Return the string with percent‐decoding == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L334[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type decode( <> opt = {}, StringToken&& token); ---- == Description This function converts percent escapes in the string into ordinary characters and returns the result. When called with no arguments, the return type is `std::string`. Otherwise, the return type and style of output is determined by which string token is passed. === Example [,cpp] ---- assert( pct_string_view( "Program%20Files" ).decode() == "Program Files" ); ---- === Complexity Linear in `this‐>size()`. === Exception Safety Calls to allocate may throw. String tokens may throw exceptions. == Parameters |=== | Name | Description | *opt* | The options for encoding. If this parameter is omitted, the default options are used. | *token* | An optional string token. If this parameter is omitted, then a new `std::string` is returned. Otherwise, the function return type is the result type of the token. |=== == See Also xref:#boost-urls-encoding_opts[encoding_opts], xref:#boost-urls-string_token-return_string[string_token::return_string]. Return the decoded size == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L276[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr std::size_t decoded_size() const noexcept; ---- == Description This function returns the number of characters in the resulting string if percent escapes were converted into ordinary characters. === Complexity Constant. === Exception Safety Throws nothing. Return the string as a range of decoded characters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L294[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> operator*() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. == See Also xref:#boost-urls-decode_view[decode_view]. Arrow support == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L356[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> const* operator‐>() const noexcept; ---- Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L252[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const& other) = default; ---- == Description The copy references the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->data() == other.data() ---- === Complexity Constant. === Exception Safety Throws nothing. === other The string to copy. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L104[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> String> requires std::is_convertible< String, core::string_view >::value constexpr <>(String const& s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(std::nullptr_t) = delete; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( char const* s, std::size_t len); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># == Description Default constructed string are empty. === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent encoding. |=== == Template Parameters |=== | Name | Description | *String* | A type convertible to `core::string_view` |=== == Parameters |=== | Name | Description | *s* | The string to construct from. | *len* | The length of the string. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L104[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr pct_string_view() = default; ---- == Description Default constructed string are empty. === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L125[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr pct_string_view(<> const& other) = default; ---- == Description The copy references the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->data() == other.data() ---- === Complexity Constant. === Exception Safety Throws nothing. === other The string to copy. Constructor (deleted) == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L173[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- pct_string_view(std::nullptr_t) = delete; ---- Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L199[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- pct_string_view( char const* s, std::size_t len); ---- == Description The newly constructed string references the specified character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->data() == s && this->size() == len ---- === Complexity Linear in `len`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent encoding. |=== == Parameters |=== | Name | Description | *s* | The string to construct from. | *len* | The length of the string. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L230[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- pct_string_view(core::string_view s); ---- == Description The newly constructed string references the specified character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->data() == s.data() && this->size() == s.size() ---- === Complexity Linear in `s.size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent encoding. |=== == Parameters |=== | Name | Description | *s* | The string to construct from. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L153[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> String> requires std::is_convertible< String, core::string_view >::value constexpr pct_string_view(String const& s); ---- == Description The newly constructed string references the specified character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->data() == core::string_view(s).data() ---- === Complexity Linear in `core::string_view(s).size()`. === Exception Safety Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent encoding. |=== == Template Parameters |=== | Name | Description | *String* | A type convertible to `core::string_view` |=== == Parameters |=== | Name | Description | *s* | The string to construct from. |=== Swap == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L368[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void swap(<>& s) noexcept; ---- == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L255[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend system::result<<>> make_pct_string_view(core::string_view s) noexcept; ---- Common functionality for containers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L37[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class segments_base; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | An unsigned integer type used to represent size. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return the last segment | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Return true if there are no segments | <> | Return an iterator to the end | <> | Return the first segment | <> | Returns true if this references an absolute path. | <> | Return the number of segments |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * segments_ref * segments_view * segments_encoded_ref * segments_encoded_view Common functionality for containers This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * segments_ref * segments_view * segments_encoded_ref * segments_encoded_view A Bidirectional iterator to a path segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/impl/segments_base.hpp#L21[boost/url/impl/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class iterator { /* see-below */ }; ---- == Description Objects of this type allow iteration through the segments in the path. Any percent‐escapes in returned strings are decoded first. The values returned are read‐only; changes to segments must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced belong to the iterator and become invalidated when that particular iterator is incremented, decremented, or destroyed. Return the last segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L292[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::string back() const noexcept; ---- == Description === Preconditions [,cpp] ---- this->empty() == false ---- === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).segments().back() == "file.txt" ); ---- === Preconditions [,cpp] ---- this->empty() == false ---- === Effects [,cpp] ---- return *--end(); ---- === Complexity Linear in `this‐>back().size()`. === Exception Safety Calls to allocate may throw. Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L305[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> begin() const noexcept; ---- == Description === Complexity Linear in `this‐>front().size()` or constant if `this‐>empty()`. === Exception Safety Throws nothing. Return the referenced character buffer. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L175[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> buffer() const noexcept; ---- == Description This function returns the character buffer referenced by the view. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).segments().buffer() == "/path/to/file.txt" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return true if there are no segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L212[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description === Example [,cpp] ---- assert( ! url_view( "/index.htm" ).segments().empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L317[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> end() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. Return the first segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L261[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::string front() const noexcept; ---- == Description This function returns a string with the first segment of the path without any leading or trailing '/' separators. Any percent‐escapes in the string are decoded first. === Preconditions [,cpp] ---- this->empty() == false ---- === Effects [,cpp] ---- return *begin(); ---- === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).segments().front() == "path" ); ---- === Complexity Linear in `this‐>front().size()`. === Exception Safety Calls to allocate may throw. Returns true if this references an absolute path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L195[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_absolute() const noexcept; ---- == Description Absolute paths always start with a forward slash ('/'). === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).segments().is_absolute() == true ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return the maximum number of characters possible == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L148[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr static std::size_t max_size() noexcept; ---- == Description This represents the largest number of characters that are possible in a path, not including any null terminator. === Exception Safety Throws nothing. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L45[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(/* implementation-defined */::path_ref const& ref) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const&) = default; ---- [.small]#<># Return the number of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L229[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- == Description === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).segments().size() == 3 ); ---- === Complexity Constant. === Exception Safety Throws nothing. A Bidirectional iterator to a path segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L100[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = <>; ---- == Description Objects of this type allow iteration through the segments in the path. Any percent‐escapes in returned strings are decoded first. The values returned are read‐only; changes to segments must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced belong to the iterator and become invalidated when that particular iterator is incremented, decremented, or destroyed. The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L123[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_reference = std::string; ---- == Description This is the type of value returned when iterators of the view are dereferenced. A signed integer type used to represent differences. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L131[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using difference_type = std::ptrdiff_t; ---- The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L120[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using reference = std::string; ---- == Description This is the type of value returned when iterators of the view are dereferenced. An unsigned integer type used to represent size. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L127[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using size_type = std::size_t; ---- The value type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L113[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = std::string; ---- == Description Values of this type represent a segment where unique ownership is retained by making a copy. === Example [,cpp] ---- segments_base::value_type ps( url_view( "/path/to/file.txt" ).segments().back() ); ---- Common functionality for containers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L37[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class segments_encoded_base; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | An unsigned integer type used to represent size. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return the last segment | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Return true if there are no segments | <> | Return an iterator to the end | <> | Return the first segment | <> | Returns true if this references an absolute path. | <> | Return the number of segments |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * segments_ref * segments_view * segments_encoded_ref * segments_encoded_view Common functionality for containers This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * segments_ref * segments_view * segments_encoded_ref * segments_encoded_view A Bidirectional iterator to a path segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L102[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class iterator { /* see-below */ }; ---- == Description Objects of this type allow iteration through the segments in the path. Strings returned by iterators may contain percent escapes. The values returned are read‐only; changes to segments must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced refer to the underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by any container or iterator. Return the last segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L304[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> back() const noexcept; ---- == Description This function returns a string with the last segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes. === Preconditions [,cpp] ---- this->empty() == false ---- === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).encoded_segments().back() == "file.txt" ); ---- === Preconditions [,cpp] ---- this->empty() == false ---- === Effects [,cpp] ---- return *--end(); ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the beginning == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L317[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> begin() const noexcept; ---- == Description === Complexity Linear in `this‐>front().size()` or constant if `this‐>empty()`. === Exception Safety Throws nothing. Return the referenced character buffer. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L181[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> buffer() const noexcept; ---- == Description This function returns the character buffer referenced by the view. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).encoded_segments().buffer() == "/path/to/file.txt" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return true if there are no segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L218[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description === Example [,cpp] ---- assert( ! url_view( "/index.htm" ).encoded_segments().empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return an iterator to the end == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L329[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> end() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. Return the first segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L267[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> front() const noexcept; ---- == Description This function returns a string with the first segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes. === Preconditions [,cpp] ---- this->empty() == false ---- === Effects [,cpp] ---- return *begin(); ---- === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).encoded_segments().front() == "path" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Returns true if this references an absolute path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L201[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_absolute() const noexcept; ---- == Description Absolute paths always start with a forward slash ('/'). === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).encoded_segments().is_absolute() == true ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return the maximum number of characters possible == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L154[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr static std::size_t max_size() noexcept; ---- == Description This represents the largest number of characters that are possible in a path, not including any null terminator. === Exception Safety Throws nothing. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L45[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(/* implementation-defined */::path_ref const& ref) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const&) = default; ---- [.small]#<># Return the number of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L235[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- == Description === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).encoded_segments().size() == 3 ); ---- === Complexity Constant. === Exception Safety Throws nothing. A Bidirectional iterator to a path segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L106[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = <>; ---- == Description Objects of this type allow iteration through the segments in the path. Strings returned by iterators may contain percent escapes. The values returned are read‐only; changes to segments must be made through the container instead, if the container supports modification. The strings produced when iterators are dereferenced refer to the underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by any container or iterator. The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L129[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_reference = <>; ---- == Description This is the type of value returned when iterators of the view are dereferenced. A signed integer type used to represent differences. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L137[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using difference_type = std::ptrdiff_t; ---- The reference type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L126[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using reference = <>; ---- == Description This is the type of value returned when iterators of the view are dereferenced. An unsigned integer type used to represent size. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L133[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using size_type = std::size_t; ---- The value type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L119[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = std::string; ---- == Description Values of this type represent a segment where unique ownership is retained by making a copy. === Example [,cpp] ---- segments_encoded_base::value_type ps( url_view( "/path/to/file.txt" ).encoded_segments().back() ); ---- A view representing path segments in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L88[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class segments_encoded_ref : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | An unsigned integer type used to represent size. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Assign segments | <> | Return the last segment | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Clear the contents of the container | <> | Return true if there are no segments | <> | Return an iterator to the end | <> | Erase segments | <> | Return the first segment | <> | Insert segments | <> | Returns true if this references an absolute path. | <> | Conversion | <> | Assignment | <> | Remove the last segment | <> | Append a segment | <> | Replace segments | <> [.small]#[constructor]# | Constructor | <> | Return the number of segments | <> | Return the referenced url |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description Objects of this type are used to interpret the path as a bidirectional view of segments, where each segment is a string which may contain percent‐escapes. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. === Example [,cpp] ---- url u( "/path/to/file.txt" ); segments_encoded_ref ps = u.encoded_segments(); ---- The strings returned when iterators are dereferenced have type xref:#boost-urls-pct_string_view[pct_string_view] and may contain percent‐escapes. Reserved characters in inputs are automatically escaped. Escapes in inputs are preserved. Exceptions are thrown on invalid inputs. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators: * push_back : Only `end()` . * assign , clear , operator= : All elements. * erase : Erased elements and all elements after (including `end()` ). * insert : All elements at or after the insertion point (including `end()` ). * replace : Modified elements and all elements after (including `end()` ). A view representing path segments in a URL Objects of this type are used to interpret the path as a bidirectional view of segments, where each segment is a string which may contain percent‐escapes. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. === Example [,cpp] ---- url u( "/path/to/file.txt" ); segments_encoded_ref ps = u.encoded_segments(); ---- The strings returned when iterators are dereferenced have type xref:#boost-urls-pct_string_view[pct_string_view] and may contain percent‐escapes. Reserved characters in inputs are automatically escaped. Escapes in inputs are preserved. Exceptions are thrown on invalid inputs. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators: * push_back : Only `end()` . * assign , clear , operator= : All elements. * erase : Erased elements and all elements after (including `end()` ). * insert : All elements at or after the insertion point (including `end()` ). * replace : Modified elements and all elements after (including `end()` ). == See Also xref:#boost-urls-segments_encoded_view[segments_encoded_view], xref:#boost-urls-segments_view[segments_view], xref:#boost-urls-segments_ref[segments_ref]. xref:#boost-urls-segments_encoded_view[segments_encoded_view], xref:#boost-urls-segments_view[segments_view], xref:#boost-urls-segments_ref[segments_ref]. Assign segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L320[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void <>(std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last); ---- [.small]#<># == Description The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved. All iterators are invalidated. [NOTE] None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.segments().assign( {"path", "to", "file.txt"} ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The list contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *init* | The list of segments to assign. | *first* | The first element in the range. | *last* | One past the last element in the range. |=== Assign segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L320[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void assign(std::initializer_list<<>> init); ---- == Description The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved. All iterators are invalidated. [NOTE] None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.segments().assign( {"path", "to", "file.txt"} ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The list contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *init* | The list of segments to assign. |=== Assign segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L360[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void assign( FwdIt first, FwdIt last); ---- == Description The existing contents are replaced by a copy of the contents of the range. Reserved characters in the range are automatically escaped. Escapes in the range are preserved. All iterators are invalidated. [NOTE] None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, pct_string_view >::value == true ---- === Complexity Linear in `std::distance( first, last ) + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *first* | The first element in the range. | *last* | One past the last element in the range. |=== Clear the contents of the container == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L278[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void clear() noexcept; ---- == Description All iterators are invalidated. === Effects [,cpp] ---- this->url().set_encoded_path( "" ); ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Linear in `this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Throws nothing. Erase segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L531[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> pos) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> first, <> last) noexcept; ---- [.small]#<># == Description This function removes a segment. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_resource().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed segment. == Parameters |=== | Name | Description | *pos* | An iterator to the element. | *first,* | last The range of segments to erase. |=== Erase segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L531[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase(<> pos) noexcept; ---- == Description This function removes a segment. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_resource().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed segment. == Parameters |=== | Name | Description | *pos* | An iterator to the element. |=== Erase segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L557[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase( <> first, <> last) noexcept; ---- == Description This function removes a range of segments from the container. All iterators that are equal to `first` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_resource().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed range. == Parameters |=== | Name | Description | *first,* | last The range of segments to erase. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L399[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, <> s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::input_iterator_tag) = delete; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::forward_iterator_tag); ---- [.small]#<># == Description This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped. Escapes in the segment are preserved. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The segment contains an invalid percent‐encoding. |=== == Return Value An iterator to the inserted segment. == Parameters |=== | Name | Description | *before* | An iterator before which the segment is inserted. This may be equal to `end()`. | *s* | The segment to insert. | *init* | The list of segments to insert. | *first* | The first element in the range to insert. | *last* | One past the last element in the range to insert. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L399[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, <> s); ---- == Description This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped. Escapes in the segment are preserved. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The segment contains an invalid percent‐encoding. |=== == Return Value An iterator to the inserted segment. == Parameters |=== | Name | Description | *before* | An iterator before which the segment is inserted. This may be equal to `end()`. | *s* | The segment to insert. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L452[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, std::initializer_list<<>> init); ---- == Description This function inserts the segments in an initializer list before the specified position. Reserved characters in the list are automatically escaped. Escapes in the list are preserved. All iterators that are equal to `before` or come after are invalidated. [NOTE] None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u( "/file.txt" ); u.encoded_segments().insert( u.encoded_segments().begin(), { "path", "to" } ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The list contains an invalid percent‐encoding. |=== == Return Value An iterator to the first element inserted, or `before` if `init.size() == 0`. == Parameters |=== | Name | Description | *before* | An iterator before which the list is inserted. This may be equal to `end()`. | *init* | The list of segments to insert. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L503[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> insert( <> before, FwdIt first, FwdIt last); ---- == Description This function inserts the segments in a range before the specified position. Reserved characters in the range are automatically escaped. Escapes in the range are preserved. All iterators that are equal to `before` or come after are invalidated. [NOTE] None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, pct_string_view >::value == true ---- === Complexity Linear in `std::distance( first, last ) + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Return Value An iterator to the first segment inserted, or `before` if `init.empty()`. == Parameters |=== | Name | Description | *before* | An iterator before which the range is inserted. This may be equal to `end()`. | *first* | The first element in the range to insert. | *last* | One past the last element in the range to insert. |=== Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L221[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- == See Also xref:#boost-urls-segments_encoded_view[segments_encoded_view]. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L159[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(std::initializer_list<<>> init); ---- [.small]#<># == Description The existing contents are replaced by a copy of the other segments. All iterators are invalidated. [NOTE] None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `system_error` | The list contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *other* | The segments to assign. | *init* | The list of segments to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L159[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The existing contents are replaced by a copy of the other segments. All iterators are invalidated. [NOTE] None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The segments to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L164[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The existing contents are replaced by a copy of the other segments. All iterators are invalidated. [NOTE] None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The segments to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L211[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(std::initializer_list<<>> init); ---- == Description The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved. All iterators are invalidated. === Example [,cpp] ---- url u; u.encoded_segments() = {"path", "to", "file.txt"}; ---- === Preconditions None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( init.begin(), init.end() ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The list contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *init* | The list of segments to assign. |=== Remove the last segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L774[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void pop_back() noexcept; ---- == Description This function removes the last segment from the container. Iterators to the last segment as well as all end iterators are invalidated. === Preconditions [,cpp] ---- !this->empty() ---- === Exception Safety Throws nothing. Append a segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L753[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void push_back(<> s); ---- == Description This function appends a segment to the end of the path. Reserved characters in the string are automatically escaped. Escapes in the string are preserved. All end iterators are invalidated. === Postconditions [,cpp] ---- this->back() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The segment to append. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L590[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> pos, <> s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> to, <> s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> to, std::initializer_list<<>> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> from, <> to, FwdIt first, FwdIt last); ---- [.small]#<># == Description This function replaces the segment at the specified position. Reserved characters in the string are automatically escaped. Escapes in the string are preserved. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent‐encoding. |=== == Return Value An iterator to the replaced segment. == Parameters |=== | Name | Description | *pos* | An iterator to the segment. | *s* | The string to assign. | *from* | The first element in the range of segments to replace. | *to* | One past the last element in the range of segments to replace. | *init* | The list of segments to assign. | *first* | The first element in the new range of segments. | *last* | One past the last element in the new range of segments. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L590[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> pos, <> s); ---- == Description This function replaces the segment at the specified position. Reserved characters in the string are automatically escaped. Escapes in the string are preserved. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the replaced segment. == Parameters |=== | Name | Description | *pos* | An iterator to the segment. | *s* | The string to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L626[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> from, <> to, <> s); ---- == Description This function replaces a range of segments with one segment. Reserved characters in the string are automatically escaped. Escapes in the string are preserved. All iterators that are equal to `from` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The string contains an invalid percent‐encoding. |=== == Return Value An iterator to the new segment. == Parameters |=== | Name | Description | *from* | The first element in the range of segments to replace. | *to* | One past the last element in the range of segments to replace. | *s* | The string to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L672[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> from, <> to, std::initializer_list<<>> init); ---- == Description This function replaces a range of segments with a list of segments in an initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved. All iterators that are equal to `from` or come after are invalidated. === Preconditions None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Complexity Linear in `init.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The list contains an invalid percent‐encoding. |=== == Return Value An iterator to the first segment inserted, or one past `to` if `init.size() == 0`. == Parameters |=== | Name | Description | *from* | The first element in the range of segments to replace. | *to* | One past the last element in the range of segments to replace. | *init* | The list of segments to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L717[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> replace( <> from, <> to, FwdIt first, FwdIt last); ---- == Description This function replaces a range of segments with annother range of segments. Reserved characters in the new range are automatically escaped. Escapes in the new range are preserved. All iterators that are equal to `from` or come after are invalidated. === Preconditions None of the character buffers referenced by the new range may overlap the character buffer of the underlying url, or else the behavior is undefined. === Complexity Linear in `std::distance( first, last ) + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Exceptions |=== | Name | Thrown on | `system_error` | The range contains an invalid percent‐encoding. |=== == Return Value An iterator to the first segment inserted, or one past `to` if `init.size() == 0`. == Parameters |=== | Name | Description | *from* | The first element in the range of segments to replace. | *to* | One past the last element in the range of segments to replace. | *first* | The first element in the new range of segments. | *last* | One past the last element in the new range of segments. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L95[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url(); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L127[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr segments_encoded_ref(<> const& other) = default; ---- == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url(); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Return the referenced url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L245[boost/url/segments_encoded_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& url() const noexcept; ---- == Description This function returns the url referenced by the view. === Example [,cpp] ---- url u( "/path/to/file.txt" ); assert( &u.encoded_segments().url() == &u ); ---- === Exception Safety Throws nothing. A view representing path segments in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L61[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class segments_encoded_view : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | An unsigned integer type used to represent size. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return the last segment | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Return true if there are no segments | <> | Return an iterator to the end | <> | Return the first segment | <> | Returns true if this references an absolute path. | <> | Conversion | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Return the number of segments |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=1] |=== | Name | <> |=== == Description Objects of this type are used to interpret the path as a bidirectional view of segment strings. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- url_view u( "/path/to/file.txt" ); segments_encoded_view ps = u.encoded_segments(); assert( ps.buffer().data() == u.buffer().data() ); ---- Strings produced when elements are returned have type xref:#boost-urls-param_pct_view[param_pct_view] and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. == See Also xref:#boost-urls-segments_view[segments_view], xref:#boost-urls-segments_encoded_ref[segments_encoded_ref], xref:#boost-urls-segments_ref[segments_ref]. Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L226[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- == Description This conversion returns a new view which references the same underlying character buffer, and whose iterators and members return ordinary strings with decoding applied to any percent escapes. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- segments_view ps = parse_path( "/path/to/file.txt" ).value(); ---- === Postconditions [,cpp] ---- segments_view( *this ).buffer().data() == this->buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L192[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const&) = default; ---- == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L67[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(/* implementation-defined */::path_ref const& ref) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const&) noexcept = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># == Description Default‐constructed segments have zero elements. === Example [,cpp] ---- segments_encoded_view ps; ---- === Effects [,cpp] ---- return segments_encoded_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid path. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L92[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr segments_encoded_view() = default; ---- == Description Default‐constructed segments have zero elements. === Example [,cpp] ---- segments_encoded_view ps; ---- === Effects [,cpp] ---- return segments_encoded_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L115[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr segments_encoded_view(<> const&) noexcept = default; ---- == Description After construction, both views reference the same character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L167[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- segments_encoded_view(core::string_view s); ---- == Description This function constructs segments from a valid path string, which can contain percent escapes. Upon construction, the view references the character buffer pointed to by `s`. caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed. === Example [,cpp] ---- segments_encoded_view ps( "/path/to/file.txt" ); ---- === Effects [,cpp] ---- return parse_path( s ).value(); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- path = [ "/" ] [ segment *( "/" segment ) ] segment = *pchar ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path] Constructor This function constructs segments from a valid path string, which can contain percent escapes. Upon construction, the view references the character buffer pointed to by `s`. caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed. === Example [,cpp] ---- segments_encoded_view ps( "/path/to/file.txt" ); ---- === Effects [,cpp] ---- return parse_path( s ).value(); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- path = [ "/" ] [ segment *( "/" segment ) ] segment = *pchar ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid path. | `system_error` | `s` contains an invalid path. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *s* | The string to parse. |=== == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L232[boost/url/segments_encoded_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend system::result<<>> parse_path(core::string_view s) noexcept; ---- A view representing path segments in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L85[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class segments_ref : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | An unsigned integer type used to represent size. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Assign segments | <> | Return the last segment | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Clear the contents of the container | <> | Return true if there are no segments | <> | Return an iterator to the end | <> | Erase segments | <> | Return the first segment | <> | Insert segments | <> | Returns true if this references an absolute path. | <> | Conversion | <> | Assignment | <> | Remove the last segment | <> | Append a segment | <> | Replace segments | <> [.small]#[constructor]# | Constructor | <> | Return the number of segments | <> | Return the referenced url |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description Objects of this type are used to interpret the path as a bidirectional view of segments, where each segment is a string with percent escapes automatically decoded. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. === Example [,cpp] ---- url u( "/path/to/file.txt" ); segments_ref ps = u.segments(); ---- Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent‐escaped. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators: * push_back : Only `end()` . * assign , clear , operator= : All elements. * erase : Erased elements and all elements after (including `end()` ). * insert : All elements at or after the insertion point (including `end()` ). * replace : Modified elements and all elements after (including `end()` ). A view representing path segments in a URL Objects of this type are used to interpret the path as a bidirectional view of segments, where each segment is a string with percent escapes automatically decoded. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The view is modifiable; calling non‐const members causes changes to the referenced url. === Example [,cpp] ---- url u( "/path/to/file.txt" ); segments_ref ps = u.segments(); ---- Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent‐escaped. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators: * push_back : Only `end()` . * assign , clear , operator= : All elements. * erase : Erased elements and all elements after (including `end()` ). * insert : All elements at or after the insertion point (including `end()` ). * replace : Modified elements and all elements after (including `end()` ). == See Also xref:#boost-urls-segments_encoded_ref[segments_encoded_ref], xref:#boost-urls-segments_encoded_view[segments_encoded_view], xref:#boost-urls-segments_view[segments_view]. xref:#boost-urls-segments_encoded_ref[segments_encoded_ref], xref:#boost-urls-segments_encoded_view[segments_encoded_view], xref:#boost-urls-segments_view[segments_view]. Assign segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L307[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void <>(std::initializer_list<core::string_view> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void <>( FwdIt first, FwdIt last); ---- [.small]#<># == Description The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. All iterators are invalidated. [NOTE] None of the character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.segments().assign( { "path", "to", "file.txt" } ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *init* | The list of segments to assign. | *first* | The beginning of the range of segments to assign. | *last* | The end of the range of segments to assign. |=== Assign segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L307[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void assign(std::initializer_list<core::string_view> init); ---- == Description The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. All iterators are invalidated. [NOTE] None of the character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u; u.segments().assign( { "path", "to", "file.txt" } ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *init* | The list of segments to assign. |=== Assign segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L342[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> void assign( FwdIt first, FwdIt last); ---- == Description The existing contents are replaced by a copy of the contents of the range. Reserved characters in the range are automatically escaped. All iterators are invalidated. [NOTE] None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true ---- === Complexity Linear in `std::distance( first, last ) + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *first* | The beginning of the range of segments to assign. | *last* | The end of the range of segments to assign. |=== Clear the contents of the container == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L270[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void clear() noexcept; ---- == Description All iterators are invalidated. === Effects [,cpp] ---- this->url().set_encoded_path( "" ); ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Linear in `this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Throws nothing. Erase segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L497[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> pos) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> first, <> last) noexcept; ---- [.small]#<># == Description This function removes a segment. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_resource().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed segment. == Parameters |=== | Name | Description | *pos* | An iterator to the segment. | *first* | The beginning of the range to remove. | *last* | The end of the range to remove. |=== Erase segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L497[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase(<> pos) noexcept; ---- == Description This function removes a segment. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_resource().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed segment. == Parameters |=== | Name | Description | *pos* | An iterator to the segment. |=== Erase segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L522[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> erase( <> first, <> last) noexcept; ---- == Description This function removes a range of segments. All iterators that are equal to `first` or come after are invalidated. === Complexity Linear in `this‐>url().encoded_resource().size()`. === Exception Safety Throws nothing. == Return Value An iterator to one past the removed range. == Parameters |=== | Name | Description | *first* | The beginning of the range to remove. | *last* | The end of the range to remove. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L376[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> before, std::initializer_list<core::string_view> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::input_iterator_tag) = delete; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> before, FwdIt first, FwdIt last, std::forward_iterator_tag); ---- [.small]#<># == Description This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the inserted segment. == Parameters |=== | Name | Description | *before* | An iterator before which the segment is inserted. This may be equal to `end()`. | *s* | The segment to insert. | *init* | The list of segments to insert. | *first* | The beginning of the range of segments to insert. | *last* | The end of the range of segments to insert. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L376[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, core::string_view s); ---- == Description This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped. All iterators that are equal to `before` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the inserted segment. == Parameters |=== | Name | Description | *before* | An iterator before which the segment is inserted. This may be equal to `end()`. | *s* | The segment to insert. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L424[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> insert( <> before, std::initializer_list<core::string_view> init); ---- == Description This function inserts the segments in an initializer list before the specified position. Reserved characters in the list are percent‐escaped in the result. All iterators that are equal to `before` or come after are invalidated. [NOTE] None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Example [,cpp] ---- url u( "/file.txt" ); u.segments().insert( u.segments().begin(), { "path", "to" } ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first element inserted, or `before` if `init.size() == 0`. == Parameters |=== | Name | Description | *before* | An iterator before which the list is inserted. This may be equal to `end()`. | *init* | The list of segments to insert. |=== Insert segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L469[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> insert( <> before, FwdIt first, FwdIt last); ---- == Description This function inserts the segments in a range before the specified position. Reserved characters in the list are automatically escaped. All iterators that are equal to `before` or come after are invalidated. [NOTE] None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined. === Mandates [,cpp] ---- std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true ---- === Complexity Linear in `std::distance( first, last ) + this‐>url().encoded_resource().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first segment inserted, or `before` if `init.empty()`. == Parameters |=== | Name | Description | *before* | An iterator before which the range is inserted. This may be equal to `end()`. | *first* | The beginning of the range of segments to insert. | *last* | The end of the range of segments to insert. |=== Conversion == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L213[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator <>() const noexcept; ---- == See Also xref:#boost-urls-segments_view[segments_view]. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L156[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(std::initializer_list<core::string_view> init); ---- [.small]#<># == Description The existing contents are replaced by a copy of the other segments. All iterators are invalidated. [NOTE] None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The segments to assign. | *init* | The list of segments to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L156[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The existing contents are replaced by a copy of the other segments. All iterators are invalidated. [NOTE] None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The segments to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L161[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other); ---- == Description The existing contents are replaced by a copy of the other segments. All iterators are invalidated. [NOTE] None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( other.begin(), other.end() ); ---- === Complexity Linear in `other.buffer().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *other* | The segments to assign. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L203[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(std::initializer_list<core::string_view> init); ---- == Description The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. All iterators are invalidated. === Example [,cpp] ---- url u; u.segments() = { "path", "to", "file.txt" }; ---- === Preconditions None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Effects [,cpp] ---- this->assign( init.begin(), init.end() ); ---- === Complexity Linear in `init.size() + this‐>url().encoded_query().size() + this‐>url().encoded_fragment().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *init* | The list of segments to assign. |=== Remove the last segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L716[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void pop_back() noexcept; ---- == Description This function removes the last segment from the container. Iterators to the last segment as well as all end iterators are invalidated. === Preconditions [,cpp] ---- not this->empty() ---- === Exception Safety Throws nothing. Append a segment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L695[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void push_back(core::string_view s); ---- == Description This function appends a segment to the end of the path. Reserved characters in the string are automatically escaped. All end iterators are invalidated. === Postconditions [,cpp] ---- this->back() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *s* | The segment to append. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L554[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> pos, core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> to, core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( <> from, <> to, std::initializer_list<core::string_view> init); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> <>( <> from, <> to, FwdIt first, FwdIt last); ---- [.small]#<># == Description This function replaces the segment at the specified position. Reserved characters in the string are automatically escaped. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the replaced segment. == Parameters |=== | Name | Description | *pos* | An iterator to the segment. | *s* | The string to assign. | *from* | The beginning of the range of segments to replace. | *to* | The end of the range of segments to replace. | *init* | The list of segments to assign. | *first* | The beginning of the range of segments to assign. | *last* | The end of the range of segments to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L554[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> pos, core::string_view s); ---- == Description This function replaces the segment at the specified position. Reserved characters in the string are automatically escaped. All iterators that are equal to `pos` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the replaced segment. == Parameters |=== | Name | Description | *pos* | An iterator to the segment. | *s* | The string to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L585[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> from, <> to, core::string_view s); ---- == Description This function replaces a range of segments with one segment. Reserved characters in the string are automatically escaped. All iterators that are equal to `from` or come after are invalidated. === Complexity Linear in `s.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the new segment. == Parameters |=== | Name | Description | *from* | The beginning of the range of segments to replace. | *to* | The end of the range of segments to replace. | *s* | The string to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L626[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> replace( <> from, <> to, std::initializer_list<core::string_view> init); ---- == Description This function replaces a range of segments with a list of segments in an initializer list. Reserved characters in the list are automatically escaped. All iterators that are equal to `from` or come after are invalidated. === Preconditions None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined. === Complexity Linear in `init.size() + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first segment inserted, or one past `to` if `init.size() == 0`. == Parameters |=== | Name | Description | *from* | The beginning of the range of segments to replace. | *to* | The end of the range of segments to replace. | *init* | The list of segments to assign. |=== Replace segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L666[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FwdIt> <> replace( <> from, <> to, FwdIt first, FwdIt last); ---- == Description This function replaces a range of segments with annother range of segments. Reserved characters in the new range are automatically escaped. All iterators that are equal to `from` or come after are invalidated. === Preconditions None of the character buffers referenced by the new range may overlap the character buffer of the underlying url, or else the behavior is undefined. === Complexity Linear in `std::distance( first, last ) + this‐>url().encoded_resouce().size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Return Value An iterator to the first segment inserted, or one past `to` if `init.size() == 0`. == Parameters |=== | Name | Description | *from* | The beginning of the range of segments to replace. | *to* | The end of the range of segments to replace. | *first* | The beginning of the range of segments to assign. | *last* | The end of the range of segments to assign. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L93[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url(); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L124[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr segments_ref(<> const& other) = default; ---- == Description After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced. === Postconditions [,cpp] ---- &this->url() == &other.url(); ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The other view. |=== Return the referenced url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_ref.hpp#L237[boost/url/segments_ref.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& url() const noexcept; ---- == Description This function returns the url referenced by the view. === Example [,cpp] ---- url u( "/path/to/file.txt" ); assert( &u.segments().url() == &u ); ---- === Exception Safety Throws nothing. A view representing path segments in a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L55[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class segments_view : public <>; ---- == Types [cols=2] |=== | Name | Description | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | A signed integer type used to represent differences. | <> | A Bidirectional iterator to a path segment | <> | The reference type | <> | An unsigned integer type used to represent size. | <> | The value type |=== == Member Functions [cols=2] |=== | Name | Description | <> | Return the last segment | <> | Return an iterator to the beginning | <> | Return the referenced character buffer. | <> | Return true if there are no segments | <> | Return an iterator to the end | <> | Return the first segment | <> | Returns true if this references an absolute path. | <> | Assignment | <> [.small]#[constructor]# | Constructor | <> | Return the number of segments |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Description Objects of this type are used to interpret the path as a bidirectional view of segment strings. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- url_view u( "/path/to/file.txt" ); segments_view ps = u.segments(); assert( ps.buffer().data() == u.buffer().data() ); ---- Percent escapes in strings returned when dereferencing iterators are automatically decoded. === Iterator Invalidation Changes to the underlying character buffer can invalidate iterators which reference it. == See Also xref:#boost-urls-segments_encoded_view[segments_encoded_view], xref:#boost-urls-segments_encoded_ref[segments_encoded_ref], xref:#boost-urls-segments_ref[segments_ref]. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L188[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>& operator=(<> const& other) = default; ---- == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L62[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(/* implementation-defined */::path_ref const& ref) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>() = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>(<> const& other) = default; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># == Description Default‐constructed segments have zero elements. === Example [,cpp] ---- segments_view ps; ---- === Effects [,cpp] ---- return segments_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid path. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L87[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr segments_view() = default; ---- == Description Default‐constructed segments have zero elements. === Example [,cpp] ---- segments_view ps; ---- === Effects [,cpp] ---- return segments_view( "" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L111[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr segments_view(<> const& other) = default; ---- == Description After construction, viewss reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant === Exception Safety Throws nothing Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L163[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- segments_view(core::string_view s); ---- == Description This function constructs segments from a valid path string, which can contain percent escapes. Upon construction, the view references the character buffer pointed to by `s`. caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed. === Example [,cpp] ---- segments_view ps( "/path/to/file.txt" ); ---- === Effects [,cpp] ---- return parse_path( s ).value(); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- path = [ "/" ] [ segment *( "/" segment ) ] segment = *pchar ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path] Constructor This function constructs segments from a valid path string, which can contain percent escapes. Upon construction, the view references the character buffer pointed to by `s`. caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed. === Example [,cpp] ---- segments_view ps( "/path/to/file.txt" ); ---- === Effects [,cpp] ---- return parse_path( s ).value(); ---- === Postconditions [,cpp] ---- this->buffer().data() == s.data() ---- === Complexity Linear in `s`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- path = [ "/" ] [ segment *( "/" segment ) ] segment = *pchar ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid path. | `system_error` | `s` contains an invalid path. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *s* | The string to parse. |=== A modifiable container for a URL. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L106[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::size_t Capacity> class static_url : public <>; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the authority | <> | Return the url string | <> | Return the url as a null‐terminated string | <> | Return the number of characters that can be stored without reallocating | <> | Clear the contents while preserving the capacity | <> | Return the result of comparing this with another url | <> | Return a pointer to the url's character buffer | <> | Return true if the url is empty | <> | Return the authority. | <> | Return the fragment | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the origin | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return the query | <> | Return the resource | <> | Return the path as a container of segments | <> | Return the target | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> | Return the fragment | <> | Return true if an authority is present | <> | Return true if a fragment is present | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a query is present | <> | Return true a scheme is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Return true if the path is absolute | <> | Normalize the URL components | <> | Normalize the URL authority | <> | Normalize the URL fragment | <> | Normalize the URL path | <> | Normalize the URL query | <> | Normalize the URL scheme | <> | Return the URL as a core::string_view | <> | Assignment | <> | Return the query as a container of parameters xref:#boost-urls-url_view_base-params-05[url_view_base::params] | <> | Return the password | <> | Return the path | <> | Return a shared, persistent copy of the url | <> | Return the port | <> | Return the port | <> | Return the query | <> | Remove the authority | <> | Remove the fragment | <> | Remove the origin component | <> | Remove the password | <> | Remove the port | <> | Remove the query | <> | Remove the scheme | <> | Remove the userinfo | <> | Adjust the capacity without changing the size | <> | Resolve a URL reference against this base URL | <> | Return the scheme | <> | Return the scheme | <> | Return the path as a container of segments | <> | Set the authority | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set the query | <> | Set the user | <> | Set the userinfo. | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set if the path is absolute | <> | Set the port | <> | Set the port | <> | Set the query | <> | Set the scheme | <> | Set the scheme | <> | Set the user | <> | Set the userinfo | <> | Return the number of characters in the url | <> [.small]#[constructor]# | Constructor | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> [.small]#[destructor]# [.small]#[virtual]# | Destructor |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Format the url to the output stream | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Calculate a hash of the url |=== == Description This container owns a url, represented by an inline, null‐terminated character buffer with fixed capacity. The contents may be inspected and modified, and the implementation maintains a useful invariant: changes to the url always leave it in a valid state. === Example [,cpp] ---- static_url< 1024 > u( "https://www.example.com" ); ---- === Invariants [,cpp] ---- this->capacity() == Capacity + 1 ---- == Template Parameters |=== | Name | Description | *Capacity* | The maximum capacity in characters, not including the null terminator. |=== == See Also xref:#boost-urls-url[url], xref:#boost-urls-url_view[url_view]. Normalize the URL components == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L425[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize(); ---- == Description Applies Syntax‐based normalization to all components of the URL. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L429[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_authority(); ---- == Description Applies Syntax‐based normalization to the URL authority. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L435[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_fragment(); ---- == Description Applies Syntax‐based normalization to the URL fragment. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL path == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L431[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_path(); ---- == Description Applies Syntax‐based normalization to the URL path. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. Redundant path‐segments are removed. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L433[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_query(); ---- == Description Applies Syntax‐based normalization to the URL query. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L427[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_scheme(); ---- == Description Applies Syntax‐based normalization to the URL scheme. The scheme is normalized to lowercase. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L298[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& u); ---- [.small]#<># == Description The contents of `u` are copied and the previous contents of `this` are discarded. Capacity remains unchanged. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `system_error` | Capacity would be exceeded. |=== == Parameters |=== | Name | Description | *u* | The url to copy. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L298[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& u) noexcept; ---- == Description The contents of `u` are copied and the previous contents of `this` are discarded. Capacity remains unchanged. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *u* | The url to copy. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L330[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& u); ---- == Description The contents of `u` are copied and the previous contents of `this` are discarded. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Strong guarantee. Exception thrown if capacity exceeded. == Exceptions |=== | Name | Thrown on | `system_error` | Capacity would be exceeded. |=== == Parameters |=== | Name | Description | *u* | The url to copy. |=== Remove the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L354[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_authority(); ---- == Description This function removes the authority, which includes the userinfo, host, and a port if present. === Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" ); ---- === Postconditions [,cpp] ---- this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[ 3.2. Authority (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_authority[set_encoded_authority]. Remove the fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L415[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_fragment() noexcept; ---- == Description This function removes the fragment. An empty fragment is distinct from having no fragment. === Example [,cpp] ---- assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == false && this->encoded_fragment() == "" ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_encoded_fragment[set_encoded_fragment], xref:#boost-urls-url_base-set_fragment[set_fragment]. Remove the origin component == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L422[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_origin(); ---- == Description This function removes the origin, which consists of the scheme and authority. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" ); ---- === Postconditions [,cpp] ---- this->scheme_id() == scheme::none && this->has_authority() == false ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. Remove the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L371[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_password() noexcept; ---- == Description This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" ); ---- === Postconditions [,cpp] ---- this->has_password() == false && this->encoded_password().empty() == true ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_password[set_password], xref:#boost-urls-url_base-set_user[set_user]. Remove the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L396[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_port() noexcept; ---- == Description If a port exists, it is removed. The rest of the authority is unchanged. === Example [,cpp] ---- assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" ); ---- === Postconditions [,cpp] ---- this->has_port() == false && this->port_number() == 0 && this->port() == "" ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_base-set_port[set_port]. Remove the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L412[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_query() noexcept; ---- == Description If a query is present, it is removed. An empty query is distinct from having no query. === Example [,cpp] ---- assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" ); ---- === Postconditions [,cpp] ---- this->has_query() == false && this->params().empty() ---- === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Remove the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L349[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_scheme(); ---- == Description This function removes the scheme if it is present. === Example [,cpp] ---- assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" ); ---- === Postconditions [,cpp] ---- this->has_scheme() == false && this->scheme_id() == scheme::none ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == See Also xref:#boost-urls-url_base-set_scheme[set_scheme]. Remove the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L361[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_userinfo() noexcept; ---- == Description This function removes the userinfo if present, without removing any authority. === Example [,cpp] ---- assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false ); ---- === Postconditions [,cpp] ---- this->has_userinfo() == false && this->encoded_userinfo().empty == true ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_userinfo[set_encoded_userinfo], xref:#boost-urls-url_base-set_userinfo[set_userinfo]. Set the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L352[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_authority(<> s); ---- == Description This function sets the authority to the specified string. The string may contain percent‐escapes. === Example [,cpp] ---- assert( url().set_encoded_authority( "My%20Computer" ).has_authority() ); ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[ 3.2. Authority (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_eror` | The string contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The authority string to set. |=== == See Also xref:#boost-urls-url_base-remove_authority[remove_authority]. Set the fragment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L419[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_fragment(<> s); ---- == Description This function sets the fragment to the specified string, which may contain percent‐escapes and which may be empty. An empty fragment is distinct from having no fragment. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == true && this->fragment() == decode_view( s ) ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_fragment[set_fragment]. Set the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L376[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host(<> s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L380[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host_address(<> s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to a name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L390[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host_name(<> s); ---- == Description The host is set to the specified string, which may contain percent‐escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is xref:#boost-urls-host_type[host_type::name]. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the password. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L369[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_password(<> s); ---- == Description This function sets the password in the userinfo to the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" ); ---- === Postconditions [,cpp] ---- this->has_password() == true ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. This string may contain any characters, including nulls. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_user[set_user]. Set the path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L403[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_path(<> s); ---- == Description This function sets the path to the string, which may contain percent‐escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Set the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L408[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_query(<> s); ---- == Description This sets the query to the string, which may contain percent‐escapes and can be empty. An empty query is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == decode_view( s ); ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_query[set_query]. Set the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L365[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_user(<> s); ---- == Description This function sets the user part of the userinfo the the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_userinfo() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_password[set_password], xref:#boost-urls-url_base-set_user[set_user]. Set the userinfo. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L359[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_userinfo(<> s); ---- == Description The userinfo is set to the given string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The effects on the user and password depend on the presence of a colon (':') in the string: * If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise, * If there is no colon, the user is set to the string. The function has_password returns false. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_userinfo[remove_userinfo], xref:#boost-urls-url_base-set_userinfo[set_userinfo]. Set the fragment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L417[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_fragment(core::string_view s); ---- == Description This function sets the fragment to the specified string, which may be empty. An empty fragment is distinct from having no fragment. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == true && this->fragment() == s ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_encoded_fragment[set_encoded_fragment]. Set the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L374[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host(core::string_view s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L378[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_address(core::string_view s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L382[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipv4(<> const& addr); ---- == Description The host is set to the specified IPv4 address. The host type is xref:#boost-urls-host_type[host_type::ipv4]. === Example [,cpp] ---- assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" ); ---- === Complexity Linear in `this‐>size()`. === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4 ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *addr* | The address to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L384[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipv6(<> const& addr); ---- == Description The host is set to the specified IPv6 address. The host type is xref:#boost-urls-host_type[host_type::ipv6]. === Example [,cpp] ---- assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6 ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *addr* | The address to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L386[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipvfuture(core::string_view s); ---- == Description The host is set to the specified IPvFuture string. The host type is xref:#boost-urls-host_type[host_type::ipvfuture]. === Example [,cpp] ---- assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to a name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L388[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_name(core::string_view s); ---- == Description The host is set to the specified string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is xref:#boost-urls-host_type[host_type::name]. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture]. Set the query params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L410[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_params( std::initializer_list<<>> ps, <> opts = {}); ---- == Description This sets the query params to the list of param_view, which can be empty. An empty list of params is distinct from having no params. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === Complexity Linear. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986) @li >& set_password(core::string_view s); ---- == Description This function sets the password in the userinfo to the string. Reserved characters in the string are percent‐escaped in the result. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" ); ---- === Postconditions [,cpp] ---- this->has_password() == true && this->password() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. This string may contain any characters, including nulls. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_user[set_user]. Set the path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L401[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_path(core::string_view s); ---- == Description This function sets the path to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. [NOTE] This function does not encode '/' chars, which are unreserved for paths but reserved for path segments. If a path segment should include encoded '/'s to differentiate it from path separators, the functions xref:#boost-urls-url_base-set_encoded_path[set_encoded_path] or xref:#boost-urls-url_base-segments-04[segments] should be used instead. === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_path( "path/to/file.txt" ); assert( u.path() == "/path/to/file.txt" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Set the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L394[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_port(core::string_view s); ---- == Description This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n) ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` does not contain a valid port. |=== == Parameters |=== | Name | Description | *s* | The port string to set. |=== == See Also xref:#boost-urls-url_base-remove_port[remove_port], xref:#boost-urls-url_base-set_port[set_port]. Set the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L392[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_port_number(std::uint16_t n); ---- == Description The port is set to the specified integer. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_port() == true && this->port_number() == n ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Parameters |=== | Name | Description | *n* | The port number to set. |=== == See Also xref:#boost-urls-url_base-remove_port[remove_port], xref:#boost-urls-url_base-set_port[set_port]. Set the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L406[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_query(core::string_view s); ---- == Description This sets the query to the string, which can be empty. An empty query is distinct from having no query. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query]. Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L345[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_scheme(core::string_view s); ---- == Description The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case‐insensitive, and the canonical form is lowercased. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid scheme. |=== == Parameters |=== | Name | Description | *s* | The scheme to set. |=== == See Also xref:#boost-urls-url_base-remove_scheme[remove_scheme]. Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L347[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_scheme_id(<>::<> id); ---- == Description This function sets the scheme to the specified known xref:#boost-urls-scheme[urls::scheme] id, which may not be xref:#boost-urls-scheme[scheme::unknown] or else an exception is thrown. If the id is xref:#boost-urls-scheme[scheme::none], this function behaves as if xref:#boost-urls-url_base-remove_scheme[remove_scheme] were called. === Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).set_scheme_id( scheme::wss ).buffer() == "wss://example.com/echo.cgi" ); ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The scheme is invalid. |=== == Parameters |=== | Name | Description | *id* | The scheme to set. |=== Set the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L363[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_user(core::string_view s); ---- == Description This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent‐encoded. === Example [,cpp] ---- assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_userinfo() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_password[set_password]. Set the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L357[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_userinfo(core::string_view s); ---- == Description The userinfo is set to the given string, which may contain percent‐escapes. Any special or reserved characters in the string are automatically percent‐encoded. The effects on the user and password depend on the presence of a colon (':') in the string: * If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise, * If there is no colon, the user is set to the string. The function has_password returns false. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_userinfo[remove_userinfo], xref:#boost-urls-url_base-set_encoded_userinfo[set_encoded_userinfo]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L165[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& u); ---- [.small]#<># == Description Default constructed urls contain a zero‐length string. This matches the grammar for a relative‐ref with an empty path and no query or fragment. === Example [,cpp] ---- static_url< 1024 > u; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The input does not contain a valid url. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *u* | The url to copy. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L165[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static_url() noexcept; ---- == Description Default constructed urls contain a zero‐length string. This matches the grammar for a relative‐ref with an empty path and no query or fragment. === Example [,cpp] ---- static_url< 1024 > u; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L217[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit static_url(core::string_view s); ---- == Description This function constructs a url from the string `s`, which must contain a valid _URI_ or _relative‐ref_ or else an exception is thrown. The new url retains ownership by making a copy of the passed string. === Example [,cpp] ---- static_url< 1024 > u( "https://www.example.com" ); ---- === Effects [,cpp] ---- return static_url( parse_uri_reference( s ).value() ); ---- === Postconditions [,cpp] ---- this->buffer().data() != s.data() ---- === Complexity Linear in `s.size()`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference] == Exceptions |=== | Name | Thrown on | `system_error` | The input does not contain a valid url. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L243[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static_url(<> const& u) noexcept; ---- == Description The newly constructed object contains a copy of `u`. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer.data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Exception thrown if maximum size exceeded. == Parameters |=== | Name | Description | *u* | The url to copy. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L271[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static_url(<> const& u); ---- == Description The newly constructed object contains a copy of `u`. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer.data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Exception thrown if capacity exceeded. == Exceptions |=== | Name | Thrown on | `system_error` | Capacity would be exceeded. |=== == Parameters |=== | Name | Description | *u* | The url to copy. |=== Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L130[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- virtual ~static_url() = default; ---- == Description Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it. Common implementation for all static URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L52[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class static_url_base : public <>; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the authority | <> | Return the url string | <> | Return the url as a null‐terminated string | <> | Return the number of characters that can be stored without reallocating | <> | Clear the contents while preserving the capacity | <> | Return the result of comparing this with another url | <> | Return a pointer to the url's character buffer | <> | Return true if the url is empty | <> | Return the authority. | <> | Return the fragment | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the origin | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return the query | <> | Return the resource | <> | Return the path as a container of segments | <> | Return the target | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> | Return the fragment | <> | Return true if an authority is present | <> | Return true if a fragment is present | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a query is present | <> | Return true a scheme is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Return true if the path is absolute | <> | Normalize the URL components | <> | Normalize the URL authority | <> | Normalize the URL fragment | <> | Normalize the URL path | <> | Normalize the URL query | <> | Normalize the URL scheme | <> | Return the URL as a core::string_view | <> | Return the query as a container of parameters xref:#boost-urls-url_view_base-params-05[url_view_base::params] | <> | Return the password | <> | Return the path | <> | Return a shared, persistent copy of the url | <> | Return the port | <> | Return the port | <> | Return the query | <> | Remove the authority | <> | Remove the fragment | <> | Remove the origin component | <> | Remove the password | <> | Remove the port | <> | Remove the query | <> | Remove the scheme | <> | Remove the userinfo | <> | Adjust the capacity without changing the size | <> | Resolve a URL reference against this base URL | <> | Return the scheme | <> | Return the scheme | <> | Return the path as a container of segments | <> | Set the authority | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set the query | <> | Set the user | <> | Set the userinfo. | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set if the path is absolute | <> | Set the port | <> | Set the port | <> | Set the query | <> | Set the scheme | <> | Set the scheme | <> | Set the user | <> | Set the userinfo | <> | Return the number of characters in the url | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Format the url to the output stream | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Calculate a hash of the url |=== == Description This base class is used by the library to provide common functionality for static URLs. Users should not use this class directly. Instead, construct an instance of one of the containers or call a parsing function. === Containers * url * url_view * static_url === Parsing Functions * parse_absolute_uri * parse_origin_form * parse_relative_ref * parse_uri * parse_uri_reference Common implementation for all static URLs This base class is used by the library to provide common functionality for static URLs. Users should not use this class directly. Instead, construct an instance of one of the containers or call a parsing function. === Containers * url * url_view * static_url === Parsing Functions * parse_absolute_uri * parse_origin_form * parse_relative_ref * parse_uri * parse_uri_reference == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L60[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( char* buf, std::size_t cap) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>( char* buf, std::size_t cap, core::string_view s); ---- [.small]#<># A modifiable container for a URL. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L63[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class url : public <>; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the authority | <> | Return the url string | <> | Return the url as a null‐terminated string | <> | Return the number of characters that can be stored without reallocating | <> | Clear the contents while preserving the capacity | <> | Return the result of comparing this with another url | <> | Return a pointer to the url's character buffer | <> | Return true if the url is empty | <> | Return the authority. | <> | Return the fragment | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the origin | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return the query | <> | Return the resource | <> | Return the path as a container of segments | <> | Return the target | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> | Return the fragment | <> | Return true if an authority is present | <> | Return true if a fragment is present | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a query is present | <> | Return true a scheme is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Return true if the path is absolute | <> | Normalize the URL components | <> | Normalize the URL authority | <> | Normalize the URL fragment | <> | Normalize the URL path | <> | Normalize the URL query | <> | Normalize the URL scheme | <> | Return the URL as a core::string_view | <> | Assignment | <> | Return the query as a container of parameters xref:#boost-urls-url_view_base-params-05[url_view_base::params] | <> | Return the password | <> | Return the path | <> | Return a shared, persistent copy of the url | <> | Return the port | <> | Return the port | <> | Return the query | <> | Remove the authority | <> | Remove the fragment | <> | Remove the origin component | <> | Remove the password | <> | Remove the port | <> | Remove the query | <> | Remove the scheme | <> | Remove the userinfo | <> | Adjust the capacity without changing the size | <> | Resolve a URL reference against this base URL | <> | Return the scheme | <> | Return the scheme | <> | Return the path as a container of segments | <> | Set the authority | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set the query | <> | Set the user | <> | Set the userinfo. | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set if the path is absolute | <> | Set the port | <> | Set the port | <> | Set the query | <> | Set the scheme | <> | Set the scheme | <> | Set the user | <> | Set the userinfo | <> | Return the number of characters in the url | <> | Swap the contents. | <> [.small]#[constructor]# | Constructor | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> [.small]#[destructor]# [.small]#[virtual]# | Destructor |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Format the url to the output stream | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | | <> | Swap |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Calculate a hash of the url |=== == Description This container owns a url, represented by a null‐terminated character buffer which is managed by performing dymamic memory allocations as needed. The contents may be inspected and modified, and the implementation maintains a useful invariant: changes to the url always leave it in a valid state. === Exception Safety * Functions marked `noexcept` provide the no‐throw guarantee, otherwise: * Functions which throw offer the strong exception safety guarantee. === BNF [,cpp] ---- URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Specification * link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI): Generic Syntax (rfc3986)] A modifiable container for a URL. This container owns a url, represented by a null‐terminated character buffer which is managed by performing dymamic memory allocations as needed. The contents may be inspected and modified, and the implementation maintains a useful invariant: changes to the url always leave it in a valid state. === Exception Safety * Functions marked `noexcept` provide the no‐throw guarantee, otherwise: * Functions which throw offer the strong exception safety guarantee. === BNF [,cpp] ---- URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Specification * link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI): Generic Syntax (rfc3986)] == See Also xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_base-08friend[resolve]. xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_base-08friend[resolve]. Normalize the URL components == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L492[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize(); ---- == Description Applies Syntax‐based normalization to all components of the URL. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L496[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_authority(); ---- == Description Applies Syntax‐based normalization to the URL authority. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L502[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_fragment(); ---- == Description Applies Syntax‐based normalization to the URL fragment. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL path == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L498[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_path(); ---- == Description Applies Syntax‐based normalization to the URL path. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. Redundant path‐segments are removed. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L500[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_query(); ---- == Description Applies Syntax‐based normalization to the URL query. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L494[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_scheme(); ---- == Description Applies Syntax‐based normalization to the URL scheme. The scheme is normalized to lowercase. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L271[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<>&& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& u); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& u); ---- [.small]#<># == Description The contents of `u` are transferred to `this`, including the underlying character buffer. The previous contents of `this` are destroyed. After assignment, the moved‐from object is as if default constructed. === Postconditions [,cpp] ---- u.empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. == Exceptions |=== | Name | Thrown on | `std::length_error` | `u.size() > max_size()`. |=== == Parameters |=== | Name | Description | *u* | The url to assign from. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L271[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<>&& u) noexcept; ---- == Description The contents of `u` are transferred to `this`, including the underlying character buffer. The previous contents of `this` are destroyed. After assignment, the moved‐from object is as if default constructed. === Postconditions [,cpp] ---- u.empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *u* | The url to assign from. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L297[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& u); ---- == Description The contents of `u` are copied and the previous contents of `this` are destroyed. Capacity is preserved, or increases. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `std::length_error` | `u.size() > max_size()`. |=== == Parameters |=== | Name | Description | *u* | The url to copy. |=== Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L326[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& u); ---- == Description The contents of `u` are copied and the previous contents of `this` are destroyed. Capacity is preserved, or increases. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Parameters |=== | Name | Description | *u* | The url to copy. |=== Remove the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L419[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_authority(); ---- == Description This function removes the authority, which includes the userinfo, host, and a port if present. === Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" ); ---- === Postconditions [,cpp] ---- this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[ 3.2. Authority (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_authority[set_encoded_authority]. Remove the fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L482[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_fragment() noexcept; ---- == Description This function removes the fragment. An empty fragment is distinct from having no fragment. === Example [,cpp] ---- assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == false && this->encoded_fragment() == "" ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_encoded_fragment[set_encoded_fragment], xref:#boost-urls-url_base-set_fragment[set_fragment]. Remove the origin component == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L489[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_origin(); ---- == Description This function removes the origin, which consists of the scheme and authority. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" ); ---- === Postconditions [,cpp] ---- this->scheme_id() == scheme::none && this->has_authority() == false ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. Remove the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L436[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_password() noexcept; ---- == Description This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" ); ---- === Postconditions [,cpp] ---- this->has_password() == false && this->encoded_password().empty() == true ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_password[set_password], xref:#boost-urls-url_base-set_user[set_user]. Remove the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L461[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_port() noexcept; ---- == Description If a port exists, it is removed. The rest of the authority is unchanged. === Example [,cpp] ---- assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" ); ---- === Postconditions [,cpp] ---- this->has_port() == false && this->port_number() == 0 && this->port() == "" ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_base-set_port[set_port]. Remove the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L479[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_query() noexcept; ---- == Description If a query is present, it is removed. An empty query is distinct from having no query. === Example [,cpp] ---- assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" ); ---- === Postconditions [,cpp] ---- this->has_query() == false && this->params().empty() ---- === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Remove the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L414[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_scheme(); ---- == Description This function removes the scheme if it is present. === Example [,cpp] ---- assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" ); ---- === Postconditions [,cpp] ---- this->has_scheme() == false && this->scheme_id() == scheme::none ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == See Also xref:#boost-urls-url_base-set_scheme[set_scheme]. Remove the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L426[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_userinfo() noexcept; ---- == Description This function removes the userinfo if present, without removing any authority. === Example [,cpp] ---- assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false ); ---- === Postconditions [,cpp] ---- this->has_userinfo() == false && this->encoded_userinfo().empty == true ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_userinfo[set_encoded_userinfo], xref:#boost-urls-url_base-set_userinfo[set_userinfo]. Set the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L417[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_authority(<> s); ---- == Description This function sets the authority to the specified string. The string may contain percent‐escapes. === Example [,cpp] ---- assert( url().set_encoded_authority( "My%20Computer" ).has_authority() ); ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[ 3.2. Authority (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_eror` | The string contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The authority string to set. |=== == See Also xref:#boost-urls-url_base-remove_authority[remove_authority]. Set the fragment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L486[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_fragment(<> s); ---- == Description This function sets the fragment to the specified string, which may contain percent‐escapes and which may be empty. An empty fragment is distinct from having no fragment. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == true && this->fragment() == decode_view( s ) ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_fragment[set_fragment]. Set the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L441[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host(<> s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L445[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host_address(<> s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to a name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L455[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host_name(<> s); ---- == Description The host is set to the specified string, which may contain percent‐escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is xref:#boost-urls-host_type[host_type::name]. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the query params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L477[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_params(std::initializer_list<<>> ps); ---- == Description This sets the query params to the elements in the list, which may contain percent‐escapes and can be empty. An empty list of params is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_params( {"id", "42"} ).encoded_query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true ---- === Complexity Linear. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Exceptions |=== | Name | Thrown on | `system_error` | some element in `ps` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *ps* | The params to set. |=== == See Also xref:#boost-urls-url_base-set_params[set_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Set the password. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L434[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_password(<> s); ---- == Description This function sets the password in the userinfo to the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" ); ---- === Postconditions [,cpp] ---- this->has_password() == true ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. This string may contain any characters, including nulls. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_user[set_user]. Set the path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L468[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_path(<> s); ---- == Description This function sets the path to the string, which may contain percent‐escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Set the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L473[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_query(<> s); ---- == Description This sets the query to the string, which may contain percent‐escapes and can be empty. An empty query is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == decode_view( s ); ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_query[set_query]. Set the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L430[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_user(<> s); ---- == Description This function sets the user part of the userinfo the the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_userinfo() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_password[set_password], xref:#boost-urls-url_base-set_user[set_user]. Set the userinfo. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L424[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_userinfo(<> s); ---- == Description The userinfo is set to the given string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The effects on the user and password depend on the presence of a colon (':') in the string: * If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise, * If there is no colon, the user is set to the string. The function has_password returns false. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_userinfo[remove_userinfo], xref:#boost-urls-url_base-set_userinfo[set_userinfo]. Set the fragment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L484[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_fragment(core::string_view s); ---- == Description This function sets the fragment to the specified string, which may be empty. An empty fragment is distinct from having no fragment. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == true && this->fragment() == s ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_encoded_fragment[set_encoded_fragment]. Set the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L439[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host(core::string_view s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L443[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_address(core::string_view s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L447[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipv4(<> const& addr); ---- == Description The host is set to the specified IPv4 address. The host type is xref:#boost-urls-host_type[host_type::ipv4]. === Example [,cpp] ---- assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" ); ---- === Complexity Linear in `this‐>size()`. === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4 ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *addr* | The address to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L449[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipv6(<> const& addr); ---- == Description The host is set to the specified IPv6 address. The host type is xref:#boost-urls-host_type[host_type::ipv6]. === Example [,cpp] ---- assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6 ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *addr* | The address to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L451[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipvfuture(core::string_view s); ---- == Description The host is set to the specified IPvFuture string. The host type is xref:#boost-urls-host_type[host_type::ipvfuture]. === Example [,cpp] ---- assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to a name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L453[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_name(core::string_view s); ---- == Description The host is set to the specified string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is xref:#boost-urls-host_type[host_type::name]. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture]. Set the query params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L475[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_params( std::initializer_list<<>> ps, <> opts = {}); ---- == Description This sets the query params to the list of param_view, which can be empty. An empty list of params is distinct from having no params. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === Complexity Linear. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986) @li >& set_password(core::string_view s); ---- == Description This function sets the password in the userinfo to the string. Reserved characters in the string are percent‐escaped in the result. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" ); ---- === Postconditions [,cpp] ---- this->has_password() == true && this->password() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. This string may contain any characters, including nulls. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_user[set_user]. Set the path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L466[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_path(core::string_view s); ---- == Description This function sets the path to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. [NOTE] This function does not encode '/' chars, which are unreserved for paths but reserved for path segments. If a path segment should include encoded '/'s to differentiate it from path separators, the functions xref:#boost-urls-url_base-set_encoded_path[set_encoded_path] or xref:#boost-urls-url_base-segments-04[segments] should be used instead. === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_path( "path/to/file.txt" ); assert( u.path() == "/path/to/file.txt" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Set the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L459[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_port(core::string_view s); ---- == Description This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n) ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` does not contain a valid port. |=== == Parameters |=== | Name | Description | *s* | The port string to set. |=== == See Also xref:#boost-urls-url_base-remove_port[remove_port], xref:#boost-urls-url_base-set_port[set_port]. Set the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L457[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_port_number(std::uint16_t n); ---- == Description The port is set to the specified integer. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_port() == true && this->port_number() == n ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Parameters |=== | Name | Description | *n* | The port number to set. |=== == See Also xref:#boost-urls-url_base-remove_port[remove_port], xref:#boost-urls-url_base-set_port[set_port]. Set the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L471[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_query(core::string_view s); ---- == Description This sets the query to the string, which can be empty. An empty query is distinct from having no query. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query]. Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L410[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_scheme(core::string_view s); ---- == Description The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case‐insensitive, and the canonical form is lowercased. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid scheme. |=== == Parameters |=== | Name | Description | *s* | The scheme to set. |=== == See Also xref:#boost-urls-url_base-remove_scheme[remove_scheme]. Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L412[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_scheme_id(<>::<> id); ---- == Description This function sets the scheme to the specified known xref:#boost-urls-scheme[urls::scheme] id, which may not be xref:#boost-urls-scheme[scheme::unknown] or else an exception is thrown. If the id is xref:#boost-urls-scheme[scheme::none], this function behaves as if xref:#boost-urls-url_base-remove_scheme[remove_scheme] were called. === Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).set_scheme_id( scheme::wss ).buffer() == "wss://example.com/echo.cgi" ); ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The scheme is invalid. |=== == Parameters |=== | Name | Description | *id* | The scheme to set. |=== Set the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L428[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_user(core::string_view s); ---- == Description This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent‐encoded. === Example [,cpp] ---- assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_userinfo() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_password[set_password]. Set the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L422[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_userinfo(core::string_view s); ---- == Description The userinfo is set to the given string, which may contain percent‐escapes. Any special or reserved characters in the string are automatically percent‐encoded. The effects on the user and password depend on the presence of a colon (':') in the string: * If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise, * If there is no colon, the user is set to the string. The function has_password returns false. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_userinfo[remove_userinfo], xref:#boost-urls-url_base-set_encoded_userinfo[set_encoded_userinfo]. Swap the contents. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L360[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void <>(<>& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend void swap( <>& v0, <>& v1) noexcept; ---- [.small]#<># == Description Exchanges the contents of this url with another url. All views, iterators and references remain valid. If `this == &other`, this function call has no effect. === Example [,cpp] ---- url u1( "https://www.example.com" ); url u2( "https://www.boost.org" ); u1.swap(u2); assert(u1 == "https://www.boost.org" ); assert(u2 == "https://www.example.com" ); ---- === Complexity Constant === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The object to swap with | *v0* | The first object to swap | *v1* | The second object to swap |=== Swap the contents. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L360[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void swap(<>& other) noexcept; ---- == Description Exchanges the contents of this url with another url. All views, iterators and references remain valid. If `this == &other`, this function call has no effect. === Example [,cpp] ---- url u1( "https://www.example.com" ); url u2( "https://www.boost.org" ); u1.swap(u2); assert(u1 == "https://www.boost.org" ); assert(u2 == "https://www.example.com" ); ---- === Complexity Constant === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *other* | The object to swap with |=== Swap == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L397[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend void swap( <>& v0, <>& v1) noexcept; ---- == Description Exchanges the contents of `v0` with another `v1`. All views, iterators and references remain valid. If `&v0 == &v1`, this function call has no effect. === Example [,cpp] ---- url u1( "https://www.example.com" ); url u2( "https://www.boost.org" ); std::swap(u1, u2); assert(u1 == "https://www.boost.org" ); assert(u2 == "https://www.example.com" ); ---- === Effects [,cpp] ---- v0.swap( v1 ); ---- === Complexity Constant === Exception Safety Throws nothing == Parameters |=== | Name | Description | *v0* | The first object to swap | *v1* | The second object to swap |=== == See Also xref:#boost-urls-url-swap[url::swap] Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L120[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<>&& u) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& u); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& u); ---- [.small]#<># == Description Default constructed urls contain a zero‐length string. This matches the grammar for a relative‐ref with an empty path and no query or fragment. === Example [,cpp] ---- url u; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The input does not contain a valid url. | `std::length_error` | `u.size() > max_size()`. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *u* | The url to move from. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L120[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url() noexcept; ---- == Description Default constructed urls contain a zero‐length string. This matches the grammar for a relative‐ref with an empty path and no query or fragment. === Example [,cpp] ---- url u; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L169[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit url(core::string_view s); ---- == Description This function constructs a URL from the string `s`, which must contain a valid _URI_ or _relative‐ref_ or else an exception is thrown. The new url retains ownership by allocating a copy of the passed string. === Example [,cpp] ---- url u( "https://www.example.com" ); ---- === Effects [,cpp] ---- return url( parse_uri_reference( s ).value() ); ---- === Postconditions [,cpp] ---- this->buffer().data() != s.data() ---- === Complexity Linear in `s.size()`. === Exception Safety Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference] Constructor This function constructs a URL from the string `s`, which must contain a valid _URI_ or _relative‐ref_ or else an exception is thrown. The new url retains ownership by allocating a copy of the passed string. === Example [,cpp] ---- url u( "https://www.example.com" ); ---- === Effects [,cpp] ---- return url( parse_uri_reference( s ).value() ); ---- === Postconditions [,cpp] ---- this->buffer().data() != s.data() ---- === Complexity Linear in `s.size()`. === Exception Safety Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference] == Exceptions |=== | Name | Thrown on | `system_error` | The input does not contain a valid url. | `system_error` | The input does not contain a valid url. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L194[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url(<>&& u) noexcept; ---- == Description The contents of `u` are transferred to the newly constructed object, which includes the underlying character buffer. After construction, the moved‐from object is as if default constructed. === Postconditions [,cpp] ---- u.empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *u* | The url to move from. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L217[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url(<> const& u); ---- == Description The newly constructed object contains a copy of `u`. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `std::length_error` | `u.size() > max_size()`. |=== == Parameters |=== | Name | Description | *u* | The url to copy. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L243[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url(<> const& u); ---- == Description The newly constructed object contains a copy of `u`. === Postconditions [,cpp] ---- this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data() ---- === Complexity Linear in `u.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `std::length_error` | `u.size() > max_size()`. |=== == Parameters |=== | Name | Description | *u* | The url to copy. |=== Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L85[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- virtual ~url(); ---- == Description Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it. Common functionality for containers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L63[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class url_base : public <>; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the authority | <> | Return the url string | <> | Return the url as a null‐terminated string | <> | Return the number of characters that can be stored without reallocating | <> | Clear the contents while preserving the capacity | <> | Return the result of comparing this with another url | <> | Return a pointer to the url's character buffer | <> | Return true if the url is empty | <> | Return the authority. | <> | Return the fragment | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the origin | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return the query | <> | Return the resource | <> | Return the path as a container of segments | <> | Return the target | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> | Return the fragment | <> | Return true if an authority is present | <> | Return true if a fragment is present | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a query is present | <> | Return true a scheme is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Return true if the path is absolute | <> | Normalize the URL components | <> | Normalize the URL authority | <> | Normalize the URL fragment | <> | Normalize the URL path | <> | Normalize the URL query | <> | Normalize the URL scheme | <> | Return the URL as a core::string_view | <> | Return the query as a container of parameters xref:#boost-urls-url_view_base-params-05[url_view_base::params] | <> | Return the password | <> | Return the path | <> | Return a shared, persistent copy of the url | <> | Return the port | <> | Return the port | <> | Return the query | <> | Remove the authority | <> | Remove the fragment | <> | Remove the origin component | <> | Remove the password | <> | Remove the port | <> | Remove the query | <> | Remove the scheme | <> | Remove the userinfo | <> | Adjust the capacity without changing the size | <> | Resolve a URL reference against this base URL | <> | Return the scheme | <> | Return the scheme | <> | Return the path as a container of segments | <> | Set the authority | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set the query | <> | Set the user | <> | Set the userinfo. | <> | Set the fragment. | <> | Set the host | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to an address | <> | Set the host to a name | <> | Set the query params | <> | Set the password. | <> | Set the path. | <> | Set if the path is absolute | <> | Set the port | <> | Set the port | <> | Set the query | <> | Set the scheme | <> | Set the scheme | <> | Set the user | <> | Set the userinfo | <> | Return the number of characters in the url | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Format the url to the output stream | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Calculate a hash of the url |=== == Description This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * url * url_view * static_url === Functions * parse_absolute_uri * parse_origin_form * parse_relative_ref * parse_uri * parse_uri_reference Return the url as a null‐terminated string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L130[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char const* c_str() const noexcept; ---- == Description This function returns a pointer to a null terminated string representing the url, which may contain percent escapes. === Example [,cpp] ---- assert( std::strlen( url( "http://www.example.com" ).c_str() ) == 22 ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return the number of characters that can be stored without reallocating == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L147[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t capacity() const noexcept; ---- == Description This does not include the null terminator, which is always present. === Complexity Constant. === Exception Safety Throws nothing. Clear the contents while preserving the capacity == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L166[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void clear() noexcept; ---- == Description === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety No‐throw guarantee. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2174[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() noexcept; ---- [.small]#<># == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query as a container of parameters This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2174[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_params() const noexcept; ---- == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query as a container of parameters This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2224[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_params() noexcept; ---- == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- params_encoded_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1946[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() const noexcept; ---- [.small]#<># == Description This function returns a bidirectional view of segments over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- url u( "http://example.com/path/to/file.txt" ); segments_encoded_ref sv = u.encoded_segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1946[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_segments() noexcept; ---- == Description This function returns a bidirectional view of segments over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- url u( "http://example.com/path/to/file.txt" ); segments_encoded_ref sv = u.encoded_segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1950[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_segments() const noexcept; ---- == Description This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return the path as a container of segments This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments], xref:#boost-urls-segments_encoded_view[segments_encoded_view]. xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments], xref:#boost-urls-segments_encoded_view[segments_encoded_view]. Normalize the URL components == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2576[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize(); ---- == Description Applies Syntax‐based normalization to all components of the URL. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2617[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_authority(); ---- == Description Applies Syntax‐based normalization to the URL authority. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2684[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_fragment(); ---- == Description Applies Syntax‐based normalization to the URL fragment. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL path == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2640[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_path(); ---- == Description Applies Syntax‐based normalization to the URL path. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. Redundant path‐segments are removed. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2662[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_query(); ---- == Description Applies Syntax‐based normalization to the URL query. Percent‐encoding triplets are normalized to uppercase letters. Percent‐encoded octets that correspond to unreserved characters are decoded. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Normalize the URL scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2595[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& normalize_scheme(); ---- == Description Applies Syntax‐based normalization to the URL scheme. The scheme is normalized to lowercase. === Exception Safety Strong guarantee. Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2110[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> opt) noexcept; ---- [.small]#<># == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- params_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Parameters |=== | Name | Description | *opt* | The options for decoding. If this parameter is omitted, the `space_as_plus` is used. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2110[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> params() noexcept; ---- == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- params_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. xref:#boost-urls-url_view_base-params-05[url_view_base::params] == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2114[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> params() const noexcept; ---- Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2170[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> params(<> opt) noexcept; ---- == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- encoding_opts opt; opt.space_as_plus = true; params_ref pv = url( "/sql?id=42&name=jane+doe&page+size=20" ).params(opt); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Parameters |=== | Name | Description | *opt* | The options for decoding. If this parameter is omitted, the `space_as_plus` is used. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Remove the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L437[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_authority(); ---- == Description This function removes the authority, which includes the userinfo, host, and a port if present. === Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" ); ---- === Postconditions [,cpp] ---- this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[ 3.2. Authority (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_authority[set_encoded_authority]. Remove the fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2427[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_fragment() noexcept; ---- == Description This function removes the fragment. An empty fragment is distinct from having no fragment. === Example [,cpp] ---- assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == false && this->encoded_fragment() == "" ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_encoded_fragment[set_encoded_fragment], xref:#boost-urls-url_base-set_fragment[set_fragment]. Remove the origin component == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2553[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_origin(); ---- == Description This function removes the origin, which consists of the scheme and authority. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" ); ---- === Postconditions [,cpp] ---- this->scheme_id() == scheme::none && this->has_authority() == false ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. Remove the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L872[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_password() noexcept; ---- == Description This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" ); ---- === Postconditions [,cpp] ---- this->has_password() == false && this->encoded_password().empty() == true ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_password[set_password], xref:#boost-urls-url_base-set_user[set_user]. Remove the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1637[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_port() noexcept; ---- == Description If a port exists, it is removed. The rest of the authority is unchanged. === Example [,cpp] ---- assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" ); ---- === Postconditions [,cpp] ---- this->has_port() == false && this->port_number() == 0 && this->port() == "" ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_base-set_port[set_port]. Remove the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2382[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_query() noexcept; ---- == Description If a query is present, it is removed. An empty query is distinct from having no query. === Example [,cpp] ---- assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" ); ---- === Postconditions [,cpp] ---- this->has_query() == false && this->params().empty() ---- === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Remove the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L350[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_scheme(); ---- == Description This function removes the scheme if it is present. === Example [,cpp] ---- assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" ); ---- === Postconditions [,cpp] ---- this->has_scheme() == false && this->scheme_id() == scheme::none ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == See Also xref:#boost-urls-url_base-set_scheme[set_scheme]. Remove the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L610[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& remove_userinfo() noexcept; ---- == Description This function removes the userinfo if present, without removing any authority. === Example [,cpp] ---- assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false ); ---- === Postconditions [,cpp] ---- this->has_userinfo() == false && this->encoded_userinfo().empty == true ---- === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_base-set_encoded_userinfo[set_encoded_userinfo], xref:#boost-urls-url_base-set_userinfo[set_userinfo]. Adjust the capacity without changing the size == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L188[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void reserve(std::size_t n); ---- == Description This function adjusts the capacity of the container in characters, without affecting the current contents. Has no effect if `n <= this‐>capacity()`. === Exception Safety Strong guarantee. Calls to allocate may throw. == Exceptions |=== | Name | Thrown on | `bad_alloc` | Allocation failure |=== == Parameters |=== | Name | Description | *n* | The capacity in characters, excluding any null terminator. |=== Resolve a URL reference against this base URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2784[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<void> <>(<> const& ref); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend system::result<void> resolve( <> const& base, <> const& ref, <>& dest); ---- [.small]#<># == Description This function attempts to resolve a URL reference `ref` against this base URL in a manner similar to that of a web browser resolving an anchor tag. This URL must satisfy the _URI_ grammar. In other words, it must contain a scheme. Relative references are only usable when in the context of a base absolute URI. This process of resolving a relative _reference_ within the context of a _base_ URI is defined in detail in rfc3986 (see below). The resolution process works as if the relative reference is appended to the base URI and the result is normalized. Given the input base URL, this function resolves the relative reference as if performing the following steps: * Ensure the base URI has at least a scheme * Normalizing the reference path * Merge base and reference paths * Normalize the merged path This function places the result of the resolution into this URL in place. If an error occurs, the contents of this URL are unspecified and a result with an `system::error_code` is returned. [NOTE] Abnormal hrefs where the number of ".." segments exceeds the number of segments in the base path are handled by including the unmatched ".." segments in the result, as described in link:https://www.rfc-editor.org/errata/eid4547[Errata 4547]. === Example [,cpp] ---- url base1( "/one/two/three" ); base1.resolve("four"); assert( base1.buffer() == "/one/two/four" ); url base2( "http://example.com/" ) base2.resolve("/one"); assert( base2.buffer() == "http://example.com/one" ); url base3( "http://example.com/one" ); base3.resolve("/two"); assert( base3.buffer() == "http://example.com/two" ); url base4( "http://a/b/c/d;p?q" ); base4.resolve("g#s"); assert( base4.buffer() == "http://a/b/c/g#s" ); ---- === BNF [,cpp] ---- absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Exception Safety Basic guarantee. Calls to allocate may throw. === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-5[5. Reference Resolution (rfc3986)] == Return Value An empty result upon success, otherwise an error code if `!base.has_scheme()`. == Parameters |=== | Name | Description | *ref* | The URL reference to resolve. |=== == See Also xref:#boost-urls-url[url], xref:#boost-urls-url_view[url_view]. Resolve a URL reference against this base URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2784[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<void> resolve(<> const& ref); ---- == Description This function attempts to resolve a URL reference `ref` against this base URL in a manner similar to that of a web browser resolving an anchor tag. This URL must satisfy the _URI_ grammar. In other words, it must contain a scheme. Relative references are only usable when in the context of a base absolute URI. This process of resolving a relative _reference_ within the context of a _base_ URI is defined in detail in rfc3986 (see below). The resolution process works as if the relative reference is appended to the base URI and the result is normalized. Given the input base URL, this function resolves the relative reference as if performing the following steps: * Ensure the base URI has at least a scheme * Normalizing the reference path * Merge base and reference paths * Normalize the merged path This function places the result of the resolution into this URL in place. If an error occurs, the contents of this URL are unspecified and a result with an `system::error_code` is returned. [NOTE] Abnormal hrefs where the number of ".." segments exceeds the number of segments in the base path are handled by including the unmatched ".." segments in the result, as described in link:https://www.rfc-editor.org/errata/eid4547[Errata 4547]. === Example [,cpp] ---- url base1( "/one/two/three" ); base1.resolve("four"); assert( base1.buffer() == "/one/two/four" ); url base2( "http://example.com/" ) base2.resolve("/one"); assert( base2.buffer() == "http://example.com/one" ); url base3( "http://example.com/one" ); base3.resolve("/two"); assert( base3.buffer() == "http://example.com/two" ); url base4( "http://a/b/c/d;p?q" ); base4.resolve("g#s"); assert( base4.buffer() == "http://a/b/c/g#s" ); ---- === BNF [,cpp] ---- absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Exception Safety Basic guarantee. Calls to allocate may throw. === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-5[5. Reference Resolution (rfc3986)] == Return Value An empty result upon success, otherwise an error code if `!base.has_scheme()`. == Parameters |=== | Name | Description | *ref* | The URL reference to resolve. |=== == See Also xref:#boost-urls-url[url], xref:#boost-urls-url_view[url_view]. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2788[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend system::result<void> resolve( <> const& base, <> const& ref, <>& dest); ---- Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1885[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>::<> <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() const noexcept; ---- [.small]#<># == Description This function returns a bidirectional view of segments over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- url u( "http://example.com/path/to/file.txt" ); segments sv = u.segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1885[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>::<> segments() noexcept; ---- == Description This function returns a bidirectional view of segments over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL. === Example [,cpp] ---- url u( "http://example.com/path/to/file.txt" ); segments sv = u.segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1889[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> segments() const noexcept; ---- == Description This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- segments_view sv = url_view( "/path/to/file.txt" ).segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = [ "/" ] segment *( "/" segment ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return the path as a container of segments This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- segments_view sv = url_view( "/path/to/file.txt" ).segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = [ "/" ] segment *( "/" segment ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-segments_view[segments_view]. xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-segments_view[segments_view]. Set the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L395[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_authority(<> s); ---- == Description This function sets the authority to the specified string. The string may contain percent‐escapes. === Example [,cpp] ---- assert( url().set_encoded_authority( "My%20Computer" ).has_authority() ); ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[ 3.2. Authority (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_eror` | The string contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The authority string to set. |=== == See Also xref:#boost-urls-url_base-remove_authority[remove_authority]. Set the fragment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2522[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_fragment(<> s); ---- == Description This function sets the fragment to the specified string, which may contain percent‐escapes and which may be empty. An empty fragment is distinct from having no fragment. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == true && this->fragment() == decode_view( s ) ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_fragment[set_fragment]. Set the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1039[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host(<> s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1240[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host_address(<> s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to a name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1512[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_host_name(<> s); ---- == Description The host is set to the specified string, which may contain percent‐escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The host type is xref:#boost-urls-host_type[host_type::name]. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the query params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2340[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_params(std::initializer_list<<>> ps) noexcept; ---- == Description This sets the query params to the elements in the list, which may contain percent‐escapes and can be empty. An empty list of params is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_params( {"id", "42"} ).encoded_query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true ---- === Complexity Linear. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Exceptions |=== | Name | Thrown on | `system_error` | some element in `ps` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *ps* | The params to set. |=== == See Also xref:#boost-urls-url_base-set_params[set_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query], xref:#boost-urls-url_base-set_query[set_query]. Set the password. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L821[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_password(<> s); ---- == Description This function sets the password in the userinfo to the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" ); ---- === Postconditions [,cpp] ---- this->has_password() == true ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. This string may contain any characters, including nulls. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_user[set_user]. Set the path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1830[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_path(<> s); ---- == Description This function sets the path to the string, which may contain percent‐escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_path[set_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Set the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2062[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_query(<> s); ---- == Description This sets the query to the string, which may contain percent‐escapes and can be empty. An empty query is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == decode_view( s ); ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_query[set_query]. Set the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L712[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_user(<> s); ---- == Description This function sets the user part of the userinfo the the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_userinfo() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_password[set_password], xref:#boost-urls-url_base-set_user[set_user]. Set the userinfo. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L569[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_encoded_userinfo(<> s); ---- == Description The userinfo is set to the given string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result. The effects on the user and password depend on the presence of a colon (':') in the string: * If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise, * If there is no colon, the user is set to the string. The function has_password returns false. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_userinfo[remove_userinfo], xref:#boost-urls-url_base-set_userinfo[set_userinfo]. Set the fragment. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2471[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_fragment(core::string_view s); ---- == Description This function sets the fragment to the specified string, which may be empty. An empty fragment is distinct from having no fragment. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" ); ---- === Postconditions [,cpp] ---- this->has_fragment() == true && this->fragment() == s ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_fragment[remove_fragment], xref:#boost-urls-url_base-set_encoded_fragment[set_encoded_fragment]. Set the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L955[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host(core::string_view s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1137[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_address(core::string_view s); ---- == Description Depending on the contents of the passed string, this function sets the host: * If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4 . * If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6 . * If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture . * Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is host_type::name . In all cases, when this function returns, the URL contains an authority. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true ---- === Complexity Linear in `s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1296[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipv4(<> const& addr); ---- == Description The host is set to the specified IPv4 address. The host type is xref:#boost-urls-host_type[host_type::ipv4]. === Example [,cpp] ---- assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" ); ---- === Complexity Linear in `this‐>size()`. === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4 ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *addr* | The address to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1360[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipv6(<> const& addr); ---- == Description The host is set to the specified IPv6 address. The host type is xref:#boost-urls-host_type[host_type::ipv6]. === Example [,cpp] ---- assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6 ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *addr* | The address to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to an address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1412[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_ipvfuture(core::string_view s); ---- == Description The host is set to the specified IPvFuture string. The host type is xref:#boost-urls-host_type[host_type::ipvfuture]. === Example [,cpp] ---- assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid percent‐encoding. |=== == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_name[set_host_name]. Set the host to a name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1459[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_host_name(core::string_view s); ---- == Description The host is set to the specified string, which may be empty. Reserved characters in the string are percent‐escaped in the result. The host type is xref:#boost-urls-host_type[host_type::name]. === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-set_encoded_host[set_encoded_host], xref:#boost-urls-url_base-set_encoded_host_address[set_encoded_host_address], xref:#boost-urls-url_base-set_encoded_host_name[set_encoded_host_name], xref:#boost-urls-url_base-set_host[set_host], xref:#boost-urls-url_base-set_host_address[set_host_address], xref:#boost-urls-url_base-set_host_ipv4[set_host_ipv4], xref:#boost-urls-url_base-set_host_ipv6[set_host_ipv6], xref:#boost-urls-url_base-set_host_ipvfuture[set_host_ipvfuture]. Set the query params == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2278[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_params( std::initializer_list<<>> ps, <> opts = {}) noexcept; ---- == Description This sets the query params to the list of param_view, which can be empty. An empty list of params is distinct from having no params. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === Complexity Linear. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986) @li >& set_password(core::string_view s); ---- == Description This function sets the password in the userinfo to the string. Reserved characters in the string are percent‐escaped in the result. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" ); ---- === Postconditions [,cpp] ---- this->has_password() == true && this->password() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. This string may contain any characters, including nulls. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_user[set_user]. Set the path. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1765[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_path(core::string_view s); ---- == Description This function sets the path to the string, which may be empty. Reserved characters in the string are percent‐escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. [NOTE] This function does not encode '/' chars, which are unreserved for paths but reserved for path segments. If a path segment should include encoded '/'s to differentiate it from path separators, the functions xref:#boost-urls-url_base-set_encoded_path[set_encoded_path] or xref:#boost-urls-url_base-segments-04[segments] should be used instead. === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_path( "path/to/file.txt" ); assert( u.path() == "/path/to/file.txt" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path_absolute[set_path_absolute]. Set if the path is absolute == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1699[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool set_path_absolute(bool absolute); ---- == Description This function adjusts the path to make it absolute or not, depending on the parameter. [NOTE] If an authority is present, the path is always absolute. In this case, the function has no effect. === Example [,cpp] ---- url u( "path/to/file.txt" ); assert( u.set_path_absolute( true ) ); assert( u.buffer() == "/path/to/file.txt" ); ---- === Postconditions [,cpp] ---- this->is_path_absolute() == true && this->encoded_path().front() == '/' ---- === Complexity Linear in `this‐>size()`. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Return Value true on success. == See Also xref:#boost-urls-url_base-encoded_segments-0e5[encoded_segments], xref:#boost-urls-url_base-segments-04[segments], xref:#boost-urls-url_base-set_encoded_path[set_encoded_path], xref:#boost-urls-url_base-set_path[set_path]. Set the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1599[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_port(core::string_view s); ---- == Description This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n) ---- === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` does not contain a valid port. |=== == Parameters |=== | Name | Description | *s* | The port string to set. |=== == See Also xref:#boost-urls-url_base-remove_port[remove_port], xref:#boost-urls-url_base-set_port[set_port]. Set the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1556[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_port_number(std::uint16_t n); ---- == Description The port is set to the specified integer. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_port() == true && this->port_number() == n ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Parameters |=== | Name | Description | *n* | The port number to set. |=== == See Also xref:#boost-urls-url_base-remove_port[remove_port], xref:#boost-urls-url_base-set_port[set_port]. Set the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2007[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_query(core::string_view s); ---- == Description This sets the query to the string, which can be empty. An empty query is distinct from having no query. Reserved characters in the string are percent‐escaped in the result. === Example [,cpp] ---- assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == s ---- === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-encoded_params-06[encoded_params], xref:#boost-urls-url_base-params-0c[params], xref:#boost-urls-url_base-remove_query[remove_query], xref:#boost-urls-url_base-set_encoded_query[set_encoded_query]. Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L244[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_scheme(core::string_view s); ---- == Description The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case‐insensitive, and the canonical form is lowercased. === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === BNF [,cpp] ---- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | `s` contains an invalid scheme. |=== == Parameters |=== | Name | Description | *s* | The scheme to set. |=== == See Also xref:#boost-urls-url_base-remove_scheme[remove_scheme]. Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L279[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_scheme_id(<>::<> id); ---- == Description This function sets the scheme to the specified known xref:#boost-urls-scheme[urls::scheme] id, which may not be xref:#boost-urls-scheme[scheme::unknown] or else an exception is thrown. If the id is xref:#boost-urls-scheme[scheme::none], this function behaves as if xref:#boost-urls-url_base-remove_scheme[remove_scheme] were called. === Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).set_scheme_id( scheme::wss ).buffer() == "wss://example.com/echo.cgi" ); ---- === Complexity Linear in `this‐>size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The scheme is invalid. |=== == Parameters |=== | Name | Description | *id* | The scheme to set. |=== Set the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L659[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_user(core::string_view s); ---- == Description This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent‐encoded. === Example [,cpp] ---- assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->has_userinfo() == true ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_password[remove_password], xref:#boost-urls-url_base-set_encoded_password[set_encoded_password], xref:#boost-urls-url_base-set_encoded_user[set_encoded_user], xref:#boost-urls-url_base-set_password[set_password]. Set the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L503[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& set_userinfo(core::string_view s); ---- == Description The userinfo is set to the given string, which may contain percent‐escapes. Any special or reserved characters in the string are automatically percent‐encoded. The effects on the user and password depend on the presence of a colon (':') in the string: * If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise, * If there is no colon, the user is set to the string. The function has_password returns false. [NOTE] The interpretation of the userinfo as individual user and password components is scheme‐dependent. Transmitting passwords in URLs is deprecated. === Example [,cpp] ---- assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" ); ---- === Complexity Linear in `this‐>size() + s.size()`. === Exception Safety Strong guarantee. Calls to allocate may throw. === BNF [,cpp] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Parameters |=== | Name | Description | *s* | The string to set. |=== == See Also xref:#boost-urls-url_base-remove_userinfo[remove_userinfo], xref:#boost-urls-url_base-set_encoded_userinfo[set_encoded_userinfo]. A non‐owning reference to a valid URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L74[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class url_view : public <>; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the authority | <> | Return the url string | <> | Return the result of comparing this with another url | <> | Return a pointer to the url's character buffer | <> | Return true if the url is empty | <> | Return the authority. | <> | Return the fragment | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the origin | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return the query | <> | Return the resource | <> | Return the path as a container of segments | <> | Return the target | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> | Return the fragment | <> | Return true if an authority is present | <> | Return true if a fragment is present | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a query is present | <> | Return true a scheme is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Return true if the path is absolute | <> | Return the URL as a core::string_view | <> | Assignment | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return a shared, persistent copy of the url | <> | Return the port | <> | Return the port | <> | Return the query | <> | Return the scheme | <> | Return the scheme | <> | Return the path as a container of segments | <> | Return the number of characters in the url | <> [.small]#[constructor]# | Constructor xref:#boost-urls-url_view-2constructor-00[url_view(core::string_view)] | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> [.small]#[destructor]# | Destructor |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Format the url to the output stream | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Calculate a hash of the url |=== == Description Objects of this type represent valid URL strings constructed from a parsed, external character buffer whose storage is managed by the caller. That is, it acts like a `core::string_view` in terms of ownership. The caller is responsible for ensuring that the lifetime of the underlying character buffer extends until it is no longer referenced. === Example 1 Construction from a string parses the input as a _URI‐reference_ and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred. [,cpp] ---- url_view u( "https://www.example.com/index.htm?text=none#a1" ); ---- === Example 2 Parsing functions like xref:#boost-urls-parse_uri_reference[parse_uri_reference] return a result containing either a valid xref:#boost-urls-url_view-2constructor-00[url_view] upon succcess, otherwise they contain an error. The error can be converted to an exception by the caller if desired: [,cpp] ---- system::result< url_view > rv = parse_uri_reference( "https://www.example.com/index.htm?text=none#a1" ); ---- === BNF [,cpp] ---- URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI): Generic Syntax (rfc3986)] A non‐owning reference to a valid URL Objects of this type represent valid URL strings constructed from a parsed, external character buffer whose storage is managed by the caller. That is, it acts like a `core::string_view` in terms of ownership. The caller is responsible for ensuring that the lifetime of the underlying character buffer extends until it is no longer referenced. === Example 1 Construction from a string parses the input as a _URI‐reference_ and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred. [,cpp] ---- url_view u( "https://www.example.com/index.htm?text=none#a1" ); ---- === Example 2 Parsing functions like xref:#boost-urls-parse_uri_reference[parse_uri_reference] return a result containing either a valid xref:#boost-urls-url_view-2constructor-00[url_view] upon succcess, otherwise they contain an error. The error can be converted to an exception by the caller if desired: [,cpp] ---- system::result< url_view > rv = parse_uri_reference( "https://www.example.com/index.htm?text=none#a1" ); ---- === BNF [,cpp] ---- URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI): Generic Syntax (rfc3986)] == See Also xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference]. xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference]. Return the maximum number of characters possible == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L331[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr static std::size_t max_size() noexcept; ---- == Description This represents the largest number of characters that are possible in a url, not including any null terminator. === Complexity Constant. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L283[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& <>(<> const& other) noexcept; ---- [.small]#<># == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L283[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other) noexcept; ---- == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing. Assignment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L310[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>& operator=(<> const& other) noexcept; ---- == Description After assignment, both views reference the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L89[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(/* implementation-defined */::url_impl const& impl) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(core::string_view s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class String> requires std::is_convertible< String, core::string_view >::value && !std::is_convertible< String*, url_view_base* >::value && std::is_convertible< String, core::string_view >::value && !std::is_convertible< String*, url_view_base* >::value <>(String const& s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& other) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& other) noexcept; ---- [.small]#<># == Description Default constructed views refer to a string with zero length, which always remains valid. This matches the grammar for a relative‐ref with an empty path and no query or fragment. === Example [,cpp] ---- url_view u; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The input failed to parse correctly. |=== == Parameters |=== | Name | Description | *s* | The string to parse. |=== Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L146[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url_view() noexcept; ---- == Description Default constructed views refer to a string with zero length, which always remains valid. This matches the grammar for a relative‐ref with an empty path and no query or fragment. === Example [,cpp] ---- url_view u; ---- === Postconditions [,cpp] ---- this->empty() == true ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L197[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url_view(core::string_view s); ---- == Description This function constructs a URL from the string `s`, which must contain a valid _URI_ or _relative‐ref_ or else an exception is thrown. Upon successful construction, the view refers to the characters in the buffer pointed to by `s`. Ownership is not transferred; The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- url_view u( "http://www.example.com/index.htm" ); ---- === Effects [,cpp] ---- return parse_uri_reference( s ).value(); ---- === Complexity Linear in `s.size()`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference] Constructor This function constructs a URL from the string `s`, which must contain a valid _URI_ or _relative‐ref_ or else an exception is thrown. Upon successful construction, the view refers to the characters in the buffer pointed to by `s`. Ownership is not transferred; The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. === Example [,cpp] ---- url_view u( "http://www.example.com/index.htm" ); ---- === Effects [,cpp] ---- return parse_uri_reference( s ).value(); ---- === Complexity Linear in `s.size()`. === Exception Safety Exceptions thrown on invalid input. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference] == Exceptions |=== | Name | Thrown on | `system_error` | The input failed to parse correctly. | `system_error` | The input failed to parse correctly. |=== == Parameters |=== | Name | Description | *s* | The string to parse. | *s* | The string to parse. |=== == See Also xref:#boost-urls-parse_uri_reference[parse_uri_reference]. xref:#boost-urls-parse_uri_reference[parse_uri_reference]. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L239[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url_view(<> const& other) noexcept; ---- == Description After construction, both views reference the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing. Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L263[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- url_view(<> const& other) noexcept; ---- == Description After construction, both views reference the same underlying character buffer. Ownership is not transferred. === Postconditions [,cpp] ---- this->buffer().data() == other.buffer().data() ---- === Complexity Constant. === Exception Safety Throws nothing. xref:#boost-urls-url_view-2constructor-00[url_view(core::string_view)] == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L200[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class String> requires std::is_convertible< String, core::string_view >::value && !std::is_convertible< String*, url_view_base* >::value && std::is_convertible< String, core::string_view >::value && !std::is_convertible< String*, url_view_base* >::value url_view(String const& s); ---- Destructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L110[boost/url/url_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ~url_view() = default; ---- == Description Any params, segments, iterators, or other views which reference the same underlying character buffer remain valid. Common functionality for containers == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L65[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class url_view_base; ---- == Member Functions [cols=2] |=== | Name | Description | <> | Return the authority | <> | Return the url string | <> | Return the result of comparing this with another url | <> | Return a pointer to the url's character buffer | <> | Return true if the url is empty | <> | Return the authority. | <> | Return the fragment | <> | Return the host | <> | Return the host | <> | Return the host and port | <> | Return the host name | <> | Return the origin | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return the query | <> | Return the resource | <> | Return the path as a container of segments | <> | Return the target | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID | <> | Return the fragment | <> | Return true if an authority is present | <> | Return true if a fragment is present | <> | Return true if a password is present | <> | Return true if a port is present | <> | Return true if a query is present | <> | Return true a scheme is present | <> | Return true if a userinfo is present | <> | Return the host | <> | Return the host | <> | Return the host IPv4 address | <> | Return the host IPv6 address | <> | Return the host IPvFuture address | <> | Return the host name | <> | Return the host type | <> | Return true if the path is absolute | <> | Return the URL as a core::string_view | <> | Return the query as a container of parameters | <> | Return the password | <> | Return the path | <> | Return a shared, persistent copy of the url | <> | Return the port | <> | Return the port | <> | Return the query | <> | Return the scheme | <> | Return the scheme | <> | Return the path as a container of segments | <> | Return the number of characters in the url | <> | Return the user | <> | Return the userinfo | <> | Return the IPv6 Zone ID |=== == Static Member Functions [cols=2] |=== | Name | Description | <> | Return the maximum number of characters possible |=== == Friends [cols=2] |=== | Name | Description | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Format the url to the output stream | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs | <> | Return the result of comparing two URLs |=== == Protected Member Functions [cols=2] |=== | Name | Description | <> | Calculate a hash of the url |=== == Description This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * url * url_view * static_url === Functions * parse_absolute_uri * parse_origin_form * parse_relative_ref * parse_uri * parse_uri_reference Common functionality for containers This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions: === Containers * url * url_view * static_url === Functions * parse_absolute_uri * parse_origin_form * parse_relative_ref * parse_uri * parse_uri_reference Return the authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L524[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> authority() const noexcept; ---- == Description This function returns the authority as an xref:#boost-urls-authority_view[authority_view]. === Example [,cpp] ---- authority_view a = url_view( "https://www.example.com:8080/index.htm" ).authority(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] Return the authority This function returns the authority as an xref:#boost-urls-authority_view[authority_view]. === Example [,cpp] ---- authority_view a = url_view( "https://www.example.com:8080/index.htm" ).authority(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_authority[encoded_authority], xref:#boost-urls-url_view_base-has_authority[has_authority]. xref:#boost-urls-url_view_base-encoded_authority[encoded_authority], xref:#boost-urls-url_view_base-has_authority[has_authority]. Return the url string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L255[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view buffer() const noexcept; ---- == Description This function returns the entire url, which may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com" ).buffer() == "http://www.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. Return the result of comparing this with another url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2313[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int compare(<> const& other) const noexcept; ---- == Description This function compares two URLs according to Syntax‐Based comparison algorithm. === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing this with another url This function compares two URLs according to Syntax‐Based comparison algorithm. === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value ‐1 if `*this < other`, 0 if `this == other`, and 1 if `this > other`. Return a pointer to the url's character buffer == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L233[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- char const* data() const noexcept; ---- == Description This function returns a pointer to the first character of the url, which is not guaranteed to be null‐terminated. === Complexity Constant. === Exception Safety Throws nothing. Calculate a hash of the url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L129[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t digest(std::size_t salt = 0) const noexcept; ---- == Description This function calculates a hash of the url as if it were always normalized. === Complexity Linear in `this‐>size()`. === Exception Safety Throws nothing. == Return Value A hash value suitable for use in hash‐based containers. == Parameters |=== | Name | Description | *salt* | An initial value to add to the hash |=== Return true if the url is empty == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L215[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool empty() const noexcept; ---- == Description The empty string matches the _relative‐ref_ grammar. === Example [,cpp] ---- assert( url_view( "" ).empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] Return true if the url is empty The empty string matches the _relative‐ref_ grammar. === Example [,cpp] ---- assert( url_view( "" ).empty() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] Return the authority. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L559[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_authority() const noexcept; ---- == Description If present, this function returns a string representing the authority (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "file://Network%20Drive/My%2DFiles" ).encoded_authority() == "Network%20Drive" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] Return the authority. If present, this function returns a string representing the authority (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "file://Network%20Drive/My%2DFiles" ).encoded_authority() == "Network%20Drive" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == See Also xref:#boost-urls-url_view_base-authority[authority], xref:#boost-urls-url_view_base-has_authority[has_authority]. xref:#boost-urls-url_view_base-authority[authority], xref:#boost-urls-url_view_base-has_authority[has_authority]. Return the fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2156[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_fragment() const noexcept; ---- == Description This function returns the fragment as a string with percent‐escapes. Ownership is not transferred; the string returned references the underlying character buffer, which must remain valid or else undefined behavior occurs. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)] Return the fragment This function returns the fragment as a string with percent‐escapes. Ownership is not transferred; the string returned references the underlying character buffer, which must remain valid or else undefined behavior occurs. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)] == See Also xref:#boost-urls-url_view_base-fragment[fragment], xref:#boost-urls-url_view_base-has_fragment[has_fragment]. xref:#boost-urls-url_view_base-fragment[fragment], xref:#boost-urls-url_view_base-has_fragment[has_fragment]. Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1053[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host() const noexcept; ---- == Description This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1165[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host_address() const noexcept; ---- == Description The value returned by this function depends on the type of host returned from the function xref:#boost-urls-url_view_base-host_type[host_type]. * If the type is host_type::ipv4 , then the IPv4 address string is returned. * If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets. * If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets. * If the type is host_type::name , then the host name string is returned. Any percent‐escapes in the string are decoded first. * If the type is host_type::none , then an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host The value returned by this function depends on the type of host returned from the function xref:#boost-urls-url_view_base-host_type[host_type]. * If the type is host_type::ipv4 , then the IPv4 address string is returned. * If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets. * If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets. * If the type is host_type::name , then the host name string is returned. Any percent‐escapes in the string are decoded first. * If the type is host_type::none , then an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host and port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2199[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host_and_port() const noexcept; ---- == Description If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] Return the host and port If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_port[has_port], xref:#boost-urls-url_view_base-port[port], xref:#boost-urls-url_view_base-port_number[port_number]. xref:#boost-urls-url_view_base-has_port[has_port], xref:#boost-urls-url_view_base-port[port], xref:#boost-urls-url_view_base-port_number[port_number]. Return the host name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1358[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_host_name() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::name], this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host name If the host type is xref:#boost-urls-host_type[host_type::name], this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the origin == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2227[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_origin() const noexcept; ---- == Description If an authority is present, this function returns the scheme and authority portion of the url. Otherwise, an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com:8080/index.htm?text=none#h1" ).encoded_origin() == "http://www.example.com:8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. == See Also xref:#boost-urls-url_view_base-encoded_resource[encoded_resource], xref:#boost-urls-url_view_base-encoded_target[encoded_target]. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2013[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_params() const noexcept; ---- == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query as a container of parameters This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. Return the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L936[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_password() const noexcept; ---- == Description This function returns the password portion of the userinfo as a percent‐encoded string. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the password This function returns the password portion of the userinfo as a percent‐encoded string. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return the path == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1698[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_path() const noexcept; ---- == Description This function returns the path as a string. The path may be empty. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "file:///Program%20Files/Games/config.ini" ).encoded_path() == "/Program%20Files/Games/config.ini" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return the path This function returns the path as a string. The path may be empty. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "file:///Program%20Files/Games/config.ini" ).encoded_path() == "/Program%20Files/Games/config.ini" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments]. xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments]. Return the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1927[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_query() const noexcept; ---- == Description If this contains a query, it is returned as a string (which may be empty). Otherwise, an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query If this contains a query, it is returned as a string (which may be empty). Otherwise, an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. Return the resource == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2257[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_resource() const noexcept; ---- == Description This function returns the resource, which is the portion of the url that includes only the path, query, and fragment. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_resource() == "/index.html?query#frag" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] Return the resource This function returns the resource, which is the portion of the url that includes only the path, query, and fragment. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_resource() == "/index.html?query#frag" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_origin[encoded_origin], xref:#boost-urls-url_view_base-encoded_target[encoded_target]. xref:#boost-urls-url_view_base-encoded_origin[encoded_origin], xref:#boost-urls-url_view_base-encoded_target[encoded_target]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1786[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_segments() const noexcept; ---- == Description This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return the path as a container of segments This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. === Example [,cpp] ---- segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments], xref:#boost-urls-segments_encoded_view[segments_encoded_view]. xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments], xref:#boost-urls-segments_encoded_view[segments_encoded_view]. Return the target == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2287[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_target() const noexcept; ---- == Description This function returns the target, which is the portion of the url that includes only the path and query. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_target() == "/index.html?query" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] Return the target This function returns the target, which is the portion of the url that includes only the path and query. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_target() == "/index.html?query" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_origin[encoded_origin], xref:#boost-urls-url_view_base-encoded_resource[encoded_resource]. xref:#boost-urls-url_view_base-encoded_origin[encoded_origin], xref:#boost-urls-url_view_base-encoded_resource[encoded_resource]. Return the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L846[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_user() const noexcept; ---- == Description If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the user If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L750[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_userinfo() const noexcept; ---- == Description If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" ); ---- === Complexity Constant. === Exception Safety Throws nothing === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the userinfo If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" ); ---- === Complexity Constant. === Exception Safety Throws nothing === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return the IPv6 Zone ID == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1438[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> encoded_zone_id() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the Zone ID as a string. Otherwise an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]" ZoneID = 1*( unreserved / pct-encoded ) IPv6addrz = IPv6address "%25" ZoneID ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers] Return the IPv6 Zone ID If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the Zone ID as a string. Otherwise an empty string is returned. The returned string may contain percent escapes. === Example [,cpp] ---- assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]" ZoneID = 1*( unreserved / pct-encoded ) IPv6addrz = IPv6address "%25" ZoneID ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers] Return the fragment == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2111[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type fragment(StringToken&& token = {}); ---- == Description This function calculates the fragment of the url, with percent escapes decoded and without the leading pound sign ('#') whose presence indicates that the url contains a fragment. This function accepts an optional _StringToken_ parameter which controls the return type and behavior of the function: * When called with no arguments, the return type of the function is `std::string` . Otherwise * When called with a string token, the behavior and return type of the function depends on the type of string token being passed. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" ); ---- === Complexity Linear in `this‐>fragment().size()`. === Exception Safety Calls to allocate may throw. String tokens may throw exceptions. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) fragment-part = [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)] Return the fragment This function calculates the fragment of the url, with percent escapes decoded and without the leading pound sign ('#') whose presence indicates that the url contains a fragment. This function accepts an optional _StringToken_ parameter which controls the return type and behavior of the function: * When called with no arguments, the return type of the function is `std::string` . Otherwise * When called with a string token, the behavior and return type of the function depends on the type of string token being passed. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" ); ---- === Complexity Linear in `this‐>fragment().size()`. === Exception Safety Calls to allocate may throw. String tokens may throw exceptions. === BNF [,cpp] ---- fragment = *( pchar / "/" / "?" ) fragment-part = [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)] == Parameters |=== | Name | Description | *token* | An optional string token to use. If this parameter is omitted, the function returns a new `std::string`. | *token* | An optional string token to use. If this parameter is omitted, the function returns a new `std::string`. |=== == See Also xref:#boost-urls-url_view_base-encoded_fragment[encoded_fragment], xref:#boost-urls-url_view_base-has_fragment[has_fragment]. xref:#boost-urls-url_view_base-encoded_fragment[encoded_fragment], xref:#boost-urls-url_view_base-has_fragment[has_fragment]. Return true if an authority is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L490[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_authority() const noexcept; ---- == Description This function returns true if the url contains an authority. The presence of an authority is denoted by a double slash ("//") at the beginning or after the scheme. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm" ).has_authority() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] URI-reference = URI / relative-ref relative-ref = relative-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty ; (more...) relative-part = "//" authority path-abempty ; (more...) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] Return true if an authority is present This function returns true if the url contains an authority. The presence of an authority is denoted by a double slash ("//") at the beginning or after the scheme. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm" ).has_authority() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] URI-reference = URI / relative-ref relative-ref = relative-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty ; (more...) relative-part = "//" authority path-abempty ; (more...) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == See Also xref:#boost-urls-url_view_base-authority[authority], xref:#boost-urls-url_view_base-encoded_authority[encoded_authority]. xref:#boost-urls-url_view_base-authority[authority], xref:#boost-urls-url_view_base-encoded_authority[encoded_authority]. Return true if a fragment is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2054[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_fragment() const noexcept; ---- == Description This function returns true if the url contains a fragment. An empty fragment is distinct from no fragment. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)] Return true if a fragment is present This function returns true if the url contains a fragment. An empty fragment is distinct from no fragment. === Example [,cpp] ---- assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_fragment[encoded_fragment], xref:#boost-urls-url_view_base-fragment[fragment]. xref:#boost-urls-url_view_base-encoded_fragment[encoded_fragment], xref:#boost-urls-url_view_base-fragment[fragment]. Return true if a password is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L644[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_password() const noexcept; ---- == Description This function returns true if the userinfo is present and contains a password. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return true if a password is present This function returns true if the userinfo is present and contains a password. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return true if a port is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1478[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_port() const noexcept; ---- == Description This function returns true if an authority is present and contains a port. === Example [,cpp] ---- assert( url_view( "wss://www.example.com:443" ).has_port() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] Return true if a port is present This function returns true if an authority is present and contains a port. === Example [,cpp] ---- assert( url_view( "wss://www.example.com:443" ).has_port() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-url_view_base-port[port], xref:#boost-urls-url_view_base-port_number[port_number]. xref:#boost-urls-url_view_base-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-url_view_base-port[port], xref:#boost-urls-url_view_base-port_number[port_number]. Return true if a query is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1830[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_query() const noexcept; ---- == Description This function returns true if this contains a query. An empty query is distinct from having no query. === Example [,cpp] ---- assert( url_view( "/sql?id=42&col=name&page-size=20" ).has_query() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return true if a query is present This function returns true if this contains a query. An empty query is distinct from having no query. === Example [,cpp] ---- assert( url_view( "/sql?id=42&col=name&page-size=20" ).has_query() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-params-05[params], xref:#boost-urls-url_view_base-query[query]. Return true a scheme is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L352[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_scheme() const noexcept; ---- == Description This function returns true if this contains a scheme. === Example [,cpp] ---- assert( url_view( "http://www.example.com" ).has_scheme() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] Return true a scheme is present This function returns true if this contains a scheme. === Example [,cpp] ---- assert( url_view( "http://www.example.com" ).has_scheme() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] == See Also xref:#boost-urls-url_view_base-scheme[scheme], xref:#boost-urls-url_view_base-scheme_id[scheme_id]. xref:#boost-urls-url_view_base-scheme[scheme], xref:#boost-urls-url_view_base-scheme_id[scheme_id]. Return true if a userinfo is present == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L604[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool has_userinfo() const noexcept; ---- == Description This function returns true if this contains a userinfo. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return true if a userinfo is present This function returns true if this contains a userinfo. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1011[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type host(StringToken&& token = {}); ---- == Description This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" ); ---- === Complexity Linear in `this‐>host().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" ); ---- === Complexity Linear in `this‐>host().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1104[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type host_address(StringToken&& token = {}); ---- == Description The value returned by this function depends on the type of host returned from the function xref:#boost-urls-url_view_base-host_type[host_type]. * If the type is host_type::ipv4 , then the IPv4 address string is returned. * If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets. * If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets. * If the type is host_type::name , then the host name string is returned. Any percent‐escapes in the string are decoded first. * If the type is host_type::none , then an empty string is returned. === Example [,cpp] ---- assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" ); ---- === Complexity Linear in `this‐>host_address().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host The value returned by this function depends on the type of host returned from the function xref:#boost-urls-url_view_base-host_type[host_type]. * If the type is host_type::ipv4 , then the IPv4 address string is returned. * If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets. * If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets. * If the type is host_type::name , then the host name string is returned. Any percent‐escapes in the string are decoded first. * If the type is host_type::none , then an empty string is returned. === Example [,cpp] ---- assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" ); ---- === Complexity Linear in `this‐>host_address().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPv4 address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1203[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> host_ipv4_address() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipv4], this function returns the address as a value of type xref:#boost-urls-ipv4_address[ipv4_address]. Otherwise, if the host type is not an IPv4 address, it returns a default‐constructed value which is equal to the unspecified address "0.0.0.0". === Example [,cpp] ---- assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPv4 address If the host type is xref:#boost-urls-host_type[host_type::ipv4], this function returns the address as a value of type xref:#boost-urls-ipv4_address[ipv4_address]. Otherwise, if the host type is not an IPv4 address, it returns a default‐constructed value which is equal to the unspecified address "0.0.0.0". === Example [,cpp] ---- assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPv6 address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1249[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> host_ipv6_address() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the address as a value of type xref:#boost-urls-ipv6_address[ipv6_address]. Otherwise, if the host type is not an IPv6 address, it returns a default‐constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0". === Example [,cpp] ---- assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPv6 address If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the address as a value of type xref:#boost-urls-ipv6_address[ipv6_address]. Otherwise, if the host type is not an IPv6 address, it returns a default‐constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0". === Example [,cpp] ---- assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPvFuture address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1280[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view host_ipvfuture() const noexcept; ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipvfuture], this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string. === Example [,cpp] ---- assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host IPvFuture address If the host type is xref:#boost-urls-host_type[host_type::ipvfuture], this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string. === Example [,cpp] ---- assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1314[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type host_name(StringToken&& token = {}); ---- == Description If the host type is xref:#boost-urls-host_type[host_type::name], this function returns the name as a string. Otherwise an empty string is returned. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" ); ---- === Complexity Linear in `this‐>host_name().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host name If the host type is xref:#boost-urls-host_type[host_type::name], this function returns the name as a string. Otherwise an empty string is returned. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" ); ---- === Complexity Linear in `this‐>host_name().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host type == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L974[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>::<> host_type() const noexcept; ---- == Description This function returns one of the following constants representing the type of host present. * host_type::ipv4 * host_type::ipv6 * host_type::ipvfuture * host_type::name * host_type::none When xref:#boost-urls-url_view_base-has_authority[has_authority] is false, the host type is xref:#boost-urls-host_type[host_type::none]. === Example [,cpp] ---- assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return the host type This function returns one of the following constants representing the type of host present. * host_type::ipv4 * host_type::ipv6 * host_type::ipvfuture * host_type::name * host_type::none When xref:#boost-urls-url_view_base-has_authority[has_authority] is false, the host type is xref:#boost-urls-host_type[host_type::none]. === Example [,cpp] ---- assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 ); ---- === Complexity Constant. === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] Return true if the path is absolute == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1595[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool is_path_absolute() const noexcept; ---- == Description This function returns true if the path begins with a forward slash ('/'). === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).is_path_absolute() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return true if the path is absolute This function returns true if the path begins with a forward slash ('/'). === Example [,cpp] ---- assert( url_view( "/path/to/file.txt" ).is_path_absolute() ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments]. xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-url_view_base-segments[segments]. Return the maximum number of characters possible == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L154[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr static std::size_t max_size() noexcept; ---- == Description This represents the largest number of characters that are theoretically possible to represent in a url, not including any null terminator. In practice the actual possible size may be lower than this number. === Complexity Constant. === Exception Safety Throws nothing. Return the URL as a core::string_view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L271[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- operator core::string_view() const noexcept; ---- == Description === Complexity Constant. === Exception Safety Throws nothing. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1969[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>() const noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>(<> opt) const noexcept; ---- [.small]#<># == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query as a container of parameters This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-query[query]. Return the query as a container of parameters == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1969[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> params() const noexcept; ---- == Description This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query as a container of parameters This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-query[query]. xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-query[query]. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1972[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> params(<> opt) const noexcept; ---- Return the password == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L889[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type password(StringToken&& token = {}); ---- == Description If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" ); ---- === Complexity Linear in `this‐>password().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the password If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" ); ---- === Complexity Linear in `this‐>password().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-user[user], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return the path == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1645[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type path(StringToken&& token = {}); ---- == Description This function returns the path as a string. The path may be empty. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "file:///Program%20Files/Games/config.ini" ).path() == "/Program Files/Games/config.ini" ); ---- === Complexity Linear in `this‐>path().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return the path This function returns the path as a string. The path may be empty. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "file:///Program%20Files/Games/config.ini" ).path() == "/Program Files/Games/config.ini" ); ---- === Complexity Linear in `this‐>path().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-segments[segments]. xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-segments[segments]. Return a shared, persistent copy of the url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L311[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::shared_ptr<<> const> persist() const; ---- == Description This function returns a read‐only copy of the url, with shared lifetime. The returned value owns (persists) the underlying string. The algorithm used to create the value minimizes the number of individual memory allocations, making it more efficient than when using direct standard library functions. === Example [,cpp] ---- std::shared_ptr< url_view const > sp; { std::string s( "http://example.com" ); url_view u( s ); // u references characters in s assert( u.data() == s.data() ); // same buffer sp = u.persist(); assert( sp->data() != s.data() ); // different buffer assert( sp->buffer() == s); // same contents // s is destroyed and thus u // becomes invalid, but sp remains valid. } ---- === Complexity Linear in `this‐>size()`. === Exception Safety Calls to allocate may throw. Return the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1512[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view port() const noexcept; ---- == Description If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string. === Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port() == "8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] Return the port If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string. === Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port() == "8080" ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-url_view_base-has_port[has_port], xref:#boost-urls-url_view_base-port_number[port_number]. xref:#boost-urls-url_view_base-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-url_view_base-has_port[has_port], xref:#boost-urls-url_view_base-port_number[port_number]. Return the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1546[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::uint16_t port_number() const noexcept; ---- == Description If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned. === Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] Return the port If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned. === Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == See Also xref:#boost-urls-url_view_base-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-url_view_base-has_port[has_port], xref:#boost-urls-url_view_base-port[port]. xref:#boost-urls-url_view_base-encoded_host_and_port[encoded_host_and_port], xref:#boost-urls-url_view_base-has_port[has_port], xref:#boost-urls-url_view_base-port[port]. Return the query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1876[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type query(StringToken&& token = {}); ---- == Description If this contains a query, it is returned as a string (which may be empty). Otherwise, an empty string is returned. Any percent‐escapes in the string are decoded first. When plus signs appear in the query portion of the url, they are converted to spaces automatically upon decoding. This behavior can be changed by setting decode options. === Example [,cpp] ---- assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).query() == "id=42&name=jane-doe&page size=20" ); ---- === Complexity Linear in `this‐>query().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] Return the query If this contains a query, it is returned as a string (which may be empty). Otherwise, an empty string is returned. Any percent‐escapes in the string are decoded first. When plus signs appear in the query portion of the url, they are converted to spaces automatically upon decoding. This behavior can be changed by setting decode options. === Example [,cpp] ---- assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).query() == "id=42&name=jane-doe&page size=20" ); ---- === Complexity Linear in `this‐>query().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == See Also xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params]. xref:#boost-urls-url_view_base-encoded_params[encoded_params], xref:#boost-urls-url_view_base-encoded_query[encoded_query], xref:#boost-urls-url_view_base-has_query[has_query], xref:#boost-urls-url_view_base-params-05[params]. Return the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L387[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view scheme() const noexcept; ---- == Description This function returns the scheme if it exists, without a trailing colon (':'). Otherwise it returns an empty string. Note that schemes are case‐insensitive, and the canonical form is lowercased. === Example [,cpp] ---- assert( url_view( "http://www.example.com" ).scheme() == "http" ); ---- === Exception Safety Throws nothing. === BNF [,cpp] ---- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] Return the scheme This function returns the scheme if it exists, without a trailing colon (':'). Otherwise it returns an empty string. Note that schemes are case‐insensitive, and the canonical form is lowercased. === Example [,cpp] ---- assert( url_view( "http://www.example.com" ).scheme() == "http" ); ---- === Exception Safety Throws nothing. === BNF [,cpp] ---- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_scheme[has_scheme], xref:#boost-urls-url_view_base-scheme_id[scheme_id]. xref:#boost-urls-url_view_base-has_scheme[has_scheme], xref:#boost-urls-url_view_base-scheme_id[scheme_id]. Return the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L435[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>::<> scheme_id() const noexcept; ---- == Description This function returns a value which depends on the scheme in the url: * If the scheme is a well‐known scheme, corresponding value from the enumeration urls::scheme is returned. * If a scheme is present but is not a well‐known scheme, the value returned is urls::scheme::unknown . * Otherwise, if the scheme is absent the value returned is urls::scheme::none . === Example [,cpp] ---- assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] Return the scheme This function returns a value which depends on the scheme in the url: * If the scheme is a well‐known scheme, corresponding value from the enumeration urls::scheme is returned. * If a scheme is present but is not a well‐known scheme, the value returned is urls::scheme::unknown . * Otherwise, if the scheme is absent the value returned is urls::scheme::none . === Example [,cpp] ---- assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss ); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_scheme[has_scheme], xref:#boost-urls-url_view_base-scheme[scheme]. xref:#boost-urls-url_view_base-has_scheme[has_scheme], xref:#boost-urls-url_view_base-scheme[scheme]. Return the path as a container of segments == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1737[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> segments() const noexcept; ---- == Description This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- segments_view sv = url_view( "/path/to/file.txt" ).segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = [ "/" ] segment *( "/" segment ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] Return the path as a container of segments This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent‐escapes in strings returned when iterating the view are decoded first. === Example [,cpp] ---- segments_view sv = url_view( "/path/to/file.txt" ).segments(); ---- === Complexity Constant. === Exception Safety Throws nothing. === BNF [,cpp] ---- path = [ "/" ] segment *( "/" segment ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-segments_view[segments_view]. xref:#boost-urls-url_view_base-is_path_absolute[is_path_absolute], xref:#boost-urls-url_view_base-encoded_path[encoded_path], xref:#boost-urls-url_view_base-encoded_segments[encoded_segments]. xref:#boost-urls-url_view_base-path[path], xref:#boost-urls-segments_view[segments_view]. Return the number of characters in the url == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L180[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::size_t size() const noexcept; ---- == Description This function returns the number of characters in the url's encoded string, not including any null terminator, if present. === Example [,cpp] ---- assert( url_view( "file:///Program%20Files" ).size() == 23 ); ---- === Complexity Constant. === Exception Safety Throws nothing. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L92[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>() noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit <>(/* implementation-defined */::url_impl const&) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <>(<> const& o) noexcept; ---- [.small]#<># Return the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L795[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type user(StringToken&& token = {}); ---- == Description If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" ); ---- === Complexity Linear in `this‐>user().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the user If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" ); ---- === Complexity Linear in `this‐>user().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-userinfo[userinfo]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-userinfo[userinfo]. Return the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L700[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type userinfo(StringToken&& token = {}); ---- == Description If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. [NOTE] This function uses the string token return type customization. Depending on the token passed, the return type and behavior of the function can be different. See xref:#boost-urls-string_token-return_string[string_token::return_string] for more information. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" ); ---- === Complexity Linear in `this‐>userinfo().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the userinfo If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. [NOTE] This function uses the string token return type customization. Depending on the token passed, the return type and behavior of the function can be different. See xref:#boost-urls-string_token-return_string[string_token::return_string] for more information. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" ); ---- === Complexity Linear in `this‐>userinfo().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == Return Value When called with no arguments, a value of type `std::string` is returned. Otherwise, the return type and meaning depends on the string token passed to the function. == See Also xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user]. xref:#boost-urls-url_view_base-has_password[has_password], xref:#boost-urls-url_view_base-has_userinfo[has_userinfo], xref:#boost-urls-url_view_base-encoded_password[encoded_password], xref:#boost-urls-url_view_base-encoded_user[encoded_user], xref:#boost-urls-url_view_base-encoded_userinfo[encoded_userinfo], xref:#boost-urls-url_view_base-password[password], xref:#boost-urls-url_view_base-user[user]. Return the IPv6 Zone ID == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1394[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> StringToken = <>::<>> StringToken::result_type zone_id(StringToken&& token = {}); ---- == Description If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the Zone ID as a string. Otherwise an empty string is returned. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" ); ---- === Complexity Linear in `this‐>encoded_zone_id().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]" ZoneID = 1*( unreserved / pct-encoded ) IPv6addrz = IPv6address "%25" ZoneID ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers] Return the IPv6 Zone ID If the host type is xref:#boost-urls-host_type[host_type::ipv6], this function returns the Zone ID as a string. Otherwise an empty string is returned. Any percent‐escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" ); ---- === Complexity Linear in `this‐>encoded_zone_id().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]" ZoneID = 1*( unreserved / pct-encoded ) IPv6addrz = IPv6address "%25" ZoneID ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers] Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2391[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator!=( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 != u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() != b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 != u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() != b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 != u1` Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2433[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator<( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 < u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() < b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 < u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() < b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 < u1` Format the url to the output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2600[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend std::ostream& operator<<( std::ostream& os, <> const& u); ---- == Description This function serializes the url to the specified output stream. Any percent‐escapes are emitted as‐is; no decoding is performed. === Example [,cpp] ---- url_view u( "http://www.example.com/index.htm" ); std::stringstream ss; ss << u; assert( ss.str() == "http://www.example.com/index.htm" ); ---- === Effects [,cpp] ---- return os << u.buffer(); ---- === Complexity Linear in `u.buffer().size()` === Exception Safety Basic guarantee. == Return Value A reference to the output stream, for chaining == Parameters |=== | Name | Description | *os* | The output stream to write to. | *u* | The url to write. |=== Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2475[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator<=( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 <= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() <= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 <= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() <= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 <= u1` Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2349[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator==( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 == u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() == b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 == u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() == b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 == u1` Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2517[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator>( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 > u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() > b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 > u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() > b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 > u1` Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2559[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- friend bool operator>=( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 >= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() >= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 >= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() >= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 >= u1` Designate a named argument for a replacement field == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L447[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> <><T> arg( core::string_view name, T const& arg); ---- == Description Construct a named argument for a format URL string that contains named replacement fields. The function parameters should be convertible to an implementation defined type able to store the name and a reference to any type potentially used as a format argument. === Example The function should be used to designate a named argument for a replacement field in a format URL string. [,cpp] ---- assert(format("user/{id}", arg("id", 1)).buffer() == "user/1"); ---- == Return Value A temporary object with reference semantics for a named argument == Parameters |=== | Name | Description | *name* | The format argument name | *arg* | The format argument value |=== == See Also xref:#boost-urls-format-02[format], xref:#boost-urls-format_to-0b[format_to]. Return the default port for a known scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/scheme.hpp#L174[boost/url/scheme.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::uint16_t default_port(<> s) noexcept; ---- == Description This function returns the default port for the known schemes. If the value does not represent a known scheme or the scheme does not represent a protocol, the function returns zero. The following ports are returned by the function: * scheme::ftp = 21 * scheme::http , scheme::ws = 80 * scheme::https , scheme::wss = 443 == Return Value An integer with the default port number == Parameters |=== | Name | Description | *s* | The known scheme constant |=== Apply percent‐encoding to a string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encode.hpp#L119[boost/url/encode.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> CS> std::size_t <>( char* dest, std::size_t size, core::string_view s, CS const& unreserved, <> opt = {}); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< <>::<> StringToken = <>::<>, <>::<> CS> StringToken::result_type <>( core::string_view s, CS const& unreserved, <> opt = {}, StringToken&& token = {}) noexcept; ---- [.small]#<># == Description This function applies percent‐encoding to the string using the given options and character set. The destination buffer provided by the caller is used to store the result, which may be truncated if there is insufficient space. === Example [,cpp] ---- char buf[100]; assert( encode( buf, sizeof(buf), "Program Files", pchars ) == 15 ); ---- === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2.1. Percent‐Encoding (rfc3986)] == Return Value The number of characters written to the destination buffer. == Parameters |=== | Name | Description | *dest* | The destination buffer to write to. | *size* | The number of writable characters pointed to by `dest`. If this is less than `encoded_size(s)`, the result is truncated. | *s* | The string to encode. | *unreserved* | The set of characters that is not percent‐encoded. | *opt* | The options for encoding. If this parameter is omitted, the default options are used. | *token* | A string token. |=== == See Also xref:#boost-urls-encode-04[encode], xref:#boost-urls-encoded_size[encoded_size], xref:#boost-urls-make_pct_string_view[make_pct_string_view]. Apply percent‐encoding to a string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encode.hpp#L119[boost/url/encode.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> CS> std::size_t encode( char* dest, std::size_t size, core::string_view s, CS const& unreserved, <> opt = {}); ---- == Description This function applies percent‐encoding to the string using the given options and character set. The destination buffer provided by the caller is used to store the result, which may be truncated if there is insufficient space. === Example [,cpp] ---- char buf[100]; assert( encode( buf, sizeof(buf), "Program Files", pchars ) == 15 ); ---- === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2.1. Percent‐Encoding (rfc3986)] == Return Value The number of characters written to the destination buffer. == Parameters |=== | Name | Description | *dest* | The destination buffer to write to. | *size* | The number of writable characters pointed to by `dest`. If this is less than `encoded_size(s)`, the result is truncated. | *s* | The string to encode. | *unreserved* | The set of characters that is not percent‐encoded. | *opt* | The options for encoding. If this parameter is omitted, the default options are used. |=== == See Also xref:#boost-urls-encode-04[encode], xref:#boost-urls-encoded_size[encoded_size], xref:#boost-urls-make_pct_string_view[make_pct_string_view]. Return a percent‐encoded string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encode.hpp#L183[boost/url/encode.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< <>::<> StringToken = <>::<>, <>::<> CS> StringToken::result_type encode( core::string_view s, CS const& unreserved, <> opt = {}, StringToken&& token = {}) noexcept; ---- == Description This function applies percent‐encoding to the string using the given options and character set, and returns the result as a string when called with default arguments. === Example [,cpp] ---- encoding_opts opt; opt.space_as_plus = true; std::string s = encode( "My Stuff", opt, pchars ); assert( s == "My+Stuff" ); ---- === Exception Safety Calls to allocate may throw. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2.1. Percent‐Encoding (rfc3986)] == Return Value The string == Parameters |=== | Name | Description | *s* | The string to encode. | *unreserved* | The set of characters that is not percent‐encoded. | *opt* | The options for encoding. If this parameter is omitted, the default options are used. | *token* | A string token. |=== == See Also xref:#boost-urls-encode-04[encode], xref:#boost-urls-encoded_size[encoded_size], xref:#boost-urls-encoding_opts[encoding_opts], Return the buffer size needed for percent‐encoding == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encode.hpp#L63[boost/url/encode.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> CS> std::size_t encoded_size( core::string_view s, CS const& unreserved, <> opt = {}) noexcept; ---- == Description This function returns the exact number of bytes necessary to store the result of applying percent‐encoding to the string using the given options and character set. No encoding is actually performed. === Example [,cpp] ---- assert( encoded_size( "My Stuff", pchars ) == 10 ); ---- === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2.1. Percent‐Encoding (rfc3986)] == Return Value The number of bytes needed, excluding any null terminator. == Parameters |=== | Name | Description | *s* | The string to measure. | *unreserved* | The set of characters that is not percent‐encoded. | *opt* | The options for encoding. If this parameter is omitted, the default options are be used. |=== == See Also xref:#boost-urls-encode-04[encode], xref:#boost-urls-encoding_opts[encoding_opts], xref:#boost-urls-make_pct_string_view[make_pct_string_view]. Format arguments into a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L142[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<<>>... Args> <> <>( core::string_view fmt, Args&&... args); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> <>( core::string_view fmt, std::initializer_list<<>> args); ---- [.small]#<># == Description Format arguments according to the format URL string into a xref:#boost-urls-url[url]. The rules for a format URL string are the same as for a `std::format_string`, where replacement fields are delimited by curly braces. The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent‐escaped. Hence, the delimiters between URL components, such as `:`, `//`, `?`, and `#`, should be included in the URL format string. Likewise, a format string with a single `"{}"` is interpreted as a path and any replacement characters invalid in this component will be encoded to form a valid URL. === Example [,cpp] ---- assert(format("{}", "Hello world!").buffer() == "Hello%20world%21"); ---- === Preconditions All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL. Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent‐encoding of arbitrary characters. === BNF [,cpp] ---- replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" identifier ::= id_start id_continue* id_start ::= "a"..."z" | "A"..."Z" | "_" id_continue ::= id_start | digit ---- === Specification * link:https://fmt.dev/latest/syntax.html[Format String Syntax] == Exceptions |=== | Name | Thrown on | `system_error` | `fmt` contains an invalid format string and the result contains an invalid URL after replacements are applied. |=== == Return Value A URL holding the formatted result. == Parameters |=== | Name | Description | *fmt* | The format URL string. | *args* | Arguments to be formatted. |=== == See Also xref:#boost-urls-format_to-0b[format_to], xref:#boost-urls-arg[arg]. Format arguments into a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L314[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> format( core::string_view fmt, std::initializer_list<<>> args); ---- == Description Format arguments according to the format URL string into a xref:#boost-urls-url[url]. This overload allows type‐erased arguments to be passed as an initializer_list, which is mostly convenient for named parameters. All arguments must be convertible to a implementation defined type able to store a type‐erased reference to any valid format argument. The rules for a format URL string are the same as for a `std::format_string`, where replacement fields are delimited by curly braces. The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent‐escaped. Hence, the delimiters between URL components, such as `:`, `//`, `?`, and `#`, should be included in the URL format string. Likewise, a format string with a single `"{}"` is interpreted as a path and any replacement characters invalid in this component will be encoded to form a valid URL. === Example [,cpp] ---- assert(format("user/{id}", {{"id", 1}}).buffer() == "user/1"); ---- === Preconditions All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL. Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent‐encoding of arbitrary characters. === BNF [,cpp] ---- replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" identifier ::= id_start id_continue* id_start ::= "a"..."z" | "A"..."Z" | "_" id_continue ::= id_start | digit ---- === Specification * link:https://fmt.dev/latest/syntax.html[Format String Syntax] == Exceptions |=== | Name | Thrown on | `system_error` | `fmt` contains an invalid format string and the result contains an invalid URL after replacements are applied. |=== == Return Value A URL holding the formatted result. == Parameters |=== | Name | Description | *fmt* | The format URL string. | *args* | Arguments to be formatted. |=== == See Also xref:#boost-urls-format_to-0b[format_to]. Format arguments into a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L142[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<<>>... Args> <> format( core::string_view fmt, Args&&... args); ---- == Description Format arguments according to the format URL string into a xref:#boost-urls-url[url]. The rules for a format URL string are the same as for a `std::format_string`, where replacement fields are delimited by curly braces. The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent‐escaped. Hence, the delimiters between URL components, such as `:`, `//`, `?`, and `#`, should be included in the URL format string. Likewise, a format string with a single `"{}"` is interpreted as a path and any replacement characters invalid in this component will be encoded to form a valid URL. === Example [,cpp] ---- assert(format("{}", "Hello world!").buffer() == "Hello%20world%21"); ---- === Preconditions All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL. Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent‐encoding of arbitrary characters. === BNF [,cpp] ---- replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" identifier ::= id_start id_continue* id_start ::= "a"..."z" | "A"..."Z" | "_" id_continue ::= id_start | digit ---- === Specification * link:https://fmt.dev/latest/syntax.html[Format String Syntax] == Exceptions |=== | Name | Thrown on | `system_error` | `fmt` contains an invalid format string and the result contains an invalid URL after replacements are applied. |=== == Return Value A URL holding the formatted result. == Parameters |=== | Name | Description | *fmt* | The format URL string. | *args* | Arguments to be formatted. |=== == See Also xref:#boost-urls-format_to-0b[format_to], xref:#boost-urls-arg[arg]. Format arguments into a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L225[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<<>>... Args> void <>( <>& u, core::string_view fmt, Args&&... args); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void <>( <>& u, core::string_view fmt, std::initializer_list<<>> args); ---- [.small]#<># == Description Format arguments according to the format URL string into a xref:#boost-urls-url_base[url_base]. The rules for a format URL string are the same as for a `std::format_string`, where replacement fields are delimited by curly braces. The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent‐escaped. Hence, the delimiters between URL components, such as `:`, `//`, `?`, and `#`, should be included in the URL format string. Likewise, a format string with a single `"{}"` is interpreted as a path and any replacement characters invalid in this component will be encoded to form a valid URL. === Example [,cpp] ---- static_url<30> u; format(u, "{}", "Hello world!"); assert(u.buffer() == "Hello%20world%21"); ---- === Preconditions All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL. Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent‐encoding of arbitrary characters. === Exception Safety Strong guarantee. === BNF [,cpp] ---- replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" identifier ::= id_start id_continue* id_start ::= "a"..."z" | "A"..."Z" | "_" id_continue ::= id_start | digit ---- === Specification * link:https://fmt.dev/latest/syntax.html[Format String Syntax] == Exceptions |=== | Name | Thrown on | `system_error` | `fmt` contains an invalid format string and `u` contains an invalid URL after replacements are applied. |=== == Parameters |=== | Name | Description | *u* | An object that derives from xref:#boost-urls-url_base[url_base]. | *fmt* | The format URL string. | *args* | Arguments to be formatted. |=== == See Also xref:#boost-urls-format-02[format]. Format arguments into a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L406[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void format_to( <>& u, core::string_view fmt, std::initializer_list<<>> args); ---- == Description Format arguments according to the format URL string into a xref:#boost-urls-url_base[url_base]. This overload allows type‐erased arguments to be passed as an initializer_list, which is mostly convenient for named parameters. All arguments must be convertible to a implementation defined type able to store a type‐erased reference to any valid format argument. The rules for a format URL string are the same as for a `std::format_string`, where replacement fields are delimited by curly braces. The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent‐escaped. Hence, the delimiters between URL components, such as `:`, `//`, `?`, and `#`, should be included in the URL format string. Likewise, a format string with a single `"{}"` is interpreted as a path and any replacement characters invalid in this component will be encoded to form a valid URL. === Example [,cpp] ---- static_url<30> u; format_to(u, "user/{id}", {{"id", 1}}) assert(u.buffer() == "user/1"); ---- === Preconditions All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL. Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent‐encoding of arbitrary characters. === Exception Safety Strong guarantee. === BNF [,cpp] ---- replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" identifier ::= id_start id_continue* id_start ::= "a"..."z" | "A"..."Z" | "_" id_continue ::= id_start | digit ---- === Specification * link:https://fmt.dev/latest/syntax.html[Format String Syntax] == Exceptions |=== | Name | Thrown on | `system_error` | `fmt` contains an invalid format string and `u` contains an invalid URL after replacements are applied. |=== == Parameters |=== | Name | Description | *u* | An object that derives from xref:#boost-urls-url_base[url_base]. | *fmt* | The format URL string. | *args* | Arguments to be formatted. |=== == See Also xref:#boost-urls-format-02[format]. Format arguments into a URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L225[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<<>>... Args> void format_to( <>& u, core::string_view fmt, Args&&... args); ---- == Description Format arguments according to the format URL string into a xref:#boost-urls-url_base[url_base]. The rules for a format URL string are the same as for a `std::format_string`, where replacement fields are delimited by curly braces. The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent‐escaped. Hence, the delimiters between URL components, such as `:`, `//`, `?`, and `#`, should be included in the URL format string. Likewise, a format string with a single `"{}"` is interpreted as a path and any replacement characters invalid in this component will be encoded to form a valid URL. === Example [,cpp] ---- static_url<30> u; format(u, "{}", "Hello world!"); assert(u.buffer() == "Hello%20world%21"); ---- === Preconditions All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL. Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent‐encoding of arbitrary characters. === Exception Safety Strong guarantee. === BNF [,cpp] ---- replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" identifier ::= id_start id_continue* id_start ::= "a"..."z" | "A"..."Z" | "_" id_continue ::= id_start | digit ---- === Specification * link:https://fmt.dev/latest/syntax.html[Format String Syntax] == Exceptions |=== | Name | Thrown on | `system_error` | `fmt` contains an invalid format string and `u` contains an invalid URL after replacements are applied. |=== == Parameters |=== | Name | Description | *u* | An object that derives from xref:#boost-urls-url_base[url_base]. | *fmt* | The format URL string. | *args* | Arguments to be formatted. |=== == See Also xref:#boost-urls-format-02[format]. Return a valid percent‐encoded string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp#L415[boost/url/pct_string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> make_pct_string_view(core::string_view s) noexcept; ---- == Description If `s` is a valid percent‐encoded string, the function returns the buffer as a valid view which may be used to perform decoding or measurements. Otherwise the result contains an error code. Upon success, the returned view references the original character buffer; Ownership is not transferred. === Complexity Linear in `s.size()`. === Exception Safety Throws nothing. == Parameters |=== | Name | Description | *s* | The string to validate. |=== Return true if two addresses are not equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L252[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a1, <> const& a2) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a1, <> const& a2) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a0, <> const& a1) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>( <> const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( <> const& lhs, S const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( S const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& u0, <> const& u1) noexcept; ---- [.small]#<># Return true if two addresses are not equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L252[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator!=( <> const& a1, <> const& a2) noexcept; ---- Return true if two addresses are not equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L304[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator!=( <> const& a1, <> const& a2) noexcept; ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1266[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator!=( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Compare two decode views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L630[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator!=( <> const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2391[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator!=( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 != u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() != b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 != u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() != b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 != u1` Compare two decode views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L641[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator!=( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for inequality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L653[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator!=( S const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1286[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a0, <> const& a1) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>( <> const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( <> const& lhs, S const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( S const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& u0, <> const& u1) noexcept; ---- [.small]#<># == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1286[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator<( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Compare two decode views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L677[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator<( <> const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2433[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator<( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 < u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() < b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 < u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() < b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 < u1` Compare two decode views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L688[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator<( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for less than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L700[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator<( S const& lhs, <> const& rhs) noexcept; ---- Format the address to an output stream. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L333[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& addr); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& addr); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& a); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& s); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& qp); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& qp); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& u); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& ps); ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& <>( std::ostream& os, <> const& ps); ---- [.small]#<># == Description IPv4 addresses written to output streams are written in their dotted decimal format. Format the address to an output stream. IPv4 addresses written to output streams are written in their dotted decimal format. == Parameters |=== | Name | Description | *os* | The output stream. | *addr* | The address to format. | *a* | The URL to write | *s* | The decoded view to write | *u* | The url to write. |=== Format the address to an output stream. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L333[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& addr); ---- == Description IPv4 addresses written to output streams are written in their dotted decimal format. Format the address to an output stream. IPv4 addresses written to output streams are written in their dotted decimal format. == Parameters |=== | Name | Description | *os* | The output stream. | *addr* | The address to format. | *os* | The output stream. | *addr* | The address to format. |=== Format the address to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L379[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& addr); ---- == Description This hidden friend function writes the address to an output stream using standard notation. Format the address to an output stream This function writes the address to an output stream using standard notation. == Return Value The output stream, for chaining. == Parameters |=== | Name | Description | *os* | The output stream to write to. | *addr* | The address to write. | *os* | The output stream to write to. | *addr* | The address to write. |=== Format the encoded authority to the output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1403[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& a); ---- == Description This hidden friend function serializes the encoded URL to the output stream. === Example [,cpp] ---- authority_view a( "www.example.com" ); std::cout << a << std::endl; ---- Format the encoded authority to the output stream This function serializes the encoded URL to the output stream. === Example [,cpp] ---- authority_view a( "www.example.com" ); std::cout << a << std::endl; ---- == Return Value A reference to the output stream, for chaining == Parameters |=== | Name | Description | *os* | The output stream to write to | *a* | The URL to write | *os* | The output stream to write to | *a* | The URL to write |=== Format the string with percent‐decoding applied to the output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L892[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& s); ---- == Description This hidden friend function serializes the decoded view to the output stream. Format the string with percent‐decoding applied to the output stream This function serializes the decoded view to the output stream. == Return Value A reference to the output stream, for chaining == Parameters |=== | Name | Description | *os* | The output stream to write to | *s* | The decoded view to write | *os* | The output stream to write to | *s* | The decoded view to write |=== Format to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#L562[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& qp); ---- == Description Any percent‐escapes are emitted as‐is; no decoding is performed. === Complexity Linear in `ps.buffer().size()`. === Effects [,cpp] ---- return os << ps.buffer(); ---- Format to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_base.hpp#L512[boost/url/params_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& qp); ---- == Description Any percent‐escapes are emitted as‐is; no decoding is performed. === Complexity Linear in `ps.buffer().size()`. === Effects [,cpp] ---- return os << ps.buffer(); ---- Format the url to the output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2656[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& u); ---- == Description This function serializes the url to the specified output stream. Any percent‐escapes are emitted as‐is; no decoding is performed. === Example [,cpp] ---- url_view u( "http://www.example.com/index.htm" ); std::stringstream ss; ss << u; assert( ss.str() == "http://www.example.com/index.htm" ); ---- === Effects [,cpp] ---- return os << u.buffer(); ---- === Complexity Linear in `u.buffer().size()` === Exception Safety Basic guarantee. Format the url to the output stream This function serializes the url to the specified output stream. Any percent‐escapes are emitted as‐is; no decoding is performed. === Example [,cpp] ---- url_view u( "http://www.example.com/index.htm" ); std::stringstream ss; ss << u; assert( ss.str() == "http://www.example.com/index.htm" ); ---- === Effects [,cpp] ---- return os << u.buffer(); ---- === Complexity Linear in `u.buffer().size()` === Exception Safety Basic guarantee. == Return Value A reference to the output stream, for chaining == Parameters |=== | Name | Description | *os* | The output stream to write to. | *u* | The url to write. | *os* | The output stream to write to. | *u* | The url to write. |=== Format to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_base.hpp#L349[boost/url/segments_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& ps); ---- == Description Any percent‐escapes are emitted as‐is; no decoding is performed. === Complexity Linear in `ps.buffer().size()`. === Effects [,cpp] ---- return os << ps.buffer(); ---- Format to an output stream == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_base.hpp#L337[boost/url/segments_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- std::ostream& operator<<( std::ostream& os, <> const& ps); ---- == Description Any percent‐escapes are emitted as‐is; no decoding is performed. === Complexity Linear in `ps.buffer().size()`. === Effects [,cpp] ---- return os << ps.buffer(); ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1306[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a0, <> const& a1) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>( <> const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( <> const& lhs, S const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( S const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& u0, <> const& u1) noexcept; ---- [.small]#<># == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1306[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator<=( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Compare two decode views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L724[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator<=( <> const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2475[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator<=( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 <= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() <= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 <= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() <= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 <= u1` Compare two decode views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L735[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator<=( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for less than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L747[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator<=( S const& lhs, <> const& rhs) noexcept; ---- Return true if two addresses are equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L241[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a1, <> const& a2) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a1, <> const& a2) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a0, <> const& a1) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>( <> const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( <> const& lhs, S const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( S const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& u0, <> const& u1) noexcept; ---- [.small]#<># Return true if two addresses are equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L241[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator==( <> const& a1, <> const& a2) noexcept; ---- Return true if two addresses are equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L293[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator==( <> const& a1, <> const& a2) noexcept; ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1246[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator==( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Compare two decode views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L583[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator==( <> const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2349[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator==( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 == u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() == b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 == u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() == b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 == u1` Compare two decode views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L594[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator==( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for equality == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L606[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator==( S const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1326[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a0, <> const& a1) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>( <> const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( <> const& lhs, S const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( S const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& u0, <> const& u1) noexcept; ---- [.small]#<># == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1326[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator>( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Compare two decode views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L771[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator>( <> const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2517[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator>( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 > u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() > b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 > u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() > b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 > u1` Compare two decode views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L782[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator>( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for greater than == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L794[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator>( S const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1346[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& a0, <> const& a1) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool <>( <> const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( <> const& lhs, S const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool <>( S const& lhs, <> const& rhs) noexcept; ---- [.small]#<># [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool <>( <> const& u0, <> const& u1) noexcept; ---- [.small]#<># == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1346[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator>=( <> const& a0, <> const& a1) noexcept; ---- == Description === Complexity Linear in `min( a0.size(), a1.size() )` === Exception Safety Throws nothing Compare two decode views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L818[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool operator>=( <> const& lhs, <> const& rhs) noexcept; ---- Return the result of comparing two URLs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L2559[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool operator>=( <> const& u0, <> const& u1) noexcept; ---- == Description The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 >= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() >= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] Return the result of comparing two URLs The URLs are compared component by component as if they were first normalized. === Example [,cpp] ---- url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 >= u1 ); ---- === Effects [,cpp] ---- url a(u0); a.normalize(); url b(u1); b.normalize(); return a.buffer() >= b.buffer(); ---- === Complexity Linear in `min( u0.size(), u1.size() )` === Exception Safety Throws nothing === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2[6.2.2 Syntax‐Based Normalization (rfc3986)] == Return Value `true` if `u0 >= u1` Compare two decode views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L829[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator>=( <> const& lhs, S const& rhs) noexcept; ---- Compare two decode views for greater than or equal == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L841[boost/url/decode_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<std::convertible_to<core::string_view> S> constexpr bool operator>=( S const& lhs, <> const& rhs) noexcept; ---- Return a reference to a parsed URL string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse.hpp#L65[boost/url/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_absolute_uri(core::string_view s); ---- == Description This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed. === Example [,cpp] ---- system::result< url_view > rv = parse_absolute_uri( "http://example.com/index.htm?id=1" ); ---- === BNF [,cpp] ---- absolute-URI = scheme ":" hier-part [ "?" query ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.3[4.3. Absolute URI (rfc3986)] == Exceptions |=== | Name | Thrown on | `std::length_error` | `s.size() > url_view::max_size` |=== == Return Value A result containing a value or an error == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_view[url_view]. Parse an authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1449[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_authority(core::string_view s) noexcept; ---- == Description This function parses a string according to the authority grammar below, and returns an xref:#boost-urls-authority_view[authority_view] referencing the string. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the string extends until the view is no longer being accessed. === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] userinfo = user [ ":" [ password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT ---- === Exception Safety Throws nothing. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == Return Value A view to the parsed authority == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-authority_view[authority_view]. Return an IPv4 address from an IP address string in dotted decimal form == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv4_address.hpp#L343[boost/url/ipv4_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_ipv4_address(core::string_view s) noexcept; ---- Parse a string containing an IPv6 address. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L402[boost/url/ipv6_address.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_ipv6_address(core::string_view s) noexcept; ---- == Description This function attempts to parse the string as an IPv6 address and returns a result containing the address upon success, or an error code if the string does not contain a valid IPv6 address. === Exception Safety Throws nothing. == Return Value A result containing the address. == Parameters |=== | Name | Description | *s* | The string to parse. |=== Return a reference to a parsed URL string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse.hpp#L112[boost/url/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_origin_form(core::string_view s); ---- == Description This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed. === Example [,cpp] ---- system::result< url_view > = parse_origin_form( "/index.htm?layout=mobile" ); ---- === BNF [,cpp] ---- origin-form = absolute-path [ "?" query ] absolute-path = 1*( "/" segment ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1[5.3.1. origin‐form (rfc7230)] == Exceptions |=== | Name | Thrown on | `std::length_error` | `s.size() > url_view::max_size` |=== == Return Value A result containing a value or an error == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_view[url_view]. Parse a string and return an encoded segment view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse_path.hpp#L48[boost/url/parse_path.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_path(core::string_view s) noexcept; ---- == Description This function parses the string and returns the corresponding path object if the string is valid, otherwise returns an error. === BNF [,cpp] ---- path = [ "/" ] segment *( "/" segment ) ---- === Exception Safety No‐throw guarantee. === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Return Value A valid view on success, otherwise an error code. == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-segments_encoded_view[segments_encoded_view]. Parse a string and return an encoded params view == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse_query.hpp#L47[boost/url/parse_query.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_query(core::string_view s) noexcept; ---- == Description This function parses the string and returns the corresponding params object if the string is valid, otherwise returns an error. === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) ---- === Exception Safety No‐throw guarantee. === Specification == Return Value A valid view on success, otherwise an error code. == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-params_encoded_view[params_encoded_view]. Return a reference to a parsed URL string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse.hpp#L165[boost/url/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_relative_ref(core::string_view s); ---- == Description This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed. === Example [,cpp] ---- system::result< url_view > = parse_relative_ref( "images/dot.gif?v=hide#a" ); ---- === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-abempty / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] * link:https://www.rfc-editor.org/errata/eid5428[Errata ID: 5428 (rfc3986)] == Exceptions |=== | Name | Thrown on | `std::length_error` | `s.size() > url_view::max_size` |=== == Return Value A result containing a value or an error == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_view[url_view]. Return a reference to a parsed URL string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse.hpp#L215[boost/url/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_uri(core::string_view s); ---- == Description This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed. === Example [,cpp] ---- system::result< url_view > = parse_uri( "https://www.example.com/index.htm?id=guest#s1" ); ---- === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3[3. Syntax Components (rfc3986)] == Exceptions |=== | Name | Thrown on | `std::length_error` | `s.size() > url_view::max_size` |=== == Return Value A result containing a value or an error == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_view[url_view]. Return a reference to a parsed URL string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/parse.hpp#L277[boost/url/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<<>> parse_uri_reference(core::string_view s); ---- == Description This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed. === Example [,cpp] ---- system::result< url_view > = parse_uri_reference( "ws://echo.example.com/?name=boost#demo" ); ---- === BNF [,cpp] ---- URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-abempty / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference (rfc3986)] * link:https://www.rfc-editor.org/errata/eid5428[Errata ID: 5428 (rfc3986)] == Exceptions |=== | Name | Thrown on | `std::length_error` | `s.size() > url_view::max_size` |=== == Return Value A result containing a value or an error == Parameters |=== | Name | Description | *s* | The string to parse |=== == See Also xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-url_view[url_view]. Rule for a string with percent‐encoded escapes == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/pct_encoded_rule.hpp#L130[boost/url/rfc/pct_encoded_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<<>::<> CS> constexpr /* implementation-defined */::<><CS> pct_encoded_rule(CS const& cs) noexcept; ---- == Description This function returns a rule which matches a percent‐encoded string, permitting characters in the string which are also in the specified character set to be used unescaped. === Value Type [,cpp] ---- using value_type = pct_string_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" system::result< pct_string_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( pchars ) ); ---- === BNF [,cpp] ---- pct-encoded = "%" HEXDIG HEXDIG ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[ 2.1. Percent‐Encoding (rfc3986)] == Parameters |=== | Name | Description | *cs* | The character set indicating which characters are allowed without escapes. Any character which is not in this set must be escaped, or else parsing returns an error. |=== == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-pchars[pchars], xref:#boost-urls-pct_string_view[pct_string_view]. Resolve a URL reference against a base URL == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L2788[boost/url/url_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- system::result<void> resolve( <> const& base, <> const& ref, <>& dest); ---- == Description This function attempts to resolve a URL reference `ref` against the base URL `base` in a manner similar to that of a web browser resolving an anchor tag. The base URL must satisfy the _URI_ grammar. In other words, it must contain a scheme. Relative references are only usable when in the context of a base absolute URI. This process of resolving a relative _reference_ within the context of a _base_ URI is defined in detail in rfc3986 (see below). The resolution process works as if the relative reference is appended to the base URI and the result is normalized. Given the input base URL, this function resolves the relative reference as if performing the following steps: * Ensure the base URI has at least a scheme * Normalizing the reference path * Merge base and reference paths * Normalize the merged path This function places the result of the resolution into `dest`, which can be any of the url containers that inherit from xref:#boost-urls-url_base[url_base]. If an error occurs, the contents of `dest` is unspecified and `ec` is set. [NOTE] Abnormal hrefs where the number of ".." segments exceeds the number of segments in the base path are handled by including the unmatched ".." segments in the result, as described in link:https://www.rfc-editor.org/errata/eid4547[Errata 4547]. === Example [,cpp] ---- url dest; system::error_code ec; resolve("/one/two/three", "four", dest, ec); assert( dest.str() == "/one/two/four" ); resolve("http://example.com/", "/one", dest, ec); assert( dest.str() == "http://example.com/one" ); resolve("http://example.com/one", "/two", dest, ec); assert( dest.str() == "http://example.com/two" ); resolve("http://a/b/c/d;p?q", "g#s", dest, ec); assert( dest.str() == "http://a/b/c/g#s" ); ---- === BNF [,cpp] ---- absolute-URI = scheme ":" hier-part [ "?" query ] ---- === Exception Safety Basic guarantee. Calls to allocate may throw. === Specification link:https://datatracker.ietf.org/doc/html/rfc3986#section-5[5. Reference Resolution (rfc3986)] == Return Value An empty result upon success, otherwise an error code if `!base.has_scheme()`. == Parameters |=== | Name | Description | *base* | The base URL to resolve against. | *ref* | The URL reference to resolve. | *dest* | The container where the result is written, upon success. |=== == See Also xref:#boost-urls-url[url], xref:#boost-urls-url_view[url_view]. Return the known scheme for a non‐normalized string, if known == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/scheme.hpp#L141[boost/url/scheme.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- <> string_to_scheme(core::string_view s) noexcept; ---- == Description If the string does not identify a known scheme, the value xref:#boost-urls-scheme[scheme::unknown] is returned. === BNF [,cpp] ---- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] == Return Value The known scheme == Parameters |=== | Name | Description | *s* | The string holding the scheme |=== Swap == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L397[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void swap( <>& v0, <>& v1) noexcept; ---- == Description Exchanges the contents of `v0` with another `v1`. All views, iterators and references remain valid. If `&v0 == &v1`, this function call has no effect. === Example [,cpp] ---- url u1( "https://www.example.com" ); url u2( "https://www.boost.org" ); std::swap(u1, u2); assert(u1 == "https://www.boost.org" ); assert(u2 == "https://www.example.com" ); ---- === Effects [,cpp] ---- v0.swap( v1 ); ---- === Complexity Constant === Exception Safety Throws nothing == Parameters |=== | Name | Description | *v0* | The first object to swap | *v1* | The second object to swap |=== == See Also xref:#boost-urls-url-swap[url::swap] Return the normalized string for a known scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/scheme.hpp#L151[boost/url/scheme.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view to_string(<> s) noexcept; ---- == Return Value A string representing the known scheme == Parameters |=== | Name | Description | *s* | The known scheme constant |=== Error codes returned the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/error.hpp#L22[boost/url/error.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- enum class error : int; ---- == Members [,cols=2] |=== |Name |Description |`success` |The operation completed successfully. |`illegal_null` |Null encountered in pct‐encoded. |`illegal_reserved_char` |Illegal reserved character in encoded string. |`non_canonical` |A grammar element was not in canonical form. |`bad_pct_hexdig` |Bad hexadecimal digit. |`incomplete_encoding` |The percent‐encoded sequence is incomplete. |`missing_pct_hexdig` |Missing hexadecimal digit. |`no_space` |No space in output buffer |`not_a_base` |The URL is not a base URL |=== Identifies the type of host in a URL. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/host_type.hpp#L24[boost/url/host_type.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- enum class host_type : int; ---- == Members [,cols=2] |=== |Name |Description |`none` |No host is specified. |`name` |A host is specified by reg‐name. |`ipv4` |A host is specified by xref:#boost-urls-ipv4_address[ipv4_address]. |`ipv6` |A host is specified by xref:#boost-urls-ipv6_address[ipv6_address]. |`ipvfuture` |A host is specified by IPvFuture. |=== == Description Values of this type are returned by URL views and containers to indicate the type of host present in a URL. Identifies a known URL scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/scheme.hpp#L33[boost/url/scheme.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- enum class scheme : unsigned short; ---- == Members [,cols=2] |=== |Name |Description |`none` |Indicates that no scheme is present |`unknown` |Indicates the scheme is not a well‐known scheme |`ftp` |File Transfer Protocol (FTP) |`file` |File URI Scheme |`http` |The Hypertext Transfer Protocol URI Scheme |`https` |The Secure Hypertext Transfer Protocol URI Scheme |`ws` |The WebSocket URI Scheme |`wss` |The Secure WebSocket URI Scheme |=== == Description === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)] A temporary reference to a formatting argument == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L72[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using format_arg = /* implementation-defined */::format_arg; ---- == Description This class represents a temporary reference to a formatting argument used by the xref:#boost-urls-format-02[format] function. A xref:#boost-urls-format-02[format] argument should always be created by passing the argument to be formatted directly to the xref:#boost-urls-format-02[format] function. Any type that can be formatted into a URL with the xref:#boost-urls-format-02[format] function is convertible to this type. This includes basic types, types convertible to `core::string_view`, and xref:#boost-urls-named_arg[named_arg]. == See Also xref:#boost-urls-format-02[format], xref:#boost-urls-format_to-0b[format_to], xref:#boost-urls-arg[arg]. A temporary reference to a named formatting argument == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/format.hpp#L47[boost/url/format.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using named_arg = /* implementation-defined */::named_arg<T>; ---- == Description This class represents a temporary reference to a named formatting argument used by the xref:#boost-urls-format-02[format] function. Named arguments should always be created with the xref:#boost-urls-arg[arg] function. Any type that can be formatted into a URL with the xref:#boost-urls-format-02[format] function can also be used in a named argument. All named arguments are convertible to xref:#boost-urls-format_arg[format_arg] and can be used in the xref:#boost-urls-format-02[format] function. == See Also xref:#boost-urls-arg[arg], xref:#boost-urls-format-02[format], xref:#boost-urls-format_to-0b[format_to], xref:#boost-urls-format_arg[format_arg]. The type of optional used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/optional.hpp#L38[boost/url/optional.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> using optional = <>::optional<T>; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `boost::optional` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. The type of string_view used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/string_view.hpp#L45[boost/url/string_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using string_view = <>::core::string_view; ---- == Description String views are used to pass character buffers into or out of functions. Ownership of the underlying character buffer is not transferred; the caller is responsible for ensuring that the lifetime of character buffer extends until it is no longer referenced. [WARNING] This alias is no longer supported and should not be used in new code. Please use `core::string_view` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. The type of variant used by the library == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/variant.hpp#L37[boost/url/variant.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Ts> using variant = <>::variant2::variant<Ts...>; ---- == Description [WARNING] This alias is no longer supported and should not be used in new code. Please use `boost::variant2::variant` instead. This alias is included for backwards compatibility with earlier versions of the library. However, it will be removed in future releases, and using it in new code is not recommended. Please use the updated version instead to ensure compatibility with future versions of the library. Rule for absolute‐URI == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/absolute_uri_rule.hpp#L67[boost/url/rfc/absolute_uri_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr /* implementation-defined */::<> absolute_uri_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = url_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< url_view > rv = grammar::parse( "http://example.com/index.htm?id=1", absolute_uri_rule ); ---- === BNF [,cpp] ---- absolute-URI = scheme ":" hier-part [ "?" query ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.3[4.3. Absolute URI (rfc3986)] == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-parse_absolute_uri[parse_absolute_uri], xref:#boost-urls-url_view[url_view]. Rule for authority == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/authority_rule.hpp#L93[boost/url/rfc/authority_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> authority_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = authority_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< authority_view > rv = grammar::parse( "user:pass@example.com:8080", authority_rule ); ---- === BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)] == See Also xref:#boost-urls-authority_view[authority_view], xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-parse_authority[parse_authority]. The gen‐delims character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/gen_delim_chars.hpp#L44[boost/url/rfc/gen_delim_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>::<> gen_delim_chars = ":/?#[]@"; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[grammar::find_if] and xref:#boost-urls-grammar-find_if_not[grammar::find_if_not]. [,cpp] ---- system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( gen_delim_chars ) ); ---- === BNF [,cpp] ---- gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.2[2.2. Reserved Characters (rfc3986)] == See Also xref:#boost-urls-grammar-find_if[grammar::find_if], xref:#boost-urls-grammar-find_if_not[grammar::find_if_not], xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule]. Ignore case when comparing == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ignore_case.hpp#L29[boost/url/ignore_case.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr /* implementation-defined */::<> ignore_case = {}; ---- == Description This value may be optionally passed to functions accepting a parameter of type xref:#boost-urls-ignore_case_param[ignore_case_param] to indicate that comparisons should be case‐insensitive. Rule for an IP version 4 style address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/ipv4_address_rule.hpp#L109[boost/url/rfc/ipv4_address_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> ipv4_address_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = ipv4_address; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< ipv4_address > rv = grammar::parse( "192.168.0.1", ipv4_address_rule ); ---- === BNF [,cpp] ---- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ---- === Specification * link:https://en.wikipedia.org/wiki/IPv4[IPv4 (Wikipedia)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == See Also xref:#boost-urls-ipv4_address[ipv4_address], xref:#boost-urls-parse_ipv4_address[parse_ipv4_address], xref:#boost-urls-grammar-parse-02[grammar::parse]. Rule for An IP version 6 style address == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/ipv6_address_rule.hpp#L125[boost/url/rfc/ipv6_address_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> ipv6_address_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = ipv6_address; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< ipv6_address > rv = grammar::parse( "2001:0db8:85a3:0000:0000:8a2e:0370:7334", ipv6_address_rule ); ---- === BNF [,cpp] ---- IPv6address = 6( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32 / [ h16 ] "::" 4( h16 ":" ) ls32 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 / [ *4( h16 ":" ) h16 ] "::" ls32 / [ *5( h16 ":" ) h16 ] "::" h16 / [ *6( h16 ":" ) h16 ] "::" ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291[IP Version 6 Addressing Architecture (rfc4291)] * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] == See Also xref:#boost-urls-ipv6_address[ipv6_address], xref:#boost-urls-parse_ipv6_address[parse_ipv6_address], xref:#boost-urls-grammar-parse-02[grammar::parse]. Constant indicating no value in a param == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L36[boost/url/param.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <> no_value = {}; ---- Rule for origin‐form == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/origin_form_rule.hpp#L65[boost/url/rfc/origin_form_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr /* implementation-defined */::<> origin_form_rule = {}; ---- == Description This appears in the HTTP/1 request‐line grammar. === Value Type [,cpp] ---- using value_type = url_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< url_view > rv = grammar::parse( "/index.htm?layout=mobile", origin_form_rule ); ---- === BNF [,cpp] ---- origin-form = absolute-path [ "?" query ] absolute-path = 1*( "/" segment ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1[5.3.1. origin‐form (rfc7230)] == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-parse_origin_form[parse_origin_form], xref:#boost-urls-url_view[url_view]. The path character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/pchars.hpp#L45[boost/url/rfc/pchars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr auto pchars = unreserved_chars + sub_delim_chars + ':' + '@'; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[grammar::find_if] and xref:#boost-urls-grammar-find_if_not[grammar::find_if_not]. [,cpp] ---- system::result< decode_view > rv = grammar::parse( "Program%20Files", pchars ); ---- === BNF [,cpp] ---- pchar = unreserved / pct-encoded / sub-delims / ":" / "@" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == See Also xref:#boost-urls-grammar-find_if[grammar::find_if], xref:#boost-urls-grammar-find_if_not[grammar::find_if_not], xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule]. Rule for query == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/query_rule.hpp#L110[boost/url/rfc/query_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> query_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = params_encoded_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< params_encoded_view > rv = grammar::parse( "format=web&id=42&compact", query_rule ); ---- === BNF [,cpp] ---- query = *( pchar / "/" / "?" ) query-params = [ query-param ] *( "&" query-param ) query-param = key [ "=" value ] key = *qpchar value = *( qpchar / "=" ) qpchar = unreserved / pct-encoded / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / ";" / ":" / "@" / "/" / "?" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-params_encoded_view[params_encoded_view]. Rule for relative‐ref == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/relative_ref_rule.hpp#L92[boost/url/rfc/relative_ref_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> relative_ref_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = url_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< url_view > rv = grammar::parse( "images/dot.gif?v=hide#a", relative_ref_rule ); ---- === BNF [,cpp] ---- relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.2[4.2. Relative Reference (rfc3986)] == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-parse_relative_ref[parse_relative_ref], xref:#boost-urls-url_view[url_view]. The reserved character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/reserved_chars.hpp#L39[boost/url/rfc/reserved_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr auto reserved_chars = ~unreserved_chars; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[grammar::find_if] and xref:#boost-urls-grammar-find_if_not[grammar::find_if_not]. [,cpp] ---- system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( reserved_chars ) ); ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.3[2.3. Unreserved Characters (rfc3986)] == See Also xref:#boost-urls-grammar-find_if[grammar::find_if], xref:#boost-urls-grammar-find_if_not[grammar::find_if_not], xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule]. The sub‐delims character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/sub_delim_chars.hpp#L45[boost/url/rfc/sub_delim_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>::<> sub_delim_chars = "!$&()*+,;=\x27"; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[grammar::find_if] and xref:#boost-urls-grammar-find_if_not[grammar::find_if_not]. [,cpp] ---- system::result< decode_view > = grammar::parse( "Program%20Files", pct_encoded_rule( sub_delim_chars ) ); ---- === BNF [,cpp] ---- sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.2[2.2. Reserved Characters (rfc3986)] == See Also xref:#boost-urls-grammar-find_if[grammar::find_if], xref:#boost-urls-grammar-find_if_not[grammar::find_if_not], xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule]. The unreserved character set == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/unreserved_chars.hpp#L44[boost/url/rfc/unreserved_chars.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr <>::<> unreserved_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "‐._~"; ---- == Description === Example Character sets are used with rules and the functions xref:#boost-urls-grammar-find_if[grammar::find_if] and xref:#boost-urls-grammar-find_if_not[grammar::find_if_not]. [,cpp] ---- system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( unreserved_chars ) ); ---- === BNF [,cpp] ---- unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.3[2.3. Unreserved Characters (rfc3986)] == See Also xref:#boost-urls-grammar-find_if[grammar::find_if], xref:#boost-urls-grammar-find_if_not[grammar::find_if_not], xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-pct_encoded_rule[pct_encoded_rule]. Rule for URI‐reference == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/uri_reference_rule.hpp#L98[boost/url/rfc/uri_reference_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> uri_reference_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = url_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< url_view > rv = grammar::parse( "ws://echo.example.com/?name=boost#demo", uri_reference_rule ); ---- === BNF [,cpp] ---- URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3[3. Syntax Components (rfc3986)] == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-parse_uri_reference[parse_uri_reference], xref:#boost-urls-url_view[url_view]. Rule for URI == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/uri_rule.hpp#L92[boost/url/rfc/uri_rule.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr /* implementation-defined */::<> uri_rule = {}; ---- == Description === Value Type [,cpp] ---- using value_type = url_view; ---- === Example Rules are used with the function xref:#boost-urls-grammar-parse-02[grammar::parse]. [,cpp] ---- system::result< url_view > rv = grammar::parse( "https://www.example.com/index.htm?id=guest#s1", uri_rule ); ---- === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3[3. Syntax Components (rfc3986)] == See Also xref:#boost-urls-grammar-parse-02[grammar::parse], xref:#boost-urls-parse_uri[parse_uri], xref:#boost-urls-url_view[url_view]. [.small]#Created with https://www.mrdocs.com[MrDocs]#