다음을 통해 공유


CUrl Class

This class represents a URL. It allows you to manipulate each element of the URL independently of the others whether parsing an existing URL string or building a string from scratch.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

class CUrl

Members

Public Constructors

Name

Description

CUrl::CUrl

The constructor.

CUrl::~CUrl

The destructor.

Public Methods

Name

Description

CUrl::Canonicalize

Call this method to convert the URL string to canonical form.

CUrl::Clear

Call this method to clear all of the URL fields.

CUrl::CrackUrl

Call this method to decode and parse the URL.

CUrl::CreateUrl

Call this method to create the URL.

CUrl::GetExtraInfo

Call this method to get extra information (such as ?text or #text) from the URL.

CUrl::GetExtraInfoLength

Call this method to get the length of the extra information (such as ?text or #text) to retrieve from the URL.

CUrl::GetHostName

Call this method to get the host name from the URL.

CUrl::GetHostNameLength

Call this method to get the length of the host name.

CUrl::GetPassword

Call this method to get the password from the URL.

CUrl::GetPasswordLength

Call this method to get the length of the password.

CUrl::GetPortNumber

Call this method to get the port number in terms of ATL_URL_PORT.

CUrl::GetScheme

Call this method to get the URL scheme.

CUrl::GetSchemeName

Call this method to get the URL scheme name.

CUrl::GetSchemeNameLength

Call this method to get the length of the URL scheme name.

CUrl::GetUrlLength

Call this method to get the URL length.

CUrl::GetUrlPath

Call this method to get the URL path.

CUrl::GetUrlPathLength

Call this method to get the URL path length.

CUrl::GetUserName

Call this method to get the user name from the URL.

CUrl::GetUserNameLength

Call this method to get the length of the user name.

CUrl::SetExtraInfo

Call this method to set the extra information (such as ?text or #text) of the URL.

CUrl::SetHostName

Call this method to set the host name.

CUrl::SetPassword

Call this method to set the password.

CUrl::SetPortNumber

Call this method to set the port number in terms of ATL_URL_PORT.

CUrl::SetScheme

Call this method to set the URL scheme.

CUrl::SetSchemeName

Call this method to set the URL scheme name.

CUrl::SetUrlPath

Call this method to set the URL path.

CUrl::SetUserName

Call this method to set the user name.

Public Operators

Name

Description

CUrl::operator =

Assigns the specified CUrl object to the current CUrl object.

Remarks

CUrl allows you to manipulate the fields of a URL, such as the path or port number. CUrl understands URLs of the following form:

<Scheme>://<UserName>:<Password>@<HostName>:<PortNumber>/<UrlPath><ExtraInfo>

(Some fields are optional.) For example, consider this URL:

https://someone:secret@www.microsoft.com:80/visualc/stuff.htm#contents

CUrl::CrackUrl parses it as follows:

  • Scheme: "http" or ATL_URL_SCHEME_HTTP

  • UserName: "someone"

  • Password: "secret"

  • HostName: "www.microsoft.com"

  • PortNumber: 80

  • UrlPath: "visualc/stuff.htm"

  • ExtraInfo: "#contents"

To manipulate the UrlPath field (for instance), you would use GetUrlPath, GetUrlPathLength, and SetUrlPath. You would use CreateUrl to create the complete URL string.

Requirements

Header: atlutil.h

See Also

Other Resources

ATL Classes