Uri
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 UriHostNameType CheckHostName(String) | Determines the type of the specified host name. |
static bool CheckSchemeName(const String&) | Determines if the specified scheme is valid. |
static int32_t Compare(const SharedPtr<Uri>&, const SharedPtr<Uri>&, UriComponents, UriFormat, StringComparison) | Compares the specified Uri objects using the specified comparison rules. |
bool Equals(SharedPtr<Object>) override | Determines if the URIs represented by the current and specified objects are equal. |
virtual bool Equals(ptr) | Compares objects using C# Object.Equals semantics. |
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&) | Compares reference type objects in C# style. |
static bool Equals(float const&, float const&) | Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. |
static bool Equals(double const&, double const&) | Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. |
static String EscapeDataString(const String&) | Converts a string to its escaped representation. |
static String EscapeUriString(const String&) | Converts a URI string to its escaped representation. |
virtual bool FastCast(const Details::FastRttiBase&, void **) const | For internal purposes only. |
static int32_t FromHex(char16_t) | Gets the decimal value of a hexadecimal digit. |
String get_AbsolutePath() const | Returns the absolute path of the URI. |
String get_AbsoluteUri() const | Returns the absolute URI. |
String get_Authority() const | Returns the host name and the port number for a server. |
String get_DnsSafeHost() const | Returns an unescaped host name. |
String get_Fragment() const | Returns the escaped URI fragment. |
String get_Host() const | Returns the host name. |
UriHostNameType get_HostNameType() const | Returns the host name type. |
String get_IdnHost() const | Returns an International Domain Name of the host. |
bool get_IsAbsoluteUri() const | Determines if the URI represented by the current object is absolute. |
bool get_IsDefaultPort() const | Determines if the URI represented by the current object has default port for the URI’s scheme. |
bool get_IsFile() const | Determines if the URI represented by the current object is a file. |
bool get_IsLoopback() const | Determines if the URI represented by the current object references a local host. |
bool get_IsUnc() const | Determines if the URI represented by the current object is a UNC path. |
String get_LocalPath() const | Returns the operating system representation of the file name referenced by the URI represented by the current object. |
String get_OriginalString() const | Returns the URI string that was passed to the constructor when current object was constructed. |
String get_PathAndQuery() const | Returns the absolute path and query components of the URI represented by the current object separated by a question mark (?). |
int32_t get_Port() const | Returns the port number of the URI represented by the current object. |
String get_Query() const | Returns the query information included in the URI represented by the current object. |
String get_Scheme() const | Returns the scheme of the URI represented by the current object. |
ArrayPtr<String> get_Segments() const | Returns an array of strings containing the path segments of the URI represented by the current object. |
bool get_UserEscaped() const | Determines if the URI string passed to the constructor of the current object was fully escaped. |
String get_UserInfo() const | Returns a uer name, password and other user information associated with the URI represented by the current object. |
String GetComponents(UriComponents, UriFormat) const | Returns the specified components of the URI represented by the current object using the specified escaping. |
Detail::SmartPtrCounter * GetCounter() | Gets reference counter data structure associated with the object. |
int32_t GetHashCode() const override | Gets the hash code for the URI. |
String GetLeftPart(UriPartial) | Returns the specified portion of the URI represented by the current object. |
virtual const TypeInfo& GetType() const | Gets actual type of object. Analog of C# System.Object.GetType() call. |
static String HexEscape(char16_t) | Returns a hexadecimal equivalent of the specified character. |
static char16_t HexUnescape(const String&, int32_t&) | Converts the specified hexadecimal representation of a character to a character. |
virtual bool Is(const TypeInfo&) const | Check if object represents an instance of type described by targetType. Analog of C# ‘is’ operator. |
bool 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 bool IsHexDigit(char16_t) | Determines if the specified character represents a valid hexadecimal digit. |
static bool IsHexEncoding(const String&, int32_t) | Determines if a character in the specified string at the specified position is hexadecimal encoded. |
bool IsWellFormedOriginalString() const | Indicates whether the string used to construct this Uri was well-formed and is not required to be further escaped. |
static bool IsWellFormedUriString(const String&, UriKind) | Determines if the specified string is a well-formed URI. |
void Lock() | Implements C# lock() statement locking. Call directly or use LockContext sentry object. |
String MakeRelative(const SharedPtr<Uri>&) | Determines the difference between two Uri instances. |
SharedPtr<Uri> MakeRelativeUri(const SharedPtr<Uri>&) | Determines the difference between URIs represented by the current and the specified Uri objects. |
virtual ptr MemberwiseClone() const | Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. |
Object() | Creates object. Initializes all internal data structures. |
Object(Object const&) | Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses. |
Object& operator=(Object const&) | Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses. |
static bool ReferenceEquals(ptr const&, ptr const&) | Compares objects by reference. |
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&) | Compares objects by reference. |
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t) | Reference-compares value type object with nullptr. |
bool ReferenceEquals(String const&, std::nullptr_t) | Specialization of Object::ReferenceEquals for case of string and nullptr. |
bool ReferenceEquals(String const&, String const&) | Specialization of Object::ReferenceEquals for case of strings. |
int RemovedSharedRefs(int) | Decreases shared reference count by specified value. |
virtual void SetTemplateWeakPtr(uint32_t) | Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. |
int SharedCount() const | Gets current value of shared reference counter. |
Object * SharedRefAdded() | Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
int SharedRefRemovedSafe() | Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
String ToString() const override | Returns the string representation of the URI represented by the current object. |
static bool TryCreate(const String&, UriKind, SharedPtr<Uri>&) | Constructs a Uri object that represents the specified URI; an argument specifies the URI kind. |
static bool 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 bool TryCreate(const SharedPtr<Uri>&, const SharedPtr<Uri>&, SharedPtr<Uri>&) | Constructs an Uri abject from the specified base and relative URIs. |
static const TypeInfo& Type() | Implements C# typeof(System.Object) construct. |
static String UnescapeDataString(const String&) | Unescapes the specified escaped string. |
void Unlock() | Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. |
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. |
Detail::SmartPtrCounter * WeakRefAdded() | Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
void WeakRefRemoved() | Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
virtual ~Object() | Destroys object. Frees all internal data structures. |
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.Slides