#include <url.h>
Inheritance diagram for PURL:
New functions for class. | |
enum | UrlFormat { FullURL, PathOnly, URIOnly, HostPortOnly } |
enum | TranslationType { LoginTranslation, PathTranslation, QueryTranslation } |
Type for translation of strings to URL format,. More... | |
BOOL | Parse (const char *cstr, const char *defaultScheme=NULL) |
BOOL | Parse (const PString &str, const char *defaultScheme=NULL) |
PString | AsString (UrlFormat fmt=FullURL) const |
PFilePath | AsFilePath () const |
const PCaselessString & | GetScheme () const |
Get the scheme field of the URL. | |
void | SetScheme (const PString &scheme) |
Set the scheme field of the URL. | |
const PString & | GetUserName () const |
Get the username field of the URL. | |
void | SetUserName (const PString &username) |
Set the username field of the URL. | |
const PString & | GetPassword () const |
Get the password field of the URL. | |
void | SetPassword (const PString &password) |
Set the password field of the URL. | |
const PCaselessString & | GetHostName () const |
Get the hostname field of the URL. | |
void | SetHostName (const PString &hostname) |
Set the hostname field of the URL. | |
WORD | GetPort () const |
Get the port field of the URL. | |
void | SetPort (WORD newPort) |
Set the port field in the URL. | |
BOOL | GetPortSupplied () const |
Get if explicit port is specified. | |
BOOL | GetRelativePath () const |
Get if path is relative or absolute. | |
const PString & | GetPathStr () const |
Get the path field of the URL as a string. | |
void | SetPathStr (const PString &pathStr) |
Set the path field of the URL as a string. | |
const PStringArray & | GetPath () const |
Get the path field of the URL as a string array. | |
void | SetPath (const PStringArray &path) |
Set the path field of the URL as a string array. | |
PString | GetParameters () const |
Get the parameter (;) field of the URL. | |
void | SetParameters (const PString ¶meters) |
Set the parameter (;) field of the URL. | |
const PStringToString & | GetParamVars () const |
Get the parameter (;) field(s) of the URL as a string dictionary. | |
void | SetParamVars (const PStringToString ¶mVars) |
Set the parameter (;) field(s) of the URL as a string dictionary. | |
void | SetParamVar (const PString &key, const PString &data) |
Set the parameter (;) field of the URL as a string dictionary. | |
const PString & | GetFragment () const |
Get the fragment (##) field of the URL. | |
PString | GetQuery () const |
Get the Query (?) field of the URL as a string. | |
void | SetQuery (const PString &query) |
Set the Query (?) field of the URL as a string. | |
const PStringToString & | GetQueryVars () const |
Get the Query (?) field of the URL as a string dictionary. | |
void | SetQueryVars (const PStringToString &queryVars) |
Set the Query (?) field(s) of the URL as a string dictionary. | |
void | SetQueryVar (const PString &key, const PString &data) |
Set the Query (?) field of the URL as a string dictionary. | |
BOOL | IsEmpty () const |
Return TRUE if the URL is an empty string. | |
static PString | TranslateString (const PString &str, TranslationType type) |
static PString | UntranslateString (const PString &str, TranslationType type) |
static void | SplitQueryVars (const PString &queryStr, PStringToString &queryVars) |
static BOOL | OpenBrowser (const PString &url) |
Public Member Functions | |
PURL () | |
PURL (const char *cstr, const char *defaultScheme=NULL) | |
PURL (const PString &str, const char *defaultScheme=NULL) | |
PURL (const PFilePath &path) | |
BOOL | LegacyParse (const PString &_url, const PURLLegacyScheme *schemeInfo) |
PString | LegacyAsString (PURL::UrlFormat fmt, const PURLLegacyScheme *schemeInfo) const |
Overrides from class PObject | |
virtual Comparison | Compare (const PObject &obj) const |
virtual PINDEX | HashFunction () const |
virtual void | PrintOn (ostream &strm) const |
virtual void | ReadFrom (istream &strm) |
Protected Member Functions | |
virtual BOOL | InternalParse (const char *cstr, const char *defaultScheme) |
void | Recalculate () |
Protected Attributes | |
PString | urlString |
PCaselessString | scheme |
PString | username |
PString | password |
PCaselessString | hostname |
WORD | port |
BOOL | portSupplied |
BOOL | relativePath |
port was supplied in string input | |
PString | pathStr |
PStringArray | path |
PStringToString | paramVars |
PString | fragment |
PStringToString | queryVars |
enum PURL::UrlFormat |
PURL::PURL | ( | ) |
Construct a new URL object from the URL string.
PURL::PURL | ( | const char * | cstr, | |
const char * | defaultScheme = NULL | |||
) |
Construct a new URL object from the URL string.
cstr | C string representation of the URL. |
defaultScheme | Default scheme for URL |
PURL::PURL | ( | const PString & | str, | |
const char * | defaultScheme = NULL | |||
) |
Construct a new URL object from the URL string.
str | String representation of the URL. |
defaultScheme | Default scheme for URL |
PURL::PURL | ( | const PFilePath & | path | ) |
Construct a new URL object from the file path.
path | File path to turn into a "file:" URL. |
virtual Comparison PURL::Compare | ( | const PObject & | obj | ) | const [virtual] |
Compare the two URLs and return their relative rank.
obj | Object to compare against. |
Reimplemented from PObject.
virtual PINDEX PURL::HashFunction | ( | ) | const [virtual] |
This function yields a hash value required by the PDictionary# class. A descendent class that is required to be the key of a dictionary should override this function. The precise values returned is dependent on the semantics of the class. For example, the PString# class overrides it to provide a hash function for distinguishing text strings.
The default behaviour is to return the value zero.
Reimplemented from PObject.
virtual void PURL::PrintOn | ( | ostream & | strm | ) | const [virtual] |
Output the contents of the URL to the stream as a string.
strm | Stream to print the object into. |
Reimplemented from PObject.
virtual void PURL::ReadFrom | ( | istream & | strm | ) | [virtual] |
Input the contents of the URL from the stream. The input is a URL in string form.
strm | Stream to read the objects contents from. |
Reimplemented from PObject.
BOOL PURL::Parse | ( | const char * | cstr, | |
const char * | defaultScheme = NULL | |||
) | [inline] |
Parse the URL string into the fields in the object instance.
cstr | URL as a string to parse. |
defaultScheme | Default scheme for URL |
BOOL PURL::Parse | ( | const PString & | str, | |
const char * | defaultScheme = NULL | |||
) | [inline] |
Parse the URL string into the fields in the object instance.
str | URL as a string to parse. |
defaultScheme | Default scheme for URL |
Convert the URL object into its string representation. The parameter indicates whether a full or partial representation os to be produced.
fmt | The type of string to be returned. |
PFilePath PURL::AsFilePath | ( | ) | const |
Get the "file:" URL as a file path. If the URL is not a "file:" URL then returns an empty string.
static PString PURL::TranslateString | ( | const PString & | str, | |
TranslationType | type | |||
) | [static] |
Translate a string from general form to one that can be included into a URL. All reserved characters for the particular field type are escaped.
str | String to be translated. |
type | Type of translation. |
static PString PURL::UntranslateString | ( | const PString & | str, | |
TranslationType | type | |||
) | [static] |
Untranslate a string from a form that was included into a URL into a normal string. All reserved characters for the particular field type are unescaped.
str | String to be translated. |
type | Type of translation. |
static void PURL::SplitQueryVars | ( | const PString & | queryStr, | |
PStringToString & | queryVars | |||
) | [static] |
Split a string in &= form to a dictionary of names and values.
queryStr | String to split into variables. |
queryVars | Dictionary of variable names and values. |
const PCaselessString& PURL::GetScheme | ( | ) | const [inline] |
Get the scheme field of the URL.
void PURL::SetScheme | ( | const PString & | scheme | ) |
Set the scheme field of the URL.
const PString& PURL::GetUserName | ( | ) | const [inline] |
Get the username field of the URL.
void PURL::SetUserName | ( | const PString & | username | ) |
Set the username field of the URL.
const PString& PURL::GetPassword | ( | ) | const [inline] |
Get the password field of the URL.
void PURL::SetPassword | ( | const PString & | password | ) |
Set the password field of the URL.
const PCaselessString& PURL::GetHostName | ( | ) | const [inline] |
Get the hostname field of the URL.
void PURL::SetHostName | ( | const PString & | hostname | ) |
Set the hostname field of the URL.
WORD PURL::GetPort | ( | ) | const [inline] |
Get the port field of the URL.
void PURL::SetPort | ( | WORD | newPort | ) |
Set the port field in the URL.
BOOL PURL::GetPortSupplied | ( | ) | const [inline] |
Get if explicit port is specified.
BOOL PURL::GetRelativePath | ( | ) | const [inline] |
Get if path is relative or absolute.
const PString& PURL::GetPathStr | ( | ) | const [inline] |
Get the path field of the URL as a string.
void PURL::SetPathStr | ( | const PString & | pathStr | ) |
Set the path field of the URL as a string.
const PStringArray& PURL::GetPath | ( | ) | const [inline] |
Get the path field of the URL as a string array.
void PURL::SetPath | ( | const PStringArray & | path | ) |
Set the path field of the URL as a string array.
PString PURL::GetParameters | ( | ) | const |
Get the parameter (;) field of the URL.
void PURL::SetParameters | ( | const PString & | parameters | ) |
Set the parameter (;) field of the URL.
const PStringToString& PURL::GetParamVars | ( | ) | const [inline] |
Get the parameter (;) field(s) of the URL as a string dictionary.
void PURL::SetParamVars | ( | const PStringToString & | paramVars | ) |
Set the parameter (;) field(s) of the URL as a string dictionary.
Set the parameter (;) field of the URL as a string dictionary.
const PString& PURL::GetFragment | ( | ) | const [inline] |
Get the fragment (##) field of the URL.
PString PURL::GetQuery | ( | ) | const |
Get the Query (?) field of the URL as a string.
void PURL::SetQuery | ( | const PString & | query | ) |
Set the Query (?) field of the URL as a string.
const PStringToString& PURL::GetQueryVars | ( | ) | const [inline] |
Get the Query (?) field of the URL as a string dictionary.
void PURL::SetQueryVars | ( | const PStringToString & | queryVars | ) |
Set the Query (?) field(s) of the URL as a string dictionary.
Set the Query (?) field of the URL as a string dictionary.
BOOL PURL::IsEmpty | ( | ) | const [inline] |
Return TRUE if the URL is an empty string.
static BOOL PURL::OpenBrowser | ( | const PString & | url | ) | [static] |
Open the URL in a browser.
url | URL to open |
BOOL PURL::LegacyParse | ( | const PString & | _url, | |
const PURLLegacyScheme * | schemeInfo | |||
) |
PString PURL::LegacyAsString | ( | PURL::UrlFormat | fmt, | |
const PURLLegacyScheme * | schemeInfo | |||
) | const |
virtual BOOL PURL::InternalParse | ( | const char * | cstr, | |
const char * | defaultScheme | |||
) | [protected, virtual] |
cstr | URL as a string to parse. |
defaultScheme | Default scheme for URL |
void PURL::Recalculate | ( | ) | [protected] |
PString PURL::urlString [protected] |
PCaselessString PURL::scheme [protected] |
PString PURL::username [protected] |
PString PURL::password [protected] |
PCaselessString PURL::hostname [protected] |
WORD PURL::port [protected] |
BOOL PURL::portSupplied [protected] |
BOOL PURL::relativePath [protected] |
port was supplied in string input
PString PURL::pathStr [protected] |
PStringArray PURL::path [protected] |
PStringToString PURL::paramVars [protected] |
PString PURL::fragment [protected] |
PStringToString PURL::queryVars [protected] |