epoc32/include/app/CVPbkContactIdConverter.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2005-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:  An ECOM interface for the virtual phonebook converter for
williamr@4
    15
*                contact IDs of the Symbian's Contacts Model and
williamr@4
    16
*                Virtual Phonebook contact links.
williamr@4
    17
*                NOTE: Must be used only with contact model stores.
williamr@4
    18
*
williamr@4
    19
*/
williamr@4
    20
williamr@4
    21
williamr@4
    22
#ifndef CVPBKCONTACTIDCONVERTER_H
williamr@4
    23
#define CVPBKCONTACTIDCONVERTER_H
williamr@4
    24
williamr@4
    25
// INCLUDE FILES
williamr@4
    26
#include <e32base.h>
williamr@4
    27
#include <vpbkpublicuid.h>
williamr@4
    28
#include <ecom/ecom.h>
williamr@4
    29
williamr@4
    30
// FORWARD DECLARATIONS
williamr@4
    31
class MVPbkContactStore;
williamr@4
    32
class MVPbkContactLink;
williamr@4
    33
class MVPbkStoreContactField;
williamr@4
    34
class CPbkContactItem;
williamr@4
    35
williamr@4
    36
/**
williamr@4
    37
 * An ECOM interface for the virtual phonebook converter for contact IDs
williamr@4
    38
 * of the Symbian's Contacts Model and Virtual Phonebook contact links.
williamr@4
    39
 *
williamr@4
    40
 * A client has a TContactItemId that needs to be converted
williamr@4
    41
 * to MVPbkContactLink or vice versa. 
williamr@4
    42
 */
williamr@4
    43
class CVPbkContactIdConverter : public CBase
williamr@4
    44
    {
williamr@4
    45
    public:
williamr@4
    46
        /**
williamr@4
    47
         * Creates a new conversion utility object for given contact store.
williamr@4
    48
         *
williamr@4
    49
         * The given contact store must be from the cntdb domain,
williamr@4
    50
         * otherwise this function leaves with KErrNotSupported.
williamr@4
    51
         *
williamr@4
    52
         * @exception KErrNotSupported if aContactStore is not from cntdb domain.
williamr@4
    53
         * @param aContactStore Contact store that is used for conversion.
williamr@4
    54
         *                      Links and IDs are converted for this store only.
williamr@4
    55
         *                      Trying to convert links or IDs from different stores
williamr@4
    56
         *                      provides unspecified results.
williamr@4
    57
         * @return A new conversion utility object.
williamr@4
    58
         */
williamr@4
    59
        static CVPbkContactIdConverter* NewL(MVPbkContactStore& aContactStore);
williamr@4
    60
        
williamr@4
    61
        /**
williamr@4
    62
         * Destructor.
williamr@4
    63
         */
williamr@4
    64
        ~CVPbkContactIdConverter();
williamr@4
    65
        
williamr@4
    66
    public: // Interface
williamr@4
    67
        /**
williamr@4
    68
         * Converts the given link to an Id in the contact store defined in
williamr@4
    69
         * NewL function.
williamr@4
    70
         * 
williamr@4
    71
         * Returned value is KNullContactId if the link
williamr@4
    72
         * is from any other store than the one given in NewL.
williamr@4
    73
         * 
williamr@4
    74
         * @param aLink A link to convert.
williamr@4
    75
         * @return A contact item id (TContactItemId) corresponding the aLink
williamr@4
    76
         *         in the contact store given as construction parameter in 
williamr@4
    77
         *         NewL.
williamr@4
    78
         */
williamr@4
    79
        virtual TInt32 LinkToIdentifier(
williamr@4
    80
                const MVPbkContactLink& aLink) const =0;
williamr@4
    81
        
williamr@4
    82
        /**
williamr@4
    83
         * Converts the given identifier (TContactItemId) to a contact link 
williamr@4
    84
         * in the contact store defined in NewL function.
williamr@4
    85
         * 
williamr@4
    86
         * Created link is left to cleanup stack and ownership is transferred
williamr@4
    87
         * to caller.
williamr@4
    88
         * 
williamr@4
    89
         * @param aIdentifier The contact id to convert.
williamr@4
    90
         * @return Contact link corresponding the aIdentifier in the contact
williamr@4
    91
         *         store given as construction parameter in NewL.
williamr@4
    92
         */
williamr@4
    93
        virtual MVPbkContactLink* IdentifierToLinkLC(
williamr@4
    94
                TInt32 aIdentifier) const =0;
williamr@4
    95
            
williamr@4
    96
        /**
williamr@4
    97
         * Returns a PbkEng field index for a Virtual Phonebook field.
williamr@4
    98
         *
williamr@4
    99
         * @param aField A Virtual Phonebook field to be converted.
williamr@4
   100
         * @return A PbkEng field index or KErrNotFound.
williamr@4
   101
         */
williamr@4
   102
        virtual TInt PbkEngFieldIndexL(
williamr@4
   103
                const MVPbkStoreContactField& aField) const =0;
williamr@4
   104
        
williamr@4
   105
        /**
williamr@4
   106
         * Converts the given link to an new CPbkContactItem.
williamr@4
   107
         * 
williamr@4
   108
         * Created contact item is left to cleanup stack and
williamr@4
   109
         * ownership is transferred to caller. Returns NULL if the
williamr@4
   110
         * link is from any other store than the one given in NewL.
williamr@4
   111
         *
williamr@4
   112
         * @param aLink A link to convert.
williamr@4
   113
         * @return A PbkEng contact item corresponding the aLink in
williamr@4
   114
         *         the contact store given as construction parameter in NewL.
williamr@4
   115
         */
williamr@4
   116
        virtual CPbkContactItem* LinkToPbkContactItemLC(
williamr@4
   117
                const MVPbkContactLink& aLink) const =0;
williamr@4
   118
        
williamr@4
   119
        /**
williamr@4
   120
         * Converts the given link to an new CPbkContactItem and locks
williamr@4
   121
         * it for modification.
williamr@4
   122
         * 
williamr@4
   123
         * Created contact item is left to cleanup stack and
williamr@4
   124
         * ownership is transferred to caller. Returns NULL if the
williamr@4
   125
         * link is from any other store than the one given in NewL.
williamr@4
   126
         *
williamr@4
   127
         * @see CPbkContactEngine::OpenContactLCX
williamr@4
   128
         * @param aLink A link to convert
williamr@4
   129
         * @return A PbkEng contact item corresponding the aLink in
williamr@4
   130
         *         the contact store given as construction parameter
williamr@4
   131
         *         in NewL.
williamr@4
   132
         */
williamr@4
   133
        virtual CPbkContactItem* LinkToOpenPbkContactItemLCX(
williamr@4
   134
                const MVPbkContactLink& aLink) const =0; 
williamr@4
   135
        
williamr@4
   136
        /**
williamr@4
   137
         * Commits the openned contact item.
williamr@4
   138
         * 
williamr@4
   139
         * @param aContactItem contact item to commit
williamr@4
   140
         */       
williamr@4
   141
        virtual void CommitOpenContactItemL(CPbkContactItem& aContactItem) =0;
williamr@4
   142
        
williamr@4
   143
        /**
williamr@4
   144
         * Returns an extension point for this interface or NULL.
williamr@4
   145
         *
williamr@4
   146
         * @param aExtensionUid no extensions defined currently.
williamr@4
   147
         * @return An extension point for this interface or NULL.
williamr@4
   148
         */
williamr@4
   149
        virtual TAny* ContactIdConverterExtension( TUid /*aExtensionUid*/ )
williamr@4
   150
                { return NULL; }
williamr@4
   151
            
williamr@4
   152
    private: // Data
williamr@4
   153
        ///Own: Destructor ID key
williamr@4
   154
        TUid iDtorIDKey;
williamr@4
   155
    };
williamr@4
   156
williamr@4
   157
    
williamr@4
   158
// INLINE FUNCTIONS
williamr@4
   159
williamr@4
   160
inline CVPbkContactIdConverter* CVPbkContactIdConverter::NewL(
williamr@4
   161
        MVPbkContactStore& aContactStore)
williamr@4
   162
    {
williamr@4
   163
    TAny* ptr = NULL;
williamr@4
   164
    ptr = REComSession::CreateImplementationL(
williamr@4
   165
            TUid::Uid(KVPbkContactIdConverterImplementationUid), 
williamr@4
   166
            _FOFF(CVPbkContactIdConverter, iDtorIDKey),
williamr@4
   167
            static_cast<TAny*>(&aContactStore));
williamr@4
   168
williamr@4
   169
    return reinterpret_cast<CVPbkContactIdConverter*>(ptr);
williamr@4
   170
    }
williamr@4
   171
    
williamr@4
   172
inline CVPbkContactIdConverter::~CVPbkContactIdConverter()
williamr@4
   173
    {
williamr@4
   174
    REComSession::DestroyedImplementation(iDtorIDKey);
williamr@4
   175
    }
williamr@4
   176
    
williamr@4
   177
#endif // CVPBKCONTACTIDCONVERTER_H
williamr@4
   178
williamr@4
   179
// End of File