author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
/* |
williamr@4 | 2 |
* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 3 |
* All rights reserved. |
williamr@4 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@4 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 8 |
* |
williamr@4 | 9 |
* Initial Contributors: |
williamr@4 | 10 |
* Nokia Corporation - initial contribution. |
williamr@4 | 11 |
* |
williamr@4 | 12 |
* Contributors: |
williamr@4 | 13 |
* |
williamr@4 | 14 |
* Description: A class for using contact store URIs |
williamr@4 | 15 |
* |
williamr@4 | 16 |
*/ |
williamr@4 | 17 |
|
williamr@4 | 18 |
|
williamr@4 | 19 |
#ifndef TVPBKCONTACTSTOREURIPTR_H |
williamr@4 | 20 |
#define TVPBKCONTACTSTOREURIPTR_H |
williamr@4 | 21 |
|
williamr@4 | 22 |
|
williamr@4 | 23 |
// INCLUDES |
williamr@4 | 24 |
#include <e32std.h> |
williamr@4 | 25 |
#include <mvpbkstreamable.h> |
williamr@4 | 26 |
|
williamr@4 | 27 |
|
williamr@4 | 28 |
// CLASS DECLARATIONS |
williamr@4 | 29 |
|
williamr@4 | 30 |
/** |
williamr@4 | 31 |
* A class for using contact store URIs (Uniform Resource Identifier). |
williamr@4 | 32 |
* |
williamr@4 | 33 |
* A URI identifies a contact store. This class is a helper for |
williamr@4 | 34 |
* accessing URI data. It can be used to separate the different parts |
williamr@4 | 35 |
* of the URI and compare URIs. |
williamr@4 | 36 |
* |
williamr@4 | 37 |
* E.g. A URI of the store could be cntdb://c:contacts.cdb. |
williamr@4 | 38 |
* This URI have three components: |
williamr@4 | 39 |
* 1) cntdb is a scheme - EContactStoreUriStoreType |
williamr@4 | 40 |
* 2) c is a drive of the database - EContactStoreUriStoreDrive |
williamr@4 | 41 |
* 3) c:contacts.cdb is the location - EContactStoreUriStoreLocation |
williamr@4 | 42 |
* |
williamr@4 | 43 |
* @lib VPbkEng.lib |
williamr@4 | 44 |
*/ |
williamr@4 | 45 |
class TVPbkContactStoreUriPtr : public MVPbkStreamable |
williamr@4 | 46 |
{ |
williamr@4 | 47 |
public: // Types |
williamr@4 | 48 |
/** |
williamr@4 | 49 |
* URI component types. |
williamr@4 | 50 |
*/ |
williamr@4 | 51 |
enum TVPbkContactStoreUriComponent |
williamr@4 | 52 |
{ |
williamr@4 | 53 |
/// the whole URI |
williamr@4 | 54 |
EContactStoreUriAllComponents, |
williamr@4 | 55 |
/// the stores type, the URI's scheme |
williamr@4 | 56 |
EContactStoreUriStoreType, |
williamr@4 | 57 |
/// the stores drive letter |
williamr@4 | 58 |
EContactStoreUriStoreDrive, |
williamr@4 | 59 |
/// the stores file/host location |
williamr@4 | 60 |
EContactStoreUriStoreLocation |
williamr@4 | 61 |
}; |
williamr@4 | 62 |
|
williamr@4 | 63 |
public: // constructor and destructor |
williamr@4 | 64 |
/** |
williamr@4 | 65 |
* Constructs a URI pointer to aStoreUri. |
williamr@4 | 66 |
* |
williamr@4 | 67 |
* @param aStoreUri A reference to the contact store URI. |
williamr@4 | 68 |
*/ |
williamr@4 | 69 |
IMPORT_C TVPbkContactStoreUriPtr(const TDesC& aStoreUri); |
williamr@4 | 70 |
|
williamr@4 | 71 |
/** |
williamr@4 | 72 |
* Constructor. |
williamr@4 | 73 |
*/ |
williamr@4 | 74 |
IMPORT_C TVPbkContactStoreUriPtr(); |
williamr@4 | 75 |
|
williamr@4 | 76 |
public: // interface |
williamr@4 | 77 |
/** |
williamr@4 | 78 |
* Returns a descriptor that holds the whole Uri. |
williamr@4 | 79 |
* |
williamr@4 | 80 |
* @return A descriptor that holds the whole Uri. |
williamr@4 | 81 |
*/ |
williamr@4 | 82 |
IMPORT_C const TDesC& UriDes() const; |
williamr@4 | 83 |
|
williamr@4 | 84 |
/** |
williamr@4 | 85 |
* Compares this URI's component to aUri's component. |
williamr@4 | 86 |
* |
williamr@4 | 87 |
* @param aUri The URI whose component is compared. |
williamr@4 | 88 |
* @param aComponent Defines the component that are compared. |
williamr@4 | 89 |
* @return Zero if the URIs are the same. |
williamr@4 | 90 |
*/ |
williamr@4 | 91 |
IMPORT_C TInt Compare(const TVPbkContactStoreUriPtr& aUri, |
williamr@4 | 92 |
TVPbkContactStoreUriComponent aComponent) const; |
williamr@4 | 93 |
|
williamr@4 | 94 |
/** |
williamr@4 | 95 |
* Compares this URI's component to aUriComponent. |
williamr@4 | 96 |
* |
williamr@4 | 97 |
* @param aUriComponent A descriptor that contains the component data. |
williamr@4 | 98 |
* @param aComponent Defines the component of this URI that is compared |
williamr@4 | 99 |
* to aUriComponent. |
williamr@4 | 100 |
* @return Zero if components matched. |
williamr@4 | 101 |
*/ |
williamr@4 | 102 |
IMPORT_C TInt Compare(const TDesC& aUriComponent, |
williamr@4 | 103 |
TVPbkContactStoreUriComponent aComponent) const; |
williamr@4 | 104 |
|
williamr@4 | 105 |
/** |
williamr@4 | 106 |
* Returns a pointer to the aComponent part of URI. |
williamr@4 | 107 |
* |
williamr@4 | 108 |
* @param aComponent Defines the component that is returned. |
williamr@4 | 109 |
* @return a pointer to the aComponent part of URI. |
williamr@4 | 110 |
*/ |
williamr@4 | 111 |
IMPORT_C const TPtrC Component( |
williamr@4 | 112 |
TVPbkContactStoreUriComponent aComponent) const; |
williamr@4 | 113 |
|
williamr@4 | 114 |
/** |
williamr@4 | 115 |
* Sets this URI pointer to point to the same URI as aUri. |
williamr@4 | 116 |
* |
williamr@4 | 117 |
* @param aUri The URI that will be pointed to. |
williamr@4 | 118 |
*/ |
williamr@4 | 119 |
IMPORT_C void Set(const TVPbkContactStoreUriPtr& aUri); |
williamr@4 | 120 |
|
williamr@4 | 121 |
/** |
williamr@4 | 122 |
* Returns the length of the URI. |
williamr@4 | 123 |
* |
williamr@4 | 124 |
* @return The length of the URI. |
williamr@4 | 125 |
*/ |
williamr@4 | 126 |
IMPORT_C TInt Length() const; |
williamr@4 | 127 |
|
williamr@4 | 128 |
public: // from MVPbkStreamable |
williamr@4 | 129 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
williamr@4 | 130 |
IMPORT_C TInt ExternalizedSize() const; |
williamr@4 | 131 |
|
williamr@4 | 132 |
private: // implementation |
williamr@4 | 133 |
TInt Compare(const TDesC& aLhsUri, const TDesC& aRhsUri) const; |
williamr@4 | 134 |
|
williamr@4 | 135 |
private: // Data |
williamr@4 | 136 |
/// Own: Pointer to the URI |
williamr@4 | 137 |
TPtrC iUriBufferPointer; |
williamr@4 | 138 |
///Own: Extension reserve |
williamr@4 | 139 |
TAny* iSpare; |
williamr@4 | 140 |
}; |
williamr@4 | 141 |
|
williamr@4 | 142 |
#endif // TVPBKCONTACTSTOREURIPTR_H |
williamr@4 | 143 |
|
williamr@4 | 144 |
//End of file |