148 template<
typename CharTraits,
typename Allocator>
149 explicit URI(
const std::basic_string<char, CharTraits, Allocator>& raw) :
URI(
StringView(raw)) {}
335 return view.substr(
part.offset,
part.length);
345 return string.starts_with(
'[') &&
string.ends_with(
']');
352 && lhs.getUserInfo() == rhs.getUserInfo()
353 && lhs.getHost() == rhs.getHost()
354 && lhs.getPort() == rhs.getPort()
355 && lhs.getPath() == rhs.getPath()
356 && lhs.getQuery() == rhs.getQuery()
357 && lhs.getFragment() == rhs.getFragment();
363 || lhs.getUserInfo() != rhs.getUserInfo()
364 || lhs.getHost() != rhs.getHost()
365 || lhs.getPort() != rhs.getPort()
366 || lhs.getPath() != rhs.getPath()
367 || lhs.getQuery() != rhs.getQuery()
368 || lhs.getFragment() != rhs.getFragment();
#define CE_EXPLICIT(EXPR)
Definition Macros.hpp:413
Path to file or directory.
Definition FilePath.hpp:37
A Uniform Resource Identifier (URI) is a unique sequence of characters that identifies a logical or p...
Definition URI.hpp:54
bool isHostNested() const noexcept
Checks if the host is a nested URI.
Definition URI.hpp:221
StringView get(const Part &part) const noexcept
Gets a URI part.
Definition URI.hpp:333
StringView getQuery() const noexcept
An optional query component preceded by a question mark (?), containing a query string of non-hierarc...
Definition URI.hpp:263
URI(URI &&)=default
Moves a URI from another.
bool isPathNested() const noexcept
Checks if the path is a nested URI.
Definition URI.hpp:251
StringView getPath() const noexcept
A path component, consisting of a sequence of path segments separated by a slash (/).
Definition URI.hpp:248
void clearPort()
An optional port subcomponent preceded by a colon (:).
Definition URI.hpp:245
bool hasUserInfo() const noexcept
An optional userinfo subcomponent that may consist of a user name and an optional password preceded b...
Definition URI.hpp:212
Part mUserInfo
An optional userinfo subcomponent that may consist of a user name and an optional password preceded b...
Definition URI.hpp:78
Part mScheme
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginnin...
Definition URI.hpp:69
void clearUserInfo()
An optional userinfo subcomponent that may consist of a user name and an optional password preceded b...
Definition URI.hpp:215
URI(const StringView raw)
Creates a new URI by parsing it from a raw string.
Definition URI.hpp:132
TRange< std::size_t > Part
A type used to internally represent a range in that contains the sub-string range contained in mData.
Definition URI.hpp:58
Part mFragment
An optional fragment component preceded by a hash (#).
Definition URI.hpp:115
void setHost(const StringView host)
A host subcomponent, consisting of either a registered name (including but not limited to a hostname)...
Definition URI.hpp:224
void set(const Part &part, StringView newContent)
Sets (and changes the content) of a URI part.
Part mPort
An optional port subcomponent preceded by a colon (:).
Definition URI.hpp:87
bool hasHost() const noexcept
A host subcomponent, consisting of either a registered name (including but not limited to a hostname)...
Definition URI.hpp:227
URI & operator=(URI &&)=default
Moves a URI from another.
bool hasPort() const noexcept
An optional port subcomponent preceded by a colon (:).
Definition URI.hpp:242
bool isFragmentNested() const noexcept
Checks if the fragment is a nested URI.
Definition URI.hpp:281
bool isPartNested(const Part &part) const noexcept
Definition URI.hpp:343
bool isQueryNested() const noexcept
Checks if the query is a nested URI.
Definition URI.hpp:266
bool hasQuery() const noexcept
An optional query component preceded by a question mark (?), containing a query string of non-hierarc...
Definition URI.hpp:272
URI(const std::string_view raw)
Creates a new URI by parsing it from a raw string.
Definition URI.hpp:144
URI(const FilePath &path)
Creates a new URI by parsing it from a raw string.
void clearHost()
A host subcomponent, consisting of either a registered name (including but not limited to a hostname)...
Definition URI.hpp:230
bool isAbsolute() const noexcept
Checks if the parsed URI is an absolute (and complete) URI.
Definition URI.hpp:300
void setFragment(const StringView fragment)
An optional fragment component preceded by a hash (#).
Definition URI.hpp:284
void clearFragment()
An optional fragment component preceded by a hash (#).
Definition URI.hpp:290
bool hasPath() const noexcept
A path component, consisting of a sequence of path segments separated by a slash (/).
Definition URI.hpp:257
StringView getHost() const noexcept
A host subcomponent, consisting of either a registered name (including but not limited to a hostname)...
Definition URI.hpp:218
Part mPath
A path component, consisting of a sequence of path segments separated by a slash (/).
Definition URI.hpp:101
String mData
The raw URI data.
Definition URI.hpp:120
URI & operator=(const URI &)=default
Copies a URI from another.
void clearScheme()
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginnin...
Definition URI.hpp:200
void setPort(const StringView port)
An optional port subcomponent preceded by a colon (:).
Definition URI.hpp:239
bool isRelative() const noexcept
Checks if the parsed URI is a relative reference URI.
Definition URI.hpp:297
bool isUserInfoNested() const noexcept
Checks if the user-info is a nested URI.
Definition URI.hpp:206
bool isEmpty() const noexcept
Checks if the URI is empty.
void setUserInfo(const StringView userInfo)
An optional userinfo subcomponent that may consist of a user name and an optional password preceded b...
Definition URI.hpp:209
Part mHost
A host subcomponent, consisting of either a registered name (including but not limited to a hostname)...
Definition URI.hpp:84
bool hasScheme() const noexcept
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginnin...
Definition URI.hpp:197
URI(const URI &absolute, const URI &relative)
Creates a new URI by resolving relative using absolute as the reference.
Definition URI.hpp:175
Part mQuery
An optional query component preceded by a question mark (?), containing a query string of non-hierarc...
Definition URI.hpp:107
bool empty() const noexcept
Checks if the URI is empty.
Definition URI.hpp:321
void clearPath()
A path component, consisting of a sequence of path segments separated by a slash (/).
Definition URI.hpp:260
void setQuery(const StringView query)
An optional query component preceded by a question mark (?), containing a query string of non-hierarc...
Definition URI.hpp:269
URI()=default
Creates a new empty URI.
URI(String raw)
Creates a new URI by parsing it from a raw string.
StringView getUserInfo() const noexcept
An optional userinfo subcomponent that may consist of a user name and an optional password preceded b...
Definition URI.hpp:203
StringView getScheme() const noexcept
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginnin...
Definition URI.hpp:191
void setPath(const StringView path)
A path component, consisting of a sequence of path segments separated by a slash (/).
Definition URI.hpp:254
URI resolve(const URI &relative) const
Resolves a relative URI using this URI as the reference.
StringView getPort() const noexcept
An optional port subcomponent preceded by a colon (:).
Definition URI.hpp:233
void clearQuery()
An optional query component preceded by a question mark (?), containing a query string of non-hierarc...
Definition URI.hpp:275
void clear() noexcept
Clears the URI content.
void setScheme(const StringView scheme)
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginnin...
Definition URI.hpp:194
URI(const StringView scheme, const StringView path, const StringView host=StringView(), const StringView port=StringView(), const StringView query=StringView(), const StringView fragment=StringView(), const StringView userInfo=StringView())
Creates a new URI from individual parts.
Definition URI.hpp:159
URI canonicalize() const
Converts the URI into a canonical form.
bool tryParse(String string)
Tries to parse the URI from a string.
String toString() const
Converts the URI object into it's string representation.
URI(const URI &)=default
Copies a URI from another.
URI(const std::basic_string< char, CharTraits, Allocator > &raw)
Creates a new URI by parsing it from a raw string.
Definition URI.hpp:149
StringView getFragment() const noexcept
An optional fragment component preceded by a hash (#).
Definition URI.hpp:278
bool isNested() const noexcept
Checks if the parsed URI contains any nested part.
bool isPortNested() const noexcept
Checks if the port is a nested URI.
Definition URI.hpp:236
bool hasFragment() const noexcept
An optional fragment component preceded by a hash (#).
Definition URI.hpp:287
Definition Application.hpp:19
BasicStringView< char > StringView
Narrow string view used for handling narrow encoded text in UTF-8.
Definition String.hpp:190
CiBasicStringView< T > toCaseInsensitive(const BasicString< T, RawAllocator > &view)
Definition String.hpp:294
bool operator!=(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:416
bool operator==(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:411
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25