SourcePro® 2022.1 |
SourcePro® API Reference Guide |
A convenience class that encapsulates parsing and component management of URL information. More...
#include <rw/internet/RWURL.h>
Public Member Functions | |
RWURL (void) | |
RWURL (const RWCString &urlString) | |
RWCString | getData (void) const |
RWCString | getError (void) const |
RWCString | getHost (void) const |
RWCString | getMailAddress (void) const |
RWCString | getNewsArticle (void) const |
RWCString | getNewsGroup (void) const |
RWCString | getPassword (void) const |
RWCString | getPath (void) const |
RWCString | getPort (void) const |
RWCString | getScheme (void) const |
RWCString | getSearch (void) const |
RWCString | getType (void) const |
RWCString | getUser (void) const |
bool | isKnown (void) const |
bool | isValid (void) const |
bool | operator== (const RWURL &url) const |
Friends | |
std::ostream & | operator<< (std::ostream &str, const RWURL &url) |
RWURL is a convenience class that encapsulates parsing and component management of URL information. URLs are assumed to be in RFC1738 format:
RWURL has implicit knowledge of common URL schemes, that include HTTP
, FTP
, MAILTO
, NEWS
, NNTP
, and FILE
. URL schemes not known to RWURL return false
from the isKnown() method. URL schemes that are known but have basic syntactical errors return false
from the isValid() method.
You must properly encode any unsafe characters in the URL. See RFC1738 or subsequent documents for proper encoding methods and syntactical questions.
Program Output
RWURL::RWURL | ( | void | ) |
Constructs a default empty RWURL object. Self
needs to be initialized using the assignment operator.
RWURL::RWURL | ( | const RWCString & | urlString | ) |
RWCString RWURL::getData | ( | void | ) | const |
RWCString RWURL::getError | ( | void | ) | const |
RWCString RWURL::getHost | ( | void | ) | const |
Returns the host portion of the URL, if applicable. In the example URL "ftp://ftp.roguewave.com"
, the method returns "ftp.roguewave.com"
. URLs that do not contain host information, such as "mailto:me@roguewave.com"
, return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getMailAddress | ( | void | ) | const |
Returns the email address portion of the URL, if applicable. In the example URL "mailto:me@roguewave.com"
, the method returns "me@roguewave.com"
. URLs that do not contain email information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getNewsArticle | ( | void | ) | const |
Returns the news article portion of the URL, if applicable. In the example URL "nntp://comp.windows/4u7lb0$t5s@roguewave.com"
, it returns "4u7lb0$t5s@roguewave.com"
. URLs that do not contain explicit news article information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getNewsGroup | ( | void | ) | const |
Returns the specified newsgroup portion of the URL, if applicable. In the example URL "news:comp.windows"
, it returns "comp.windows"
. URLs that contain no explicit newsgroup information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getPassword | ( | void | ) | const |
Returns the password portion of the URL, if applicable. In the example URL "ftp://fred:pluto@ftp.roguewave.com:21/pub"
, it returns "pluto"
. URLs that contain no explicit password information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getPath | ( | void | ) | const |
Returns the path portion of the URL, if applicable. In the example URL "ftp://ftp.roguewave.com/pub"
, it returns "pub"
. The single slash (/
) before "pub"
in the example is not part of the path information. If a leading slash is required for the path information, consult RFC1738 or subsequent documents about proper unsafe character encoding techniques. URLs that do not contain path information, such as "mailto:me@roguewave.com"
, return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getPort | ( | void | ) | const |
Returns the port portion of the URL, if applicable. In the example URL "ftp://ftp.roguewave.com:21/pub"
, it returns "21"
. URLs that do not contain explicit port information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getScheme | ( | void | ) | const |
Returns the scheme portion of the URL. In the example URL "http://www.roguewave.com"
, it returns "http"
. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getSearch | ( | void | ) | const |
Returns the search string portion of the URL, if applicable. In the example URL "http://www.roguewave.com/pub?archive=mswin95"
, it returns "archive=mswin95"
. URLs that do not contain explicit search information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getType | ( | void | ) | const |
Returns the transfer type portion of the URL, if applicable. In the example URL "ftp://www.roguewave.com/doc.txt;type=a"
, it returns "a"
. URLs that do not contain explicit type information return an empty string. The RWCString should contain 7-bit US-ASCII data.
RWCString RWURL::getUser | ( | void | ) | const |
Returns the user portion of the URL, if applicable. In the example URL "ftp://fred:pluto@ftp.roguewave.com:21/pub"
, it returns "fred"
. URLs that do not contain explicit user
information return an empty string. The RWCString should contain 7-bit US-ASCII data.
bool RWURL::isKnown | ( | void | ) | const |
Returns true
for URL schemes specifically recognized by the class.
bool RWURL::isValid | ( | void | ) | const |
Returns false
if the URL scheme is specifically a recognized format, but a syntactical error exists during parsing. A call to the data
method returns the url
string used during attempted construction. A call to the error
method returns a descriptive text string describing why the input URL string could not be parsed successfully. This method also returns false
if the URL scheme is not specifically known.
bool RWURL::operator== | ( | const RWURL & | url | ) | const |
Returns true
if self and the input url represent the same URL.
Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |