DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DotNetDupe::System::UriBuilder Class Reference

Provides a custom constructor for uniform resource identifiers (URIs) and modifies URIs for the Uri class. More...

#include <UriBuilder.h>

Inheritance diagram for DotNetDupe::System::UriBuilder:

Public Member Functions

 UriBuilder ()
 Initializes a new instance of the UriBuilder class.
 UriBuilder (const String &scheme, const String &host)
 Initializes a new instance with the specified scheme and host.
 UriBuilder (const String &scheme, const String &host, int port)
 Initializes a new instance with the specified scheme, host, and port number.
 UriBuilder (const String &uri)
 Initializes a new instance of the UriBuilder class with the specified URI.
 UriBuilder (const Uri &uri)
 Initializes a new instance of the UriBuilder class with the specified Uri instance.
String GetFragment () const
 Gets the fragment portion of the URI.
String GetHost () const
 Gets the Domain Name System (DNS) host name or IP address of a server.
String GetPassword () const
 Gets the password associated with the user that accesses the URI.
String GetPath () const
 Gets the path to the resource referenced by the URI.
int GetPort () const
 Gets the port number of the URI.
String GetQuery () const
 Gets any query information included in the URI.
String GetScheme () const
 Gets the scheme name of the URI.
Uri GetUri ()
 Gets the Uri instance constructed by the specified UriBuilder instance.
String GetUserName () const
 Gets the user name associated with the user that accesses the URI.
void SetFragment (const String &value)
 Sets the fragment portion of the URI.
void SetHost (const String &value)
 Sets the Domain Name System (DNS) host name or IP address of a server.
void SetPassword (const String &value)
 Sets the password associated with the user that accesses the URI.
void SetPath (const String &value)
 Sets the path to the resource referenced by the URI.
void SetPort (int value)
 Sets the port number of the URI.
void SetQuery (const String &value)
 Sets any query information included in the URI.
void SetScheme (const String &value)
 Sets the scheme name of the URI.
void SetUserName (const String &value)
 Sets the user name associated with the user that accesses the URI.
String ToString ()
 Formats the configured components into a canonical URI string.
Public Member Functions inherited from DotNetDupe::System::Object
virtual ~Object ()=default
 Virtual destructor ensuring polymorphic cleanup.
virtual bool Equals (const Object &obj) const
 Determines whether the specified Object is equal to the current Object.
virtual int GetHashCode () const
 Serves as the default hash function.
bool operator== (const Object &obj) const
 Determines reference equality between two objects.
char * ToStringA () const
 Returns narrow-character string representation.
wchar_t * ToStringW () const
 Returns wide-character string representation.

Additional Inherited Members

Static Public Member Functions inherited from DotNetDupe::System::Object
static bool Equals (const Object &obj1, const Object &obj2)
 Static helper determining whether two object instances are equal.

Detailed Description

Provides a custom constructor for uniform resource identifiers (URIs) and modifies URIs for the Uri class.

Modeled after .NET System.UriBuilder. Simplifies programmatic assembly, modification, and formatting of individual URI segments (scheme, host, port, path, query, fragment, credentials).

Definition at line 24 of file UriBuilder.h.

Constructor & Destructor Documentation

◆ UriBuilder() [1/5]

DotNetDupe::System::UriBuilder::UriBuilder ( )

Initializes a new instance of the UriBuilder class.

Definition at line 7 of file UriBuilder.cpp.

◆ UriBuilder() [2/5]

DotNetDupe::System::UriBuilder::UriBuilder ( const String & uri)

Initializes a new instance of the UriBuilder class with the specified URI.

Parameters
uriA URI string to parse into components.

Definition at line 8 of file UriBuilder.cpp.

◆ UriBuilder() [3/5]

DotNetDupe::System::UriBuilder::UriBuilder ( const Uri & uri)

Initializes a new instance of the UriBuilder class with the specified Uri instance.

Parameters
uriAn existing Uri object to clone into mutable builder state.

Definition at line 11 of file UriBuilder.cpp.

References GetFragment(), GetHost(), GetPort(), GetQuery(), GetScheme(), and DotNetDupe::System::Uri::ToString().

◆ UriBuilder() [4/5]

DotNetDupe::System::UriBuilder::UriBuilder ( const String & scheme,
const String & host )

Initializes a new instance with the specified scheme and host.

Parameters
schemeThe protocol scheme.
hostThe DNS host name or IP address.

Definition at line 16 of file UriBuilder.cpp.

◆ UriBuilder() [5/5]

DotNetDupe::System::UriBuilder::UriBuilder ( const String & scheme,
const String & host,
int port )

Initializes a new instance with the specified scheme, host, and port number.

Parameters
schemeThe protocol scheme.
hostThe DNS host name or IP address.
portThe port number for the service.

Definition at line 18 of file UriBuilder.cpp.

Member Function Documentation

◆ GetFragment()

String DotNetDupe::System::UriBuilder::GetFragment ( ) const

Gets the fragment portion of the URI.

Returns
The fragment string.

Definition at line 36 of file UriBuilder.cpp.

Referenced by UriBuilder().

◆ GetHost()

String DotNetDupe::System::UriBuilder::GetHost ( ) const

Gets the Domain Name System (DNS) host name or IP address of a server.

Returns
The host name string.

Definition at line 24 of file UriBuilder.cpp.

Referenced by UriBuilder().

◆ GetPassword()

String DotNetDupe::System::UriBuilder::GetPassword ( ) const

Gets the password associated with the user that accesses the URI.

Returns
The password credential.

Definition at line 42 of file UriBuilder.cpp.

◆ GetPath()

String DotNetDupe::System::UriBuilder::GetPath ( ) const

Gets the path to the resource referenced by the URI.

Returns
The path string.

Definition at line 30 of file UriBuilder.cpp.

◆ GetPort()

int DotNetDupe::System::UriBuilder::GetPort ( ) const

Gets the port number of the URI.

Returns
The port number, or -1 if not specified.

Definition at line 27 of file UriBuilder.cpp.

Referenced by UriBuilder().

◆ GetQuery()

String DotNetDupe::System::UriBuilder::GetQuery ( ) const

Gets any query information included in the URI.

Returns
The query string.

Definition at line 33 of file UriBuilder.cpp.

Referenced by UriBuilder().

◆ GetScheme()

String DotNetDupe::System::UriBuilder::GetScheme ( ) const

Gets the scheme name of the URI.

Returns
The scheme string.

Definition at line 21 of file UriBuilder.cpp.

Referenced by UriBuilder().

◆ GetUri()

Uri DotNetDupe::System::UriBuilder::GetUri ( )

Gets the Uri instance constructed by the specified UriBuilder instance.

Returns
A new Uri instance matching the configured components.

Construct and return Uri instance from current string representation.

Definition at line 45 of file UriBuilder.cpp.

References DotNetDupe::System::Uri::Uri(), and ToString().

◆ GetUserName()

String DotNetDupe::System::UriBuilder::GetUserName ( ) const

Gets the user name associated with the user that accesses the URI.

Returns
The username credential.

Definition at line 39 of file UriBuilder.cpp.

◆ SetFragment()

void DotNetDupe::System::UriBuilder::SetFragment ( const String & value)

Sets the fragment portion of the URI.

Parameters
valueThe fragment string.

Definition at line 37 of file UriBuilder.cpp.

◆ SetHost()

void DotNetDupe::System::UriBuilder::SetHost ( const String & value)

Sets the Domain Name System (DNS) host name or IP address of a server.

Parameters
valueThe host name string.

Definition at line 25 of file UriBuilder.cpp.

◆ SetPassword()

void DotNetDupe::System::UriBuilder::SetPassword ( const String & value)

Sets the password associated with the user that accesses the URI.

Parameters
valueThe password credential string.

Definition at line 43 of file UriBuilder.cpp.

◆ SetPath()

void DotNetDupe::System::UriBuilder::SetPath ( const String & value)

Sets the path to the resource referenced by the URI.

Parameters
valueThe resource path.

Definition at line 31 of file UriBuilder.cpp.

◆ SetPort()

void DotNetDupe::System::UriBuilder::SetPort ( int value)

Sets the port number of the URI.

Parameters
valueThe port number to configure.

Definition at line 28 of file UriBuilder.cpp.

◆ SetQuery()

void DotNetDupe::System::UriBuilder::SetQuery ( const String & value)

Sets any query information included in the URI.

Parameters
valueThe query string to configure.

Definition at line 34 of file UriBuilder.cpp.

◆ SetScheme()

void DotNetDupe::System::UriBuilder::SetScheme ( const String & value)

Sets the scheme name of the URI.

Parameters
valueThe scheme name string.

Definition at line 22 of file UriBuilder.cpp.

◆ SetUserName()

void DotNetDupe::System::UriBuilder::SetUserName ( const String & value)

Sets the user name associated with the user that accesses the URI.

Parameters
valueThe username credential string.

Definition at line 40 of file UriBuilder.cpp.

◆ ToString()

String DotNetDupe::System::UriBuilder::ToString ( )

Formats the configured components into a canonical URI string.

Returns
The assembled URI string.

Step: Format scheme prefix.

Step: Assemble authority, path, query, and fragment parts into URI string.

Definition at line 91 of file UriBuilder.cpp.

References DotNetDupe::System::String::String(), DotNetDupe::System::AppendAuthority(), and DotNetDupe::System::AppendPathAndQuery().

Referenced by GetUri().


The documentation for this class was generated from the following files: