System::Uri class
Contents
[
Hide
]Uri class
Unified resource identifier. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.
class Uri : public System::Object
Methods
Method | Description |
---|---|
static CheckHostName(String) | Determines the type of the specified host name. |
static CheckSchemeName(const String&) | Determines if the specified scheme is valid. |
static Compare(const SharedPtr<Uri>&, const SharedPtr<Uri>&, UriComponents, UriFormat, StringComparison) | Compares the specified Uri objects using the specified comparison rules. |
Equals(SharedPtr<Object>) override | Determines if the URIs represented by the current and specified objects are equal. |
static EscapeDataString(const String&) | Converts a string to its escaped representation. |
static EscapeUriString(const String&) | Converts a URI string to its escaped representation. |
static FromHex(char16_t) | Gets the decimal value of a hexadecimal digit. |
get_AbsolutePath() const | Returns the absolute path of the URI. |
get_AbsoluteUri() const | Returns the absolute URI. |
get_Authority() const | Returns the host name and the port number for a server. |
get_DnsSafeHost() const | Returns an unescaped host name. |
get_Fragment() const | Returns the escaped URI fragment. |
get_Host() const | Returns the host name. |
get_HostNameType() const | Returns the host name type. |
get_IdnHost() const | Returns an International Domain Name of the host. |
get_IsAbsoluteUri() const | Determines if the URI represented by the current object is absolute. |
get_IsDefaultPort() const | Determines if the URI represented by the current object has default port for the URI’s scheme. |
get_IsFile() const | Determines if the URI represented by the current object is a file. |
get_IsLoopback() const | Determines if the URI represented by the current object references a local host. |
get_IsUnc() const | Determines if the URI represented by the current object is a UNC path. |
get_LocalPath() const | Returns the operating system representation of the file name referenced by the URI represented by the current object. |
get_OriginalString() const | Returns the URI string that was passed to the constructor when current object was constructed. |
get_PathAndQuery() const | Returns the absolute path and query components of the URI represented by the current object separated by a question mark (?). |
get_Port() const | Returns the port number of the URI represented by the current object. |
get_Query() const | Returns the query information included in the URI represented by the current object. |
get_Scheme() const | Returns the scheme of the URI represented by the current object. |
get_Segments() const | Returns an array of strings containing the path segments of the URI represented by the current object. |
get_UserEscaped() const | Determines if the URI string passed to the constructor of the current object was fully escaped. |
get_UserInfo() const | Returns a uer name, password and other user information associated with the URI represented by the current object. |
GetComponents(UriComponents, UriFormat) const | Returns the specified components of the URI represented by the current object using the specified escaping. |
GetHashCode() const override | Gets the hash code for the URI. |
GetLeftPart(UriPartial) | Returns the specified portion of the URI represented by the current object. |
static HexEscape(char16_t) | Returns a hexadecimal equivalent of the specified character. |
static HexUnescape(const String&, int32_t&) | Converts the specified hexadecimal representation of a character to a character. |
IsBaseOf(const SharedPtr<Uri>&) const | Determines of the URI represented by the current Uri object is a base of URI represented by the specified Uri object. |
static IsHexDigit(char16_t) | Determines if the specified character represents a valid hexadecimal digit. |
static IsHexEncoding(const String&, int32_t) | Determines if a character in the specified string at the specified position is hexadecimal encoded. |
IsWellFormedOriginalString() const | Indicates whether the string used to construct this Uri was well-formed and is not required to be further escaped. |
static IsWellFormedUriString(const String&, UriKind) | Determines if the specified string is a well-formed URI. |
MakeRelative(const SharedPtr<Uri>&) | Determines the difference between two Uri instances. |
MakeRelativeUri(const SharedPtr<Uri>&) | Determines the difference between URIs represented by the current and the specified Uri objects. |
ToString() const override | Returns the string representation of the URI represented by the current object. |
static TryCreate(const String&, UriKind, SharedPtr<Uri>&) | Constructs a Uri object that represents the specified URI; an argument specifies the URI kind. |
static TryCreate(const SharedPtr<Uri>&, const String&, SharedPtr<Uri>&) | Constructs an Uri abject from the specified Uri object representing the base URI and the string representation of relative URI. |
static TryCreate(const SharedPtr<Uri>&, const SharedPtr<Uri>&, SharedPtr<Uri>&) | Constructs an Uri abject from the specified base and relative URIs. |
static UnescapeDataString(const String&) | Unescapes the specified escaped string. |
Uri(const String&) | Constructs a Uri object that represents the specified URI. |
Uri(const String&, bool) | Constructs a Uri object that represents the specified URI; an argument specifies if the URI should be escaped. |
Uri(const SharedPtr<Uri>&, const String&, bool) | Constructs an Uri abject from the specified Uri object representing the base URI and the string representation of relative URI; an argument specifies if the URI should be escaped. |
Uri(const String&, UriKind) | Constructs a Uri object that represents the specified URI; an argument specifies the URI kind. |
Uri(const SharedPtr<Uri>&, const String&) | Constructs an Uri abject from the specified base and relative URIs. |
Uri(const SharedPtr<Uri>&, const SharedPtr<Uri>&) | Constructs an Uri abject from the specified base and relative URIs. |
Fields
Field | Description |
---|---|
static SchemeDelimiter | Specifies the characters that separate the communication protocol scheme from the address portion of the Uri. |
static UriSchemeFile | Specifies that the Uri is a pointer to a file. |
static UriSchemeFtp | Specifies that the Uri is accessed through the File Transfer Protocol. |
static UriSchemeGopher | Specifies that the Uri is accessed through the Gopher protocol. |
static UriSchemeHttp | Specifies that the Uri is accessed through the Hypertext Transfer Protocol. |
static UriSchemeHttps | Specifies that the Uri is accessed through the Secure Hypertext Transfer Protocol. |
static UriSchemeMailto | Specifies that the Uri is an email address and is accessed through the Simple Mail Transport Protocol. |
static UriSchemeNetPipe | Specifies that the Uri is accessed through the NetPipe scheme used by Windows Communication Foundation. |
static UriSchemeNetTcp | Specifies that the Uri is accessed through the NetTcp scheme used by Windows Communication Foundation. |
static UriSchemeNews | Specifies that the Uri is an Internet news group and is accessed through the Network News Transport Protocol. |
static UriSchemeNntp | Specifies that the Uri is an Internet news group and is accessed through the Network News Transport Protocol. |
Remarks
#include "system/smart_ptr.h"
#include "system/uri.h"
#include <iostream>
int main()
{
const auto uri = System::MakeObject<System::Uri>(u"https://docs.codeporting.com/translator/cs2cpp/release-notes/2021/codeporting-translator-cs2cpp-21-9/");
std::cout <<
"AbsolutePath: " << uri->get_AbsolutePath() << std::endl <<
"AbsoluteUri: " << uri->get_AbsoluteUri() << std::endl <<
"Authority: " << uri->get_Authority() << std::endl <<
"DnsSafeHost: " << uri->get_DnsSafeHost() << std::endl <<
"Fragment: " << uri->get_Fragment() << std::endl <<
"Host: " << uri->get_Host() << std::endl <<
"IdnHost: " << uri->get_IdnHost() << std::endl <<
"LocalPath: " << uri->get_LocalPath() << std::endl <<
"OriginalString: " << uri->get_OriginalString() << std::endl <<
"PathAndQuery: " << uri->get_PathAndQuery() << std::endl <<
"Port: " << uri->get_Port() << std::endl <<
"Query: " << uri->get_Query() << std::endl <<
"Scheme: " << uri->get_Scheme() << std::endl;
return 0;
}
/*
This code example produces the following output:
AbsolutePath: /translator/cs2cpp/release-notes/2021/codeporting-translator-cs2cpp-21-9/
AbsoluteUri: https://docs.codeporting.com/translator/cs2cpp/release-notes/2021/codeporting-translator-cs2cpp-21-9/
Authority: docs.codeporting.com
DnsSafeHost: docs.codeporting.com
Fragment:
Host: docs.codeporting.com
IdnHost: docs.codeporting.com
LocalPath: /translator/cs2cpp/release-notes/2021/codeporting-translator-cs2cpp-21-9/
OriginalString: https://docs.codeporting.com/translator/cs2cpp/release-notes/2021/codeporting-translator-cs2cpp-21-9/
PathAndQuery: /translator/cs2cpp/release-notes/2021/codeporting-translator-cs2cpp-21-9/
Port: 443
Query:
Scheme: https
*/
See Also
- Class Object
- Namespace System
- Library Aspose.Font for C++