ContentAccess::CVirtualPath Class Reference

#include <caf/virtualpath.h>

Link against: cafutils.lib

class ContentAccess::CVirtualPath : public CBase

Inherits from

  • ContentAccess::CVirtualPath

Detailed Description

A virtual path describes the location of the file (URI) and the location of a content object within that file (Unique Id).

The URI must conform to the standard defined in RFC2396, found at http://www.ietf.org/.

CVirtualPath makes a copy of the URI and UniqueId used to identify a particular content object within a file.

The TVirtualPathPtr cast operator allows the CVirtualPath object to be used with CAF functions requiring a TVirtualPathPtr.

The GetCombinedUriUniqueId() function allows it to "flatten" a virtual path into a single URI. The combined virtual path will be the URI concatenated with the UniqueId seperated by the KCafVirtualPathSeparator character taking the format.
		<URI><KCafVirtualPathSeparator><UniqueID>
An example of this format is shown below:
	// Create a CVirtualPath object to point to OBJECT1 inside file.dcf
	CVirtualPath *path = CVirtualPath::NewL(_L("C:\\directory\file.dcf"), _L("OBJECT1"));

	// convert the URI and unique ID into a single URI.
	TVirtualPathPtr aPath = path->GetCombinedUriUniqueId();
Note:

If a URI is supplied which contains multiple KCafVirtualPathSeparator characters the rightmost KCafVirtualPathSeparator character will be taken as marking the end of the URI and the start of the UniqueId. When multiple KCafVirtualPathSeparator characters are present, under certain situations this will result in an invalid URI and UniqueId being created for the virtual path and can lead to an undefined failure.

Constructor & Destructor Documentation

~CVirtualPath ( )

~CVirtualPath()[virtual]

Member Function Documentation

ExternalizeL ( RWriteStream & )

IMPORT_C voidExternalizeL(RWriteStream &aStream)const

Allows the class to write itself to a stream

Parameters
aStreamThe stream to write to

GetCombinedUriUniqueId ( )

IMPORT_C const TDesC &GetCombinedUriUniqueId()

Convert the CVirtualPath to a single URI representing a particular content object. The URI and UniqueId will be separated by a KCafVirtualPathSeparator()

Return Value
A descriptor contaning the URI and UniqueId concatenated together

NewL ( const TVirtualPathPtr & )

IMPORT_C CVirtualPath *NewL(const TVirtualPathPtr &aPtr)[static]

Create a CVirtualPath object from a TVirtualPathPtr

Parameters
aPtrThe location of the content object
Return Value
a new CVirtualPath object

NewL ( const TDesC & )

IMPORT_C CVirtualPath *NewL(const TDesC &aCombinedUriUniqueId)[static]

Create a virtual path object from a combined Uri and UniqueId

This constructs a CVirtual path from a single descriptor.

Note that the descriptor here may be just a URI or it could be a URI concatenated with the file's UniqueId. If it is a concatenated URI and UniqueId the URI and UniqueId will be seperated by the KCasfVirtualPathSeparator character. For more information see above.

Parameters
aCombinedUriUniqueIdThe location of the content object
Return Value
a new CVirtualPath object

NewL ( const TDesC &, const TDesC & )

IMPORT_C CVirtualPath *NewL(const TDesC &aURI,
const TDesC &aUniqueId
)[static]

Create a virtual path object for a specific content object within a file

Parameters
aURIThe location of the file
aUniqueIdThe location of the content within the file
Return Value
a new CVirtualPath object

NewL ( RReadStream & )

IMPORT_C CVirtualPath *NewL(RReadStream &aStream)[static]

Construct and read a CVirtualPath object from a stream

Parameters
aStreamThe stream to read frin

URI ( )

IMPORT_C const TDesC &URI()const

The location of the file containing the content object

Return Value
The location of the file

UniqueId ( )

IMPORT_C const TDesC &UniqueId()const

UniqueId supplied by a CAF Agent to identify the object within the file.

Return Value
The uniqueId of the object within the file

operator const TVirtualPathPtr & ( )

operator const TVirtualPathPtr &()const [inline]

Cast operator allowing the CVirtualPath to be used as a TVirtualPathPtr

Return Value
a TVirtualPathPtr with the same value as this object