Update contrib.
2 * Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 #ifndef __CAFVIRTUALPATHPTR_H__
29 #define __CAFVIRTUALPATHPTR_H__
33 namespace ContentAccess
38 The character used to separate the URI from the UniqueId
39 when the two are concatenated into a single descriptor
41 _LIT(KCafVirtualPathSeparator, "|");
43 /** Identifies the location of a file and a particular content object inside it.
45 TVirtualPathPtr points to the two descriptors (the URI and UniqueId) used
46 to initialise it. These descriptors must not be modified or destroyed while
47 the TVirtualPathPtr object is in use.
49 The URI must be in the format specified in RFC2396, found at http://www.ietf.org/.
51 The UniqueId will be created by the Agent. Content is only ever
52 accessed by one agent so it is the agents responsibility to ensure the
53 UniqueId is truly unique within the file.
55 It is also possible to flatten a virtual path into a single descriptor. The
56 ContentAccess::CVirtualPath class concatenates the URI, a separator, the KCafVirtualPathSeparator
57 character, and the UniqueId to form a single URI. TVirtualPathPtr can be used to
58 decode this virtual path into the URI and the content object UniqueId. The
59 concatenated URI and UniqueId take the format:
61 <URI><KCafVirtualPathSeparator><UniqueID>
64 An example of this format is shown below:
66 // Create a CVirtualPath object to point to OBJECT1 inside file.dcf
67 CVirtualPath *path = CVirtualPath::NewL(_L("C:\\directory\file.dcf"), _L("OBJECT1"));
69 // convert the URI and unique ID into a single URI.
70 TVirtualPathPtr aPath = path->GetCombinedUriUniqueId();
73 If a URI is supplied which contains multiple KCafVirtualPathSeparator characters
74 the rightmost KCafVirtualPathSeparator character will be taken as marking the end
75 of the URI and the start of the UniqueId. When multiple KCafVirtualPathSeparator
76 characters are present, under certain situations this will result in an invalid
77 URI and UniqueId being created for the virtual path and can lead to an undefined failure.
83 /** Constructor used when the URI and UniqueId fields are separate
84 @param aUri The location of the file
85 @param aUniqueId The location of the content within the file
87 IMPORT_C TVirtualPathPtr(const TDesC& aUri, const TDesC& aUniqueId);
89 /** Constructor used for a concatenated URI and UniqueId.
91 Note that the descriptor here may be just a URI or it could be a URI
92 concatenated with the file's UniqueId. If it is a concatenated URI and
93 UniqueId the URI and UniqueId will be seperated by the KCafVirtualPathSeparator character.
94 For more information see above.
95 @param aCombinedUriUniqueId The location of the content object
97 IMPORT_C TVirtualPathPtr(const TDesC& aCombinedUriUniqueId);
99 /** Copy constructor */
100 IMPORT_C TVirtualPathPtr(const TVirtualPathPtr& aPtr);
102 /** The location of the file containing the content object
103 @return The location of the file
105 IMPORT_C const TDesC& URI() const;
107 /** UniqueId supplied by a CAF Agent to identify the object within the
109 @return The location of the content within the file
111 IMPORT_C const TDesC& UniqueId() const;
113 /** Assignment operator */
114 IMPORT_C TVirtualPathPtr& operator = (const TVirtualPathPtr& aVirtualPath);
116 /** Assignment operator converts a single descriptor to a TVirtualPathPtr.
117 If the descriptor is just a URI, the TVirtualPathPtr will point to the KDefaultContentObject within that file.
118 If it is a concatenated URI and UniqueId the URI and UniqueId will be seperated by the KCafVirtualPathSeparator.
119 character as detailed in the description above.
121 IMPORT_C TVirtualPathPtr& operator = (const TDesC& aCombinedUriUniqueId);
125 // The Set() function is only used by CVirtualPath
126 friend class CVirtualPath;
128 /** Used to redirect the TVirtualPathPtr to point at a different set of descriptors */
129 void Set(const TDesC& aUri, const TDesC& aUniqueId);