17 #ifndef COM_BORA_SOFTWARE__BALAU_RESOURCE__URL 18 #define COM_BORA_SOFTWARE__BALAU_RESOURCE__URL 45 public:
size_t hashcode() const noexcept
override {
46 return std::hash<std::string>()(uri);
51 protected:
Url() =
default;
53 protected:
explicit Url(std::string && uri_) : uri(std::move(uri_)) {}
55 protected:
explicit Url(std::string_view uri_) : uri(std::string(uri_)) {}
57 protected:
explicit Url(
const char * uri_) : uri(std::string(uri_)) {}
59 protected:
Url(
const Url & copy) : uri(copy.uri) {}
61 protected:
Url(
Url && rhs) noexcept : uri(std::move(rhs.uri)) {}
63 protected: std::string appendPathComponent(
const std::string & pathComponent)
const {
68 components.
scheme(),
"://", components.
host(), components.
path(),
"/", pathComponent
73 url += components.
query();
85 protected: std::string uri;
90 #endif // COM_BORA_SOFTWARE__BALAU_RESOURCE__URL std::string_view fragment() const
Obtain a string view to the fragment.
Definition: UriComponents.hpp:272
size_t hashcode() const noexcept override
Get the URI's hash code.
Definition: Url.hpp:45
An abstract universal resource identifier.
Definition: Uri.hpp:131
The unified resource class hierarchy.
Definition: ByteReadResource.hpp:24
std::string_view query() const
Obtain a string view to the query.
Definition: UriComponents.hpp:252
bool hasFragment() const
Returns true if the URI has a fragment.
Definition: UriComponents.hpp:168
std::string_view host() const
Obtain a string view to the host.
Definition: UriComponents.hpp:205
std::string toUriString() const override
Get a string representing the URI, complete with scheme.
Definition: Url.hpp:37
bool isRegularDirectory() const override
Returns true if the URI points to a file directory.
Definition: Url.hpp:29
Balau::U8String< AllocatorT > toString(const File &file)
Print the file URI as a UTF-8 string.
Definition: File.hpp:724
std::string_view scheme() const
Obtain a string view to the scheme.
Definition: UriComponents.hpp:177
std::string toRawString() const override
Get a string representing the raw URI.
Definition: Url.hpp:41
bool hasQuery() const
Returns true if the URI has a query.
Definition: UriComponents.hpp:159
std::string_view path() const
Obtain a string view to the path.
Definition: UriComponents.hpp:234
bool isRegularFile() const override
Returns true if the URI is a regular file.
Definition: Url.hpp:33
A class representing the parsed components of a URI.
The abstract URI base class.
An abstract Url (either http or https).
Definition: Url.hpp:28
Parses a URI and provides views into the URI's components.
Definition: UriComponents.hpp:52