ContentAccess::TVirtualPathPtr Class Reference

class ContentAccess::TVirtualPathPtr

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.

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 &)
Private Member Functions
void Set (const TDesC &, const TDesC &)
Private Attributes
TPtrC iUniqueId
TPtrC iUri

Constructor & Destructor Documentation

TVirtualPathPtr(const TDesC &, const TDesC &)

IMPORT_C TVirtualPathPtr ( const TDesC & aUri,
const TDesC & aUniqueId
)

Constructor used when the URI and UniqueId fields are separate

Parameters

const TDesC & aUri The location of the file
const TDesC & aUniqueId The location of the content within the file

TVirtualPathPtr(const TDesC &)

IMPORT_C TVirtualPathPtr ( 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.

Parameters

const TDesC & aCombinedUriUniqueId The location of the content object

TVirtualPathPtr(const TVirtualPathPtr &)

IMPORT_C TVirtualPathPtr ( const TVirtualPathPtr & aPtr )

Copy constructor

Parameters

const TVirtualPathPtr & aPtr

Member Functions Documentation

Set(const TDesC &, const TDesC &)

void Set ( const TDesC & aUri,
const TDesC & aUniqueId
) [private]

Used to redirect the TVirtualPathPtr to point at a different set of descriptors

Parameters

const TDesC & aUri
const TDesC & aUniqueId

URI()

IMPORT_C const TDesC & URI ( ) const

The location of the file containing the content object

UniqueId()

IMPORT_C const TDesC & UniqueId ( ) const

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

operator=(const TVirtualPathPtr &)

IMPORT_C TVirtualPathPtr & operator= ( const TVirtualPathPtr & aVirtualPath )

Assignment operator

Parameters

const TVirtualPathPtr & aVirtualPath

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.

Parameters

const TDesC & aCombinedUriUniqueId

Member Data Documentation

TPtrC iUniqueId

TPtrC iUniqueId [private]

TPtrC iUri

TPtrC iUri [private]