12 #ifndef ROC_ADDRESS_ENDPOINT_URI_H_
13 #define ROC_ADDRESS_ENDPOINT_URI_H_
134 void set_service_from_port_(
int port);
138 PartProto = (1 << 0),
145 bool part_is_valid_(Part part)
const;
146 void set_valid_(Part part);
147 void set_invalid_(Part part);
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
ROC_ATTR_NODISCARD bool set_encoded_query(const char *str)
Set query. String should be percent-encoded.
ROC_ATTR_NODISCARD bool set_encoded_path(const char *str, size_t str_len)
Set encoded URI path. String should be percent-encoded. String should not be zero-terminated.
@ Subset_Resource
Absolute path and query.
void invalidate(Subset subset)
Invalidate given subset of the URI.
void clear(Subset subset)
Clear given subset of the URI.
const char * encoded_query() const
Raw query.
ROC_ATTR_NODISCARD bool format_host(core::StringBuilder &dst) const
Get URI host.
int port() const
TCP or UDP port.
const char * path() const
Decoded path.
ROC_ATTR_NODISCARD bool format_encoded_path(core::StringBuilder &dst) const
Get URI path. String will be percent-encoded.
bool is_equal(const EndpointUri &other) const
Check if URI is equivalent to another URI.
ROC_ATTR_NODISCARD bool format_proto(core::StringBuilder &dst) const
Get URI proto.
ROC_ATTR_NODISCARD bool set_port(int)
Set port.
EndpointUri(core::IArena &)
Initialize empty URI.
ROC_ATTR_NODISCARD bool set_proto(Protocol)
Set protocol ID (URI scheme).
bool verify(Subset subset) const
Check given subset of the URI.
ROC_ATTR_NODISCARD bool set_host(const char *str)
Set URI host. String should be zero-terminated.
const char * host() const
Hostname or IP address.
ROC_ATTR_NODISCARD bool set_encoded_path(const char *str)
Set encoded URI path. String should be percent-encoded.
ROC_ATTR_NODISCARD bool set_path(const char *str, size_t str_len)
Set decoded URI path. String should not be zero-terminated.
Protocol proto() const
Protocol ID (URI scheme).
ROC_ATTR_NODISCARD bool assign(const EndpointUri &other)
Copy data from another URI.
ROC_ATTR_NODISCARD bool set_encoded_query(const char *str, size_t str_len)
Set query. String should be percent-encoded. String should not be zero-terminated.
ROC_ATTR_NODISCARD bool format_encoded_query(core::StringBuilder &dst) const
Get URI query. String will be percent-encoded.
ROC_ATTR_NODISCARD bool set_host(const char *str, size_t str_len)
Set URI host. String should not be zero-terminated.
const char * service() const
Get string representation of port. If port is not set, default port for the protocol is used....
ROC_ATTR_NODISCARD bool get_port(int &port) const
Get URI port.
ROC_ATTR_NODISCARD bool get_proto(Protocol &proto) const
Get protocol ID (URI scheme).
ROC_ATTR_NODISCARD bool set_path(const char *str)
Set decoded URI path.
Base class for non-copyable objects.
ROC_ATTR_NODISCARD bool format_endpoint_uri(const EndpointUri &uri, EndpointUri::Subset subset, core::StringBuilder &dst)
Format EndpointUri to string.
ROC_ATTR_NODISCARD bool parse_endpoint_uri(const char *str, EndpointUri::Subset subset, EndpointUri &result)
Parse EndpointUri from string.
Commonly used types and functions.