epoc32/include/app/TVPbkContactStoreUriPtr.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/TVPbkContactStoreUriPtr.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,144 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  A class for using contact store URIs
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef TVPBKCONTACTSTOREURIPTR_H
    1.23 +#define TVPBKCONTACTSTOREURIPTR_H
    1.24 +
    1.25 +
    1.26 +// INCLUDES
    1.27 +#include <e32std.h>
    1.28 +#include <mvpbkstreamable.h>
    1.29 +
    1.30 +
    1.31 +// CLASS DECLARATIONS
    1.32 +
    1.33 +/**
    1.34 + * A class for using contact store URIs (Uniform Resource Identifier).
    1.35 + *
    1.36 + * A URI identifies a contact store. This class is a helper for
    1.37 + * accessing URI data. It can be used to separate the different parts
    1.38 + * of the URI and compare URIs.
    1.39 + *
    1.40 + * E.g. A URI of the store could be cntdb://c:contacts.cdb.
    1.41 + * This URI have three components:
    1.42 + * 1) cntdb is a scheme - EContactStoreUriStoreType
    1.43 + * 2) c is a drive of the database - EContactStoreUriStoreDrive
    1.44 + * 3) c:contacts.cdb is the location - EContactStoreUriStoreLocation
    1.45 + *
    1.46 + * @lib VPbkEng.lib
    1.47 + */
    1.48 +class TVPbkContactStoreUriPtr : public MVPbkStreamable
    1.49 +    {
    1.50 +    public: // Types
    1.51 +        /**
    1.52 +         * URI component types.
    1.53 +         */
    1.54 +        enum TVPbkContactStoreUriComponent
    1.55 +            {
    1.56 +            /// the whole URI
    1.57 +            EContactStoreUriAllComponents,
    1.58 +            /// the stores type, the URI's scheme 
    1.59 +            EContactStoreUriStoreType,
    1.60 +            /// the stores drive letter
    1.61 +            EContactStoreUriStoreDrive,
    1.62 +            /// the stores file/host location
    1.63 +            EContactStoreUriStoreLocation
    1.64 +            };
    1.65 +
    1.66 +    public:  // constructor and destructor
    1.67 +        /**
    1.68 +         * Constructs a URI pointer to aStoreUri.
    1.69 +         *
    1.70 +         * @param aStoreUri A reference to the contact store URI.
    1.71 +         */
    1.72 +        IMPORT_C TVPbkContactStoreUriPtr(const TDesC& aStoreUri);
    1.73 +
    1.74 +        /**
    1.75 +         * Constructor.
    1.76 +         */
    1.77 +        IMPORT_C TVPbkContactStoreUriPtr();
    1.78 +
    1.79 +    public: // interface
    1.80 +        /**
    1.81 +         * Returns a descriptor that holds the whole Uri.
    1.82 +         *
    1.83 +         * @return A descriptor that holds the whole Uri.
    1.84 +         */
    1.85 +        IMPORT_C const TDesC& UriDes() const;
    1.86 +
    1.87 +        /**
    1.88 +         * Compares this URI's component to aUri's component.
    1.89 +         *
    1.90 +         * @param aUri The URI whose component is compared.
    1.91 +         * @param aComponent Defines the component that are compared.
    1.92 +         * @return Zero if the URIs are the same.
    1.93 +         */
    1.94 +        IMPORT_C TInt Compare(const TVPbkContactStoreUriPtr& aUri, 
    1.95 +                TVPbkContactStoreUriComponent aComponent) const;
    1.96 +
    1.97 +        /**
    1.98 +         * Compares this URI's component to aUriComponent.
    1.99 +         *
   1.100 +         * @param aUriComponent A descriptor that contains the component data.
   1.101 +         * @param aComponent Defines the component of this URI that is compared
   1.102 +         *                   to aUriComponent.
   1.103 +         * @return Zero if components matched.
   1.104 +         */
   1.105 +        IMPORT_C TInt Compare(const TDesC& aUriComponent, 
   1.106 +                TVPbkContactStoreUriComponent aComponent) const;
   1.107 +
   1.108 +        /**
   1.109 +         * Returns a pointer to the aComponent part of URI.
   1.110 +         *
   1.111 +         * @param aComponent Defines the component that is returned.
   1.112 +         * @return a pointer to the aComponent part of URI.
   1.113 +         */
   1.114 +        IMPORT_C const TPtrC Component(
   1.115 +                TVPbkContactStoreUriComponent aComponent) const;
   1.116 +
   1.117 +        /**
   1.118 +         * Sets this URI pointer to point to the same URI as aUri.
   1.119 +         *
   1.120 +         * @param aUri The URI that will be pointed to.
   1.121 +         */
   1.122 +        IMPORT_C void Set(const TVPbkContactStoreUriPtr& aUri);
   1.123 +
   1.124 +        /**
   1.125 +         * Returns the length of the URI.
   1.126 +         *
   1.127 +         * @return The length of the URI.
   1.128 +         */
   1.129 +        IMPORT_C TInt Length() const;
   1.130 +
   1.131 +    public: // from MVPbkStreamable
   1.132 +        IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.133 +        IMPORT_C TInt ExternalizedSize() const;
   1.134 +
   1.135 +    private: // implementation
   1.136 +        TInt Compare(const TDesC& aLhsUri, const TDesC& aRhsUri) const;
   1.137 +
   1.138 +    private: // Data
   1.139 +        /// Own: Pointer to the URI 
   1.140 +        TPtrC iUriBufferPointer;
   1.141 +        ///Own: Extension reserve
   1.142 +        TAny* iSpare;
   1.143 +    };
   1.144 +
   1.145 +#endif  // TVPBKCONTACTSTOREURIPTR_H
   1.146 +
   1.147 +//End of file