class PURL

This class describes a Universal Resource Locator.

Inheritance:



Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Public Members

Comparison functions


Documentation

This class describes a Universal Resource Locator. This is the desciption of a resource location as used by the World Wide Web and the PHTTPSocket class.
ovirtual Comparison Compare( const PObject & obj ) const
Compare the two URLs and return their relative rank.

Parameters:
obj - Object to compare against.
Returns:
LessThan, EqualTo or GreaterThan according to the relative rank of the objects.

ovirtual PINDEX HashFunction() const
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.

Returns:
hash function value for class instance.

ovirtual void PrintOn( ostream &strm ) const
Output the contents of the URL to the stream as a string.
Parameters:
- strm Stream to print the object into.

ovirtual void ReadFrom( istream &strm )
Input the contents of the URL from the stream. The input is a URL in string form.
Parameters:
- strm Stream to read the objects contents from.

oinline BOOL Parse( const char* cstr, const char* defaultScheme = NULL )
Parse the URL string into the fields in the object instance.
Parameters:
- cstr URL as a string to parse.
defaultScheme - Default scheme for URL

oinline BOOL Parse( const PString & str, const char* defaultScheme = NULL )
Parse the URL string into the fields in the object instance.
Parameters:
- str URL as a string to parse.
defaultScheme - Default scheme for URL

oenum UrlFormat
Print/String output representation formats.

o FullURL
Translate to a string as a full URL

o PathOnly
Translate to a string as only path

o URIOnly
Translate to a string with no scheme or host

o HostPortOnly
Translate to a string with scheme and host/port

oPString AsString( UrlFormat fmt = FullURL ) const
Convert the URL object into its string representation. The parameter indicates whether a full or partial representation os to be produced.

Parameters:
- fmt The type of string to be returned.
Returns:
String representation of the URL.

oPFilePath AsFilePath() const
Get the "file:" URL as a file path. If the URL is not a "file:" URL then returns an empty string.

oenum TranslationType
Type for translation of strings to URL format,

o LoginTranslation
Translate a username/password field for a URL

o PathTranslation
Translate the path field for a URL

o QueryTranslation
Translate the query parameters field for a URL

ostatic PString TranslateString( const PString & str, TranslationType type )
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.

Parameters:
- str String to be translated.
- type Type of translation.
Returns:
String for the URL ready translation.

ostatic PString UntranslateString( const PString & str, TranslationType type )
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.

Parameters:
- str String to be translated.
- type Type of translation.
Returns:
String from the URL untranslated.

ostatic void SplitQueryVars( const PString & queryStr, PStringToString & queryVars )
Split a string in &= form to a dictionary of names and values.
Parameters:
queryStr - String to split into variables.
queryVars - Dictionary of variable names and values.

oconst PCaselessString& GetScheme() const
Get the scheme field of the URL

ovoid SetScheme(const PString & scheme)
Set the scheme field of the URL

oconst PString& GetUserName() const
Get the username field of the URL

ovoid SetUserName(const PString & username)
Set the username field of the URL

oconst PString& GetPassword() const
Get the password field of the URL

ovoid SetPassword(const PString & password)
Set the password field of the URL

oconst PCaselessString& GetHostName() const
Get the hostname field of the URL

ovoid SetHostName(const PString & hostname)
Set the hostname field of the URL

oWORD GetPort() const
Get the port field of the URL

ovoid SetPort(WORD newPort)
Set the port field in the URL

oBOOL GetRelativePath() const
Get if path is relative or absolute

oconst PString& GetPathStr() const
Get the path field of the URL as a string

ovoid SetPathStr(const PString & pathStr)
Set the path field of the URL as a string

oconst PStringArray& GetPath() const
Get the path field of the URL as a string array

ovoid SetPath(const PStringArray & path)
Set the path field of the URL as a string array

oPString GetParameters() const
Get the parameter (;) field of the URL

ovoid SetParameters(const PString & parameters)
Set the parameter (;) field of the URL

oconst PStringToString& GetParamVars() const
Get the parameter (;) field(s) of the URL as a string dictionary

ovoid SetParamVars(const PStringToString & paramVars)
Set the parameter (;) field(s) of the URL as a string dictionary

ovoid SetParamVar(const PString & key, const PString & data)
Set the parameter (;) field of the URL as a string dictionary

oconst PString& GetFragment() const
Get the fragment () field of the URL

oPString GetQuery() const
Get the Query (?) field of the URL as a string

ovoid SetQuery(const PString & query)
Set the Query (?) field of the URL as a string

oconst PStringToString& GetQueryVars() const
Get the Query (?) field of the URL as a string dictionary

ovoid SetQueryVars(const PStringToString & queryVars)
Set the Query (?) field(s) of the URL as a string dictionary

ovoid SetQueryVar(const PString & key, const PString & data)
Set the Query (?) field of the URL as a string dictionary

oBOOL IsEmpty() const
Return TRUE if the URL is an empty string

ostatic BOOL OpenBrowser( const PString & url )
Open the URL in a browser.

Parameters:
url - URL to open
Returns:
The browser was successfully opened. This does not mean the URL exists and was displayed.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.