ContentAccess::TVirtualPathPtr Class Reference

#include <caf/virtualpathptr.h>

class ContentAccess::TVirtualPathPtr
Public Member Functions
TVirtualPathPtr(const TDesC &, const TDesC &)
TVirtualPathPtr(const TDesC &)
TVirtualPathPtr(const TVirtualPathPtr &)
IMPORT_C const TDesC &URI()
IMPORT_C const TDesC &UniqueId()
IMPORT_C TVirtualPathPtr &operator=(const TVirtualPathPtr &)
IMPORT_C TVirtualPathPtr &operator=(const TDesC &)

Detailed Description

Identifies the location of a file and a particular content object inside it.

TVirtualPathPtr points to the two descriptors (the URI and UniqueId) used to initialise it. These descriptors must not be modified or destroyed while the TVirtualPathPtr object is in use.

The URI must be in the format specified in RFC2396, found at http://www.ietf.org/.

The UniqueId will be created by the Agent. Content is only ever accessed by one agent so it is the agents responsibility to ensure the UniqueId is truly unique within the file.

It is also possible to flatten a virtual path into a single descriptor. The ContentAccess::CVirtualPath class concatenates the URI, a separator, the KCafVirtualPathSeparator character, and the UniqueId to form a single URI. TVirtualPathPtr can be used to decode this virtual path into the URI and the content object UniqueId. The concatenated URI and UniqueId take 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

TVirtualPathPtr ( const TDesC &, const TDesC & )

IMPORT_CTVirtualPathPtr(const TDesC &aUri,
const TDesC &aUniqueId
)

Constructor used when the URI and UniqueId fields are separate

ParameterDescription
aUriThe location of the file
aUniqueIdThe location of the content within the file

TVirtualPathPtr ( const TDesC & )

IMPORT_CTVirtualPathPtr(const TDesC &aCombinedUriUniqueId)

Constructor used for a concatenated URI and UniqueId.

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 KCafVirtualPathSeparator character. For more information see above.

ParameterDescription
aCombinedUriUniqueIdThe location of the content object

TVirtualPathPtr ( const TVirtualPathPtr & )

IMPORT_CTVirtualPathPtr(const TVirtualPathPtr &aPtr)

Copy constructor

Member Function Documentation

URI ( )

IMPORT_C const TDesC &URI()const

The location of the file containing the content object

Returns: 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.

Returns: The location of the content within the file

operator= ( const TVirtualPathPtr & )

IMPORT_C TVirtualPathPtr &operator=(const TVirtualPathPtr &aVirtualPath)

Assignment operator

operator= ( const TDesC & )

IMPORT_C TVirtualPathPtr &operator=(const TDesC &aCombinedUriUniqueId)

Assignment operator converts a single descriptor to a TVirtualPathPtr. If the descriptor is just a URI, the TVirtualPathPtr will point to the KDefaultContentObject within that file. If it is a concatenated URI and UniqueId the URI and UniqueId will be seperated by the KCafVirtualPathSeparator. character as detailed in the description above.