Update contrib.
2 * Copyright (c) 2004-2009 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.
20 #include <caf/virtualpathptr.h>
22 #include <caf/caftypes.h>
24 using namespace ContentAccess;
26 EXPORT_C TVirtualPathPtr::TVirtualPathPtr(const TDesC& aCombinedUriUniqueId) : iUri(KNullDesC16()), iUniqueId(KNullDesC16())
28 TInt pos = KErrNotFound;
30 //Search the URI looking for rightmost the separator character in case it is URI concatenated with UniqueId
31 pos = aCombinedUriUniqueId.LocateReverse(KCafVirtualPathSeparator()[0]);
33 // if the length and position are valid seperate the URI and UniqueId
34 if(pos != KErrNotFound && aCombinedUriUniqueId.Length() - pos < KMaxCafUniqueId)
36 // Found the separator character
37 TInt uniqueIdLength = aCombinedUriUniqueId.Length() - pos - 1;
39 // Set the URI and UniqueId to point the corresponding parts of the supplied descriptor
40 Set(aCombinedUriUniqueId.Left(pos), aCombinedUriUniqueId.Right(uniqueIdLength));
44 // If its just a URI, make sure we point to the default content object
45 Set(aCombinedUriUniqueId, KDefaultContentObject());
49 EXPORT_C TVirtualPathPtr::TVirtualPathPtr(const TDesC& aUri, const TDesC& aUniqueId) : iUri(aUri), iUniqueId(aUniqueId)
53 EXPORT_C TVirtualPathPtr::TVirtualPathPtr(const TVirtualPathPtr& aPtr) : iUri(aPtr.URI()), iUniqueId(aPtr.UniqueId())
58 EXPORT_C const TDesC& TVirtualPathPtr::URI() const
63 EXPORT_C const TDesC& TVirtualPathPtr::UniqueId() const
68 void TVirtualPathPtr::Set(const TDesC& aUri, const TDesC& aUniqueId)
71 iUniqueId.Set(aUniqueId);
74 EXPORT_C TVirtualPathPtr& TVirtualPathPtr::operator = (const TVirtualPathPtr& aVirtualPath)
76 Set(aVirtualPath.URI(), aVirtualPath.UniqueId());
80 EXPORT_C TVirtualPathPtr& TVirtualPathPtr::operator = (const TDesC& aCombinedUriUniqueId)
82 TVirtualPathPtr temp(aCombinedUriUniqueId);
83 Set(temp.URI(), temp.UniqueId());