Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::runtime::Url Struct Reference

Parsed URL components. More...

#include <url.hpp>

Public Member Functions

bool empty () const
 True when all components are empty / default.
uint16_t default_port () const
 Default port for the scheme — e.g.
uint16_t effective_port () const
 Effective port — port if non-zero, otherwise default_port().
std::string to_string () const
 Serialize back to text form.

Static Public Member Functions

static std::optional< Url > parse (std::string_view text)
 Parse a URL string.
static bool is_valid (std::string_view text)
 True if text parses as a URL with at least a scheme.

Public Attributes

std::string scheme
std::string user
std::string password
std::string host
uint16_t port = 0
std::string path
std::string query
std::string fragment

Detailed Description

Parsed URL components.

All fields default to empty / absent. port is 0 when absent, which is also "scheme default".

Member Function Documentation

◆ default_port()

uint16_t pulp::runtime::Url::default_port ( ) const

Default port for the scheme — e.g.

http=80, https=443, ftp=21, ws=80, wss=443. Returns 0 for unknown schemes.

◆ effective_port()

uint16_t pulp::runtime::Url::effective_port ( ) const
inline

Effective port — port if non-zero, otherwise default_port().

◆ empty()

bool pulp::runtime::Url::empty ( ) const
inline

True when all components are empty / default.

◆ is_valid()

bool pulp::runtime::Url::is_valid ( std::string_view text)
inlinestatic

True if text parses as a URL with at least a scheme.

◆ parse()

std::optional< Url > pulp::runtime::Url::parse ( std::string_view text)
static

Parse a URL string.

Returns std::nullopt on a structurally invalid input (missing scheme or unterminated bracketed IPv6 host). Empty optional fields are normal and not an error.

◆ to_string()

std::string pulp::runtime::Url::to_string ( ) const

Serialize back to text form.

Includes user/password only when present. Brackets IPv6 hosts.

Member Data Documentation

◆ fragment

std::string pulp::runtime::Url::fragment

◆ host

std::string pulp::runtime::Url::host

◆ password

std::string pulp::runtime::Url::password

◆ path

std::string pulp::runtime::Url::path

◆ port

uint16_t pulp::runtime::Url::port = 0

◆ query

std::string pulp::runtime::Url::query

◆ scheme

std::string pulp::runtime::Url::scheme

◆ user

std::string pulp::runtime::Url::user

The documentation for this struct was generated from the following file:
  • /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/url.hpp