TUriC16 Class Reference

#include <uri16.h>

Link against: inetprotutil.lib

class TUriC16
Protected Attributes
TPtrC16 iComponent
TPtrC16 iUriDes
Public Member Functions
IMPORT_C TIntCompare(const TUriC16 &, TUriComponent)
IMPORT_C HBufC *DisplayFormL(TUriComponent)
IMPORT_C TIntEquivalent(const TUriC16 &)
IMPORT_C const TDesC16 &Extract(TUriComponent)
IMPORT_C HBufC *GetFileNameL()
IMPORT_C HBufC *GetFileNameL(TUriFileName)
IMPORT_C TBoolIsPresent(TUriComponent)
IMPORT_C TBoolIsSchemeValid()
IMPORT_C const TDesC16 &UriDes()
IMPORT_C voidUriWithoutFragment(TPtrC16 &)
IMPORT_C TIntValidate()
Protected Member Functions
TUriC16()
voidReset()

Detailed Description

Dependencies : TUriComponent. Comments : Provides non-modifying functionality on the components of a uri object as defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.

The object holds descriptor pointers to the parsed uri components and a descriptor pointer to the uri. It is non-owning. It uses 16-bit descriptors.

The functionality provided by this API allows the uri components to be extracted from the parsed uri, checked for their presence in the uri and be compared with those in another DeprecatedDeprecated in 9.1 TUriC16 object.
Since
6.0

Member Attribute Documentation

iComponent

TPtrC16 iComponent[protected]

The array of descriptor pointers to the uri components.

iUriDes

TPtrC16 iUriDes[protected]

The descriptor pointer to the uri.

Constructor & Destructor Documentation

TUriC16 ( )

IMPORT_CTUriC16()[protected]

Constructor.

DeprecatedDeprecated in 9.1
Since
6.0

Member Function Documentation

Compare ( const TUriC16 &, TUriComponent )

IMPORT_C TIntCompare(const TUriC16 &aUri,
TUriComponentaComponent
)const

Compares the specified component against the one in the uri passed in.

DeprecatedDeprecated in 9.1
Since
6.0
Parameters
aUriThe uri to compare components against.
aComponentThe enum specifying the component to compare.
Return Value
An integer value of zero if the components are the same, any other value if the components are not the same.

DisplayFormL ( TUriComponent )

IMPORT_C HBufC *DisplayFormL(TUriComponentaComponent = EUriComplete)const

Create a new HBufC descriptor containing the desired component or the full URI. DeprecatedDeprecated in 9.1 - provided for compatibility

Parameters
aComponentThe component to convert into Unicode (EUriScheme - EUriFragment), or the full URI (EUriComplete -- the default).
Return Value
The descriptor containing the desired component.

Equivalent ( const TUriC16 & )

IMPORT_C TIntEquivalent(const TUriC16 &aUri)const

DeprecatedDeprecated in 9.1 -- provided for compatibility

Compares the given URI to determine if it is equivalent to this URI. It is possible for URIs declared NOT equivalent by this method to be equvalent to a level not checked by this method.

Parameters
aUriContains URI to compare
Return Value
ETrue if the two URIs are equivalent otherwise EFalse

Extract ( TUriComponent )

IMPORT_C const TDesC16 &Extract(TUriComponentaComponent)const

Retrieves the specified component in the uri.

DeprecatedDeprecated in 9.1
Since
6.0
Parameters
aComponentThe enum specifying the component.
Return Value
A constant reference to a descriptor pointer to the specified component.

GetFileNameL ( )

IMPORT_C HBufC *GetFileNameL()const

Generates a fully-qualified filename from a file URI object.

The form of the returned filename depends on the file location, as follows:
  • public file on a fixed drive:
    		file://c/path/to/file/name.ext -> c:\path\to\file\name.ext
  • public file on removable media drive: The fully-qualified filename is resolved by finding the first drive on which the file exists. If the file does not exist, this will Leave with KErrNotFound
    		file://ext-media/path/to/file/name.ext -> f:\path\to\file\name.ext
    (where f: is the first drive found containing "\path\to\file\name.ext")

The returned file name is not guaranteed to exist except where specified above.

Be warned that this method may be slow when resolving special paths (like "/ext-media")

Since
9.1
Pre-condition
Object is fully constructed.
Return Value
A descriptor containing the fully-qualified filename.
Leave Codes
KErrNotSupportedURI does not specify a local file
KErrNotFoundIf the URI indicates the file is on removable media and the file does not exist on any.

GetFileNameL ( TUriFileName )

IMPORT_C HBufC *GetFileNameL(TUriFileNameaType)const

This creates a file name from the URI, changing the network path separator (/) to the local file system path separator (\).

If called with EUriFileNamePath, this will generate a file name containing the path relative to the drive. Any parameters in the URI are stripped off:
		http://www.foo.com/dir/file/name.ext;param1;param2 -> \dir\file\name.ext
If called with EUriFileNameTail, this will generate a just the name, with no directories or drive. Any parameters in the URI are stripped off:
		http://www.foo.com/dir/file/name.ext;param1;param2 -> name.ext

EUriFileNamePath and EUriFileNameTail can be used for any hierarchical URI (http, ftp, file) and may have unexpected behaviour when called on any other type of URI.

If called with EUriFileNameFull, this will convert the URI into a fully-qualified filename. this is only valid for file URIs and will Leave if called on any other type of URI. The form of the returned filename is described in GetFileNameL with no arguments.

Since
9.1
Pre-condition
Object is fully constructed.
Parameters
aTypespecifies what part of the filename is to be converted. The default is (EUriFileNameFull).
Return Value
A descriptor containing the desired filename components.
Leave Codes
KErrNotSupportedThe URI scheme cannot be converted into the desired type

IsPresent ( TUriComponent )

IMPORT_C TBoolIsPresent(TUriComponentaComponent)const

Indicates whether the specified component is present in the uri.

DeprecatedDeprecated in 9.1
Since
6.0
Parameters
aComponentThe enum specifying the component.
Return Value
A boolean value of ETrue if the desired component is present, or EFalse if the desired component is not present.

IsSchemeValid ( )

IMPORT_C TBoolIsSchemeValid()const

Checks to see if the scheme is valid. If there is no scheme then the return value indicates an invalid scheme (EFalse).

DeprecatedDeprecated in 9.1
Since
6.0
Return Value
A boolean value of ETrue if the scheme is valid, or EFalse if the scheme is not.

Reset ( )

voidReset()[protected]

Resets the descriptor pointers for the uri components and the uri.

Since
6.0
Post-condition
All uri component information is removed and the uri descriptor is set to NULL.

UriDes ( )

IMPORT_C const TDesC16 &UriDes()const

Retrieves the descriptor for the entire uri.

DeprecatedDeprecated in 9.1
Since
6.0
Return Value
A const reference to a descriptor pointer to the uri.

UriWithoutFragment ( TPtrC16 & )

IMPORT_C voidUriWithoutFragment(TPtrC16 &aUriNoFrag)const

Retrieves the uri without the fragment component.

DeprecatedDeprecated in 9.1
Since
6.0
Parameters
aUriNoFragAn output parameter which is set the non-reference version of the uri.

Validate ( )

IMPORT_C TIntValidate()const

DeprecatedDeprecated in 9.1 -- provided for compatibility

Ensures that all components of the URI are valid. If the method returns KUriUtilsErrInvalidUri then one or more components are not valid. It is possible for URIs declared valid by this method to be, on detailed inspection, invalid.

Return Value
KErrNone for vaild URIs, KUriUtilsErrInvalidUri for invalid URIs or KErrNotSupported.