williamr@4: /* williamr@4: * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: A class for using contact store URIs williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef TVPBKCONTACTSTOREURIPTR_H williamr@4: #define TVPBKCONTACTSTOREURIPTR_H williamr@4: williamr@4: williamr@4: // INCLUDES williamr@4: #include <e32std.h> williamr@4: #include <mvpbkstreamable.h> williamr@4: williamr@4: williamr@4: // CLASS DECLARATIONS williamr@4: williamr@4: /** williamr@4: * A class for using contact store URIs (Uniform Resource Identifier). williamr@4: * williamr@4: * A URI identifies a contact store. This class is a helper for williamr@4: * accessing URI data. It can be used to separate the different parts williamr@4: * of the URI and compare URIs. williamr@4: * williamr@4: * E.g. A URI of the store could be cntdb://c:contacts.cdb. williamr@4: * This URI have three components: williamr@4: * 1) cntdb is a scheme - EContactStoreUriStoreType williamr@4: * 2) c is a drive of the database - EContactStoreUriStoreDrive williamr@4: * 3) c:contacts.cdb is the location - EContactStoreUriStoreLocation williamr@4: * williamr@4: * @lib VPbkEng.lib williamr@4: */ williamr@4: class TVPbkContactStoreUriPtr : public MVPbkStreamable williamr@4: { williamr@4: public: // Types williamr@4: /** williamr@4: * URI component types. williamr@4: */ williamr@4: enum TVPbkContactStoreUriComponent williamr@4: { williamr@4: /// the whole URI williamr@4: EContactStoreUriAllComponents, williamr@4: /// the stores type, the URI's scheme williamr@4: EContactStoreUriStoreType, williamr@4: /// the stores drive letter williamr@4: EContactStoreUriStoreDrive, williamr@4: /// the stores file/host location williamr@4: EContactStoreUriStoreLocation williamr@4: }; williamr@4: williamr@4: public: // constructor and destructor williamr@4: /** williamr@4: * Constructs a URI pointer to aStoreUri. williamr@4: * williamr@4: * @param aStoreUri A reference to the contact store URI. williamr@4: */ williamr@4: IMPORT_C TVPbkContactStoreUriPtr(const TDesC& aStoreUri); williamr@4: williamr@4: /** williamr@4: * Constructor. williamr@4: */ williamr@4: IMPORT_C TVPbkContactStoreUriPtr(); williamr@4: williamr@4: public: // interface williamr@4: /** williamr@4: * Returns a descriptor that holds the whole Uri. williamr@4: * williamr@4: * @return A descriptor that holds the whole Uri. williamr@4: */ williamr@4: IMPORT_C const TDesC& UriDes() const; williamr@4: williamr@4: /** williamr@4: * Compares this URI's component to aUri's component. williamr@4: * williamr@4: * @param aUri The URI whose component is compared. williamr@4: * @param aComponent Defines the component that are compared. williamr@4: * @return Zero if the URIs are the same. williamr@4: */ williamr@4: IMPORT_C TInt Compare(const TVPbkContactStoreUriPtr& aUri, williamr@4: TVPbkContactStoreUriComponent aComponent) const; williamr@4: williamr@4: /** williamr@4: * Compares this URI's component to aUriComponent. williamr@4: * williamr@4: * @param aUriComponent A descriptor that contains the component data. williamr@4: * @param aComponent Defines the component of this URI that is compared williamr@4: * to aUriComponent. williamr@4: * @return Zero if components matched. williamr@4: */ williamr@4: IMPORT_C TInt Compare(const TDesC& aUriComponent, williamr@4: TVPbkContactStoreUriComponent aComponent) const; williamr@4: williamr@4: /** williamr@4: * Returns a pointer to the aComponent part of URI. williamr@4: * williamr@4: * @param aComponent Defines the component that is returned. williamr@4: * @return a pointer to the aComponent part of URI. williamr@4: */ williamr@4: IMPORT_C const TPtrC Component( williamr@4: TVPbkContactStoreUriComponent aComponent) const; williamr@4: williamr@4: /** williamr@4: * Sets this URI pointer to point to the same URI as aUri. williamr@4: * williamr@4: * @param aUri The URI that will be pointed to. williamr@4: */ williamr@4: IMPORT_C void Set(const TVPbkContactStoreUriPtr& aUri); williamr@4: williamr@4: /** williamr@4: * Returns the length of the URI. williamr@4: * williamr@4: * @return The length of the URI. williamr@4: */ williamr@4: IMPORT_C TInt Length() const; williamr@4: williamr@4: public: // from MVPbkStreamable williamr@4: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; williamr@4: IMPORT_C TInt ExternalizedSize() const; williamr@4: williamr@4: private: // implementation williamr@4: TInt Compare(const TDesC& aLhsUri, const TDesC& aRhsUri) const; williamr@4: williamr@4: private: // Data williamr@4: /// Own: Pointer to the URI williamr@4: TPtrC iUriBufferPointer; williamr@4: ///Own: Extension reserve williamr@4: TAny* iSpare; williamr@4: }; williamr@4: williamr@4: #endif // TVPBKCONTACTSTOREURIPTR_H williamr@4: williamr@4: //End of file