epoc32/include/caf/virtualpathptr.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
/** 
williamr@2
    21
@file
williamr@2
    22
williamr@4
    23
@publishedAll
williamr@2
    24
@released
williamr@2
    25
*/
williamr@2
    26
williamr@2
    27
williamr@2
    28
#ifndef __CAFVIRTUALPATHPTR_H__
williamr@2
    29
#define __CAFVIRTUALPATHPTR_H__
williamr@2
    30
williamr@2
    31
#include <e32base.h>
williamr@2
    32
williamr@2
    33
namespace ContentAccess
williamr@2
    34
	{
williamr@2
    35
	class CVirtualPath;
williamr@2
    36
williamr@2
    37
	/** 
williamr@2
    38
	The character used to separate the URI from the UniqueId 
williamr@2
    39
	when the two are concatenated into a single descriptor 
williamr@2
    40
	*/
williamr@2
    41
	_LIT(KCafVirtualPathSeparator, "|");
williamr@2
    42
williamr@2
    43
	/**	Identifies the location of a file and a particular content object inside it.
williamr@2
    44
williamr@2
    45
	TVirtualPathPtr points to the two descriptors (the URI and UniqueId) used 
williamr@2
    46
	to initialise it. These descriptors must not be modified or destroyed while 
williamr@2
    47
	the TVirtualPathPtr object is in use. 
williamr@2
    48
	
williamr@2
    49
	The URI must be in the format specified in RFC2396, found at http://www.ietf.org/.
williamr@2
    50
williamr@2
    51
	The UniqueId will be created by the Agent. Content is only ever
williamr@2
    52
	accessed by one agent so it is the agents responsibility to ensure the 
williamr@2
    53
	UniqueId is truly unique within the file.
williamr@2
    54
williamr@2
    55
	It is also possible to flatten a virtual path into a single descriptor. The
williamr@2
    56
	ContentAccess::CVirtualPath class concatenates the URI, a separator, the KCafVirtualPathSeparator
williamr@2
    57
	character, and the UniqueId to form a single URI. TVirtualPathPtr can be used to 
williamr@2
    58
	decode this virtual path into the URI and the content object UniqueId. The 
williamr@2
    59
	concatenated URI and UniqueId take the format:
williamr@2
    60
	@code
williamr@2
    61
		<URI><KCafVirtualPathSeparator><UniqueID>
williamr@2
    62
	@endcode
williamr@2
    63
	
williamr@2
    64
	An example of this format is shown below:		
williamr@2
    65
	@code
williamr@2
    66
	// Create a CVirtualPath object to point to OBJECT1 inside file.dcf
williamr@2
    67
	CVirtualPath *path = CVirtualPath::NewL(_L("C:\\directory\file.dcf"), _L("OBJECT1"));
williamr@2
    68
williamr@2
    69
	// convert the URI and unique ID into a single URI.
williamr@2
    70
	TVirtualPathPtr aPath = path->GetCombinedUriUniqueId();
williamr@2
    71
	@endcode
williamr@2
    72
	@note
williamr@2
    73
	If a URI is supplied which contains multiple KCafVirtualPathSeparator characters 
williamr@2
    74
	the rightmost KCafVirtualPathSeparator character will be taken as marking the end
williamr@2
    75
	of the URI and the start of the UniqueId. When multiple KCafVirtualPathSeparator
williamr@2
    76
	characters are present, under certain situations this will result in an invalid 
williamr@2
    77
	URI and UniqueId being created for the virtual path and can lead to an undefined failure.
williamr@2
    78
williamr@2
    79
	*/
williamr@2
    80
	class TVirtualPathPtr
williamr@2
    81
		{
williamr@2
    82
	public:
williamr@2
    83
		/** Constructor used when the URI and UniqueId fields are separate 
williamr@2
    84
		@param aUri The location of the file
williamr@2
    85
		@param aUniqueId The location of the content within the file
williamr@2
    86
		*/
williamr@2
    87
		IMPORT_C TVirtualPathPtr(const TDesC& aUri, const TDesC& aUniqueId);
williamr@2
    88
williamr@2
    89
		/** Constructor used for a concatenated URI and UniqueId.
williamr@2
    90
		
williamr@2
    91
		Note that the descriptor here may be just a URI or it could be a URI
williamr@2
    92
		concatenated with the file's UniqueId. If it is a concatenated URI and 
williamr@2
    93
		UniqueId the URI and UniqueId will be seperated by the KCafVirtualPathSeparator character.
williamr@2
    94
		For more information see above.
williamr@2
    95
		@param aCombinedUriUniqueId The location of the content object
williamr@2
    96
		*/
williamr@2
    97
		IMPORT_C TVirtualPathPtr(const TDesC& aCombinedUriUniqueId);
williamr@2
    98
williamr@2
    99
		/** Copy constructor */
williamr@2
   100
		IMPORT_C TVirtualPathPtr(const TVirtualPathPtr& aPtr);
williamr@2
   101
williamr@2
   102
		/** The location of the file containing the content object 
williamr@2
   103
		@return The location of the file
williamr@2
   104
		*/
williamr@2
   105
		IMPORT_C const TDesC& URI() const;
williamr@2
   106
williamr@2
   107
		/** UniqueId supplied by a CAF Agent to identify the object within the 
williamr@2
   108
		file.  
williamr@2
   109
		@return The location of the content within the file
williamr@2
   110
		*/
williamr@2
   111
		IMPORT_C const TDesC& UniqueId() const;
williamr@2
   112
williamr@2
   113
		/** Assignment operator */
williamr@2
   114
		IMPORT_C TVirtualPathPtr& operator = (const TVirtualPathPtr& aVirtualPath);
williamr@2
   115
	
williamr@2
   116
		/** Assignment operator converts a single descriptor to a TVirtualPathPtr.
williamr@2
   117
		If the descriptor is just a URI, the TVirtualPathPtr will point to the KDefaultContentObject within that file.
williamr@2
   118
		If it is a concatenated URI and UniqueId the URI and UniqueId will be seperated by the KCafVirtualPathSeparator. 
williamr@2
   119
		character as detailed in the description above.   
williamr@2
   120
		*/
williamr@2
   121
		IMPORT_C TVirtualPathPtr& operator = (const TDesC& aCombinedUriUniqueId);
williamr@2
   122
williamr@2
   123
williamr@2
   124
	private:
williamr@2
   125
		// The Set() function is only used by CVirtualPath
williamr@2
   126
		friend class CVirtualPath;
williamr@2
   127
williamr@2
   128
		/** Used to redirect the TVirtualPathPtr to point at a different set of descriptors */
williamr@2
   129
		void Set(const TDesC& aUri, const TDesC& aUniqueId);
williamr@2
   130
williamr@2
   131
	private:
williamr@2
   132
		TPtrC iUri;
williamr@2
   133
		TPtrC iUniqueId;
williamr@2
   134
		};
williamr@2
   135
	}
williamr@2
   136
williamr@2
   137
#endif