epoc32/include/app/TVPbkContactStoreUriPtr.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     1 /*
       
     2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  A class for using contact store URIs
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TVPBKCONTACTSTOREURIPTR_H
       
    20 #define TVPBKCONTACTSTOREURIPTR_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <mvpbkstreamable.h>
       
    26 
       
    27 
       
    28 // CLASS DECLARATIONS
       
    29 
       
    30 /**
       
    31  * A class for using contact store URIs (Uniform Resource Identifier).
       
    32  *
       
    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.
       
    36  *
       
    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
       
    42  *
       
    43  * @lib VPbkEng.lib
       
    44  */
       
    45 class TVPbkContactStoreUriPtr : public MVPbkStreamable
       
    46     {
       
    47     public: // Types
       
    48         /**
       
    49          * URI component types.
       
    50          */
       
    51         enum TVPbkContactStoreUriComponent
       
    52             {
       
    53             /// the whole URI
       
    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
       
    61             };
       
    62 
       
    63     public:  // constructor and destructor
       
    64         /**
       
    65          * Constructs a URI pointer to aStoreUri.
       
    66          *
       
    67          * @param aStoreUri A reference to the contact store URI.
       
    68          */
       
    69         IMPORT_C TVPbkContactStoreUriPtr(const TDesC& aStoreUri);
       
    70 
       
    71         /**
       
    72          * Constructor.
       
    73          */
       
    74         IMPORT_C TVPbkContactStoreUriPtr();
       
    75 
       
    76     public: // interface
       
    77         /**
       
    78          * Returns a descriptor that holds the whole Uri.
       
    79          *
       
    80          * @return A descriptor that holds the whole Uri.
       
    81          */
       
    82         IMPORT_C const TDesC& UriDes() const;
       
    83 
       
    84         /**
       
    85          * Compares this URI's component to aUri's component.
       
    86          *
       
    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.
       
    90          */
       
    91         IMPORT_C TInt Compare(const TVPbkContactStoreUriPtr& aUri, 
       
    92                 TVPbkContactStoreUriComponent aComponent) const;
       
    93 
       
    94         /**
       
    95          * Compares this URI's component to aUriComponent.
       
    96          *
       
    97          * @param aUriComponent A descriptor that contains the component data.
       
    98          * @param aComponent Defines the component of this URI that is compared
       
    99          *                   to aUriComponent.
       
   100          * @return Zero if components matched.
       
   101          */
       
   102         IMPORT_C TInt Compare(const TDesC& aUriComponent, 
       
   103                 TVPbkContactStoreUriComponent aComponent) const;
       
   104 
       
   105         /**
       
   106          * Returns a pointer to the aComponent part of URI.
       
   107          *
       
   108          * @param aComponent Defines the component that is returned.
       
   109          * @return a pointer to the aComponent part of URI.
       
   110          */
       
   111         IMPORT_C const TPtrC Component(
       
   112                 TVPbkContactStoreUriComponent aComponent) const;
       
   113 
       
   114         /**
       
   115          * Sets this URI pointer to point to the same URI as aUri.
       
   116          *
       
   117          * @param aUri The URI that will be pointed to.
       
   118          */
       
   119         IMPORT_C void Set(const TVPbkContactStoreUriPtr& aUri);
       
   120 
       
   121         /**
       
   122          * Returns the length of the URI.
       
   123          *
       
   124          * @return The length of the URI.
       
   125          */
       
   126         IMPORT_C TInt Length() const;
       
   127 
       
   128     public: // from MVPbkStreamable
       
   129         IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   130         IMPORT_C TInt ExternalizedSize() const;
       
   131 
       
   132     private: // implementation
       
   133         TInt Compare(const TDesC& aLhsUri, const TDesC& aRhsUri) const;
       
   134 
       
   135     private: // Data
       
   136         /// Own: Pointer to the URI 
       
   137         TPtrC iUriBufferPointer;
       
   138         ///Own: Extension reserve
       
   139         TAny* iSpare;
       
   140     };
       
   141 
       
   142 #endif  // TVPBKCONTACTSTOREURIPTR_H
       
   143 
       
   144 //End of file