2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "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.
14 * Description: A class for using contact store URIs
19 #ifndef TVPBKCONTACTSTOREURIPTR_H
20 #define TVPBKCONTACTSTOREURIPTR_H
25 #include <mvpbkstreamable.h>
31 * A class for using contact store URIs (Uniform Resource Identifier).
33 * A URI identifies a contact store. This class is a helper for
34 * accessing URI data. It can be used to separate the different parts
35 * of the URI and compare URIs.
37 * E.g. A URI of the store could be cntdb://c:contacts.cdb.
38 * This URI have three components:
39 * 1) cntdb is a scheme - EContactStoreUriStoreType
40 * 2) c is a drive of the database - EContactStoreUriStoreDrive
41 * 3) c:contacts.cdb is the location - EContactStoreUriStoreLocation
45 class TVPbkContactStoreUriPtr : public MVPbkStreamable
49 * URI component types.
51 enum TVPbkContactStoreUriComponent
54 EContactStoreUriAllComponents,
55 /// the stores type, the URI's scheme
56 EContactStoreUriStoreType,
57 /// the stores drive letter
58 EContactStoreUriStoreDrive,
59 /// the stores file/host location
60 EContactStoreUriStoreLocation
63 public: // constructor and destructor
65 * Constructs a URI pointer to aStoreUri.
67 * @param aStoreUri A reference to the contact store URI.
69 IMPORT_C TVPbkContactStoreUriPtr(const TDesC& aStoreUri);
74 IMPORT_C TVPbkContactStoreUriPtr();
78 * Returns a descriptor that holds the whole Uri.
80 * @return A descriptor that holds the whole Uri.
82 IMPORT_C const TDesC& UriDes() const;
85 * Compares this URI's component to aUri's component.
87 * @param aUri The URI whose component is compared.
88 * @param aComponent Defines the component that are compared.
89 * @return Zero if the URIs are the same.
91 IMPORT_C TInt Compare(const TVPbkContactStoreUriPtr& aUri,
92 TVPbkContactStoreUriComponent aComponent) const;
95 * Compares this URI's component to aUriComponent.
97 * @param aUriComponent A descriptor that contains the component data.
98 * @param aComponent Defines the component of this URI that is compared
100 * @return Zero if components matched.
102 IMPORT_C TInt Compare(const TDesC& aUriComponent,
103 TVPbkContactStoreUriComponent aComponent) const;
106 * Returns a pointer to the aComponent part of URI.
108 * @param aComponent Defines the component that is returned.
109 * @return a pointer to the aComponent part of URI.
111 IMPORT_C const TPtrC Component(
112 TVPbkContactStoreUriComponent aComponent) const;
115 * Sets this URI pointer to point to the same URI as aUri.
117 * @param aUri The URI that will be pointed to.
119 IMPORT_C void Set(const TVPbkContactStoreUriPtr& aUri);
122 * Returns the length of the URI.
124 * @return The length of the URI.
126 IMPORT_C TInt Length() const;
128 public: // from MVPbkStreamable
129 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
130 IMPORT_C TInt ExternalizedSize() const;
132 private: // implementation
133 TInt Compare(const TDesC& aLhsUri, const TDesC& aRhsUri) const;
136 /// Own: Pointer to the URI
137 TPtrC iUriBufferPointer;
138 ///Own: Extension reserve
142 #endif // TVPBKCONTACTSTOREURIPTR_H