CUri8 Class Reference

class CUri8 : public CBase

Dependencies : CBase, TUriC8. Comments : Provides 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 parsed uri information. It is owning. It uses 8-bit descriptors.

The functionality provided by this API allows the uri components to be set or removed from this parsed uri. Also, it provides a reference to TUriC8 object so that the non-modifying functionality can be used.
Since
6.0

Inherits from

Constructor & Destructor Documentation

CUri8(const TUriC8 &)

CUri8(const TUriC8 &aNewUri)[private]

Constructor. First phase of two-phase construction method. Does non-allocating construction.

Since
6.0

Parameters

const TUriC8 & aNewUriThe parsed uri component information from which to create the uri.

~CUri8()

IMPORT_C~CUri8()

Destructor.

Since
6.0

Member Functions Documentation

ConstructL()

voidConstructL()[private]

Second phase of two-phase construction method. Does any allocations required to fully construct the object.

Since
6.0
Pre-condition
First phase of construction is complete.
Post-condition
The object is fully constructed and initialized.

CreateFileUriL(const TDesC &, TUint)

IMPORT_C CUri8 *CreateFileUriL(const TDesC &aFullFileName,
TUintaFlags = 0
)[static]

Allocates and constructs a file URI object for a specified file.

  • If the file exists on a fixed drive, then the file URI takes the form: 'file://<drive-letter>/<filepath including filename>'.

  • If the file exists on a removable media drive, then the file URI takes the form: 'file://ext-media/<filepath including filename>'.

Since
9.1
Post-condition
A fully constructed and initialized file URI (CUri8) object.

Parameters

const TDesC & aFullFileNameA reference to a fully qualified filename
TUint aFlags = 0A flag to indicate if the file exists on a fixed drive or removable media drive. This is a TFileUriFlags value.

CreatePrivateFileUriL(const TDesC &, TDriveNumber, TInt)

IMPORT_C CUri8 *CreatePrivateFileUriL(const TDesC &aRelativeFileName,
TDriveNumberaDrive,
TIntaFlags = 0
)[static]

Allocates and constructs a file URI object for a file that is private to the application.

  • If the file exists on a fixed drive, then the file URI takes the form 'file://private/<drive-letter>/<filepath including filename>'.

  • If the file exists on a removable media drive, then the file URI takes the form 'file://private/ext-media/<filepath including filename>'.

Since
9.1
Post-condition
A fully constructed and initialized file URI (CUri8) object.

Parameters

const TDesC & aRelativeFileNameA reference to the filename relative to the application's private directory.
TDriveNumber aDriveDrive number, if the private file stored on fixed drive, otherwise not used This is a TDriveNumber value
TInt aFlags = 0A flag to indicate if the file exists on a fixed drive or removable media drive. This is a TFileUriFlags value.

FormUriL()

voidFormUriL()[private]

Forms the uri from the parsed uri information. A copy of the parsed uri is created. The parsed uri is changed to refer to the copy.

Since
6.0
Pre-condition
The parsed uri information is set.
Post-condition
The uri buffer is updated with the parsed uri information.

InitializeFileUriComponentsL(const TDesC &, TDriveNumber, TUint)

voidInitializeFileUriComponentsL(const TDesC &aFileName,
TDriveNumberaDrive,
TUintaFlags
)[private]

Initializes the file URI components (scheme, empty hostname and path).

It uses GenerateFileUriPathL() to generate a file Uri path using the filename and drive.

Since
9.1
Pre-condition
Object fully constructed
Post-condition
The object is initialized with file URI components.

Parameters

const TDesC & aFileNameA reference to a filename
TDriveNumber aDriveA drive number. This is a TFileUriFlags value.
TUint aFlagsA flag to indicate if the file exists on a fixed drive or removable media drive. This is a TFileUriFlags value.

NewL(const TUriC8 &)

IMPORT_C CUri8 *NewL(const TUriC8 &aUri)[static]

Static factory constructor. Uses two phase construction and leaves nothing on the CleanupStack. Creates a uri object which is a copy of the input parameter aUri.

Since
6.0
Post-condition
A fully constructed and initialized CUri8 object.

Parameters

const TUriC8 & aUriA reference to a parsed uri object.

NewL()

IMPORT_C CUri8 *NewL()[static]

Static factory constructor. Uses two phase construction and leaves nothing on the CleanupStack. Creates a uri object which is empty.

Since
6.0
Post-condition
A fully constructed and initialized CUri8 object.

NewLC(const TUriC8 &)

IMPORT_C CUri8 *NewLC(const TUriC8 &aUri)[static]

Static factory constructor. Uses two phase construction and leaves a pointer to created object on the CleanupStack. Creates a uri object which is a copy of the input parameter aUri.

Since
6.0
Post-condition
A fully constructed and initialized CUri8 object.

Parameters

const TUriC8 & aUriA reference to a parsed uri object.

NewLC()

IMPORT_C CUri8 *NewLC()[static]

Static factory constructor. Uses two phase construction and leaves a pointer to created object on the CleanupStack. Creates a uri object which is empty.

Since
6.0
Post-condition
A fully constructed and initialized CUri8 object.

RemoveComponentL(TUriComponent)

IMPORT_C voidRemoveComponentL(TUriComponentaComponent)

Removes the specified component from the uri. If the component does not exist then this function does nothing.

CAUTION:

If host is removed, then userinfo and port components will also be removed.

Since
6.0
Pre-condition
Object is fully constructed.
Post-condition
The uri is updated to exclude the specified component.

Parameters

TUriComponent aComponentAn enum specifying the component to be removed.

ResolveL(const TUriC8 &, const TUriC8 &)

IMPORT_C CUri8 *ResolveL(const TUriC8 &aBaseUri,
const TUriC8 &aRefUri
)[static]

Static factory constructor. This creates a CUri8 object that is an absolute uri resulting from a reference uri being resolved against a base uri.

CAUTION:

Ownership of created CUri8 object is transferred to the caller.

leave
KUriErrBadBasePath if the base path is not an absolute path and not empty.
Since
6.0
Pre-condition
The base uri must have an absolute or empty path, otherwise will leave with KUriErrBadBasePath.
Post-condition
A fully constructed and initialized CUri8 object.

Parameters

const TUriC8 & aBaseUriA referece to the parsed base uri.
const TUriC8 & aRefUriA referece to the parsed reference uri.

SetComponentL(const TDesC8 &, TUriComponent)

IMPORT_C voidSetComponentL(const TDesC8 &aData,
TUriComponentaComponent
)

Intended Usage : Sets the specified component in the uri. The component is set to the value given in the argument aData. If the specified component already exists then it is replaced with the new value.

CAUTION:

The userinfo and port components can only be set if the host component is present. Setting these components without a host component present will have no effect on the uri.

Since
6.0
Pre-condition
Object is fully constructed.
Post-condition
The uri has the specified component set to the new value. KErrArgument If aComponent goes out of range.

Parameters

const TDesC8 & aDataA descriptor pointer to the new value for the uri component.
TUriComponent aComponentAn enum specifying the component to be set.

Uri()

IMPORT_C const TUriC8 &Uri()const

Provides a reference to the parsed uri. Allows access to the non-modifying API for TUriC8.

Since
6.0

Member Data Documentation

TUriC8 iUri

TUriC8 iUri[private]

The parsed uri object.

HBufC8 * iUriBuf

HBufC8 *iUriBuf[private]

The descriptor buffer that contains the uri.