epoc32/include/app/MVPbkContactStore.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) 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:  Virtual Phonebook contact store interface.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
#ifndef MVPBKCONTACTSTORE_H
williamr@4
    20
#define MVPBKCONTACTSTORE_H
williamr@4
    21
williamr@4
    22
// INCLUDES
williamr@4
    23
#include <e32def.h>
williamr@4
    24
#include <mvpbkobjecthierarchy.h>
williamr@4
    25
#include <mvpbkcontactoperationfactory.h>
williamr@4
    26
williamr@4
    27
// FORWARD DECLARATIONS
williamr@4
    28
class CVPbkContactViewDefinition;
williamr@4
    29
class MVPbkContactStoreObserver;
williamr@4
    30
class MVPbkContactStoreProperties;
williamr@4
    31
class MVPbkStoreContact;
williamr@4
    32
class MVPbkContactGroup;
williamr@4
    33
class MVPbkContactView;
williamr@4
    34
class MVPbkContactLink;
williamr@4
    35
class MVPbkFieldTypeList;
williamr@4
    36
class MVPbkContactViewObserver;
williamr@4
    37
class MVPbkContactStoreInfo;
williamr@4
    38
class MVPbkSingleContactLinkOperationObserver;
williamr@4
    39
class MVPbkContactOperationBase;
williamr@4
    40
williamr@4
    41
//Use this UID to access contact store extension 2. Used as a parameter to ContactStoreExtension() method.
williamr@4
    42
const TUid KMVPbkContactStoreExtension2Uid = { 2 };
williamr@4
    43
williamr@4
    44
// CLASS DECLARATIONS
williamr@4
    45
williamr@4
    46
/**
williamr@4
    47
 * A contact store interface that is implemented by all contact stores.
williamr@4
    48
 *
williamr@4
    49
 * Using this interface clients can access a single contact store. Usually
williamr@4
    50
 * it's more suitable to use CVPbkContactManager and MVPbkContactStoreList
williamr@4
    51
 * for accessing stores because multiple stores can be handled at a same
williamr@4
    52
 * time.
williamr@4
    53
 *
williamr@4
    54
 * The store is opened asynchronously and it must not be used before
williamr@4
    55
 * notification has arrived. If client opens the store it must also
williamr@4
    56
 * close the store after usage.
williamr@4
    57
 *
williamr@4
    58
 * The interface can be used for retriveing properties and information
williamr@4
    59
 * of the store and also for creating a view, a new contact or a
williamr@4
    60
 * new group (if supported).
williamr@4
    61
 *
williamr@4
    62
 */
williamr@4
    63
class MVPbkContactStore :
williamr@4
    64
        public MVPbkObjectHierarchy,
williamr@4
    65
        public MVPbkContactOperationFactory
williamr@4
    66
    {
williamr@4
    67
    public:  // Destructor
williamr@4
    68
williamr@4
    69
        /**
williamr@4
    70
         * Clients don't destroy the stores directly because they don't
williamr@4
    71
         * own them. The ownerships are managed by CVPbkContactManager.
williamr@4
    72
         */
williamr@4
    73
        virtual ~MVPbkContactStore() { }
williamr@4
    74
williamr@4
    75
    public:  // New functions
williamr@4
    76
        /**
williamr@4
    77
         * Returns fixed properties of this contact store.
williamr@4
    78
         *
williamr@4
    79
         * Fixed properties do not change when the store is open.
williamr@4
    80
         * The store must be opened before retrieving the properties.
williamr@4
    81
         *
williamr@4
    82
         * @return Store properties.
williamr@4
    83
         */
williamr@4
    84
        virtual const MVPbkContactStoreProperties& StoreProperties() const = 0;
williamr@4
    85
williamr@4
    86
        /**
williamr@4
    87
         * Opens this contact store asynchronously.
williamr@4
    88
         *
williamr@4
    89
         * Calls back the observer when the opening completes. Notice
williamr@4
    90
         * that the same store instance can be opened by several observers.
williamr@4
    91
         *
williamr@4
    92
         * @param aObserver An observer for the store.
williamr@4
    93
         * @exception KErrInUse If another asynchronous operation
williamr@4
    94
         *            is already in progress.
williamr@4
    95
         */
williamr@4
    96
        virtual void OpenL(
williamr@4
    97
                MVPbkContactStoreObserver& aObserver ) = 0;
williamr@4
    98
williamr@4
    99
        /**
williamr@4
   100
         * Replaces an existing store and opens it asynchronously.
williamr@4
   101
         *
williamr@4
   102
         * E.g. If the database is a file then this replaces the database if
williamr@4
   103
         * it's not locked by other clients. If the store
williamr@4
   104
         * implementation can not implment replacing then this behaves
williamr@4
   105
         * like OpenL.
williamr@4
   106
         *
williamr@4
   107
         * If the store does not exist, it is created if possible.
williamr@4
   108
         * Calls back the observer when the opening completes.
williamr@4
   109
         *
williamr@4
   110
         * @param aObserver An observer for the store.
williamr@4
   111
         */
williamr@4
   112
        virtual void ReplaceL(
williamr@4
   113
                MVPbkContactStoreObserver& aObserver ) = 0;
williamr@4
   114
williamr@4
   115
        /**
williamr@4
   116
         * Closes this contact store from a single observer.
williamr@4
   117
         *
williamr@4
   118
         * This can be always called safely even if OpenL or ReplaceL
williamr@4
   119
         * hasn't been called.
williamr@4
   120
         * If the client calls OpenL it must also call this after usage,
williamr@4
   121
         * The observer will no longer receive events from this store.
williamr@4
   122
         * If there are other observers for the store then the store
williamr@4
   123
         * will remain open for them.
williamr@4
   124
         *
williamr@4
   125
         * @param aObserver An observer that was given in OpenL or ReplaceL.
williamr@4
   126
         */
williamr@4
   127
        virtual void Close(
williamr@4
   128
                MVPbkContactStoreObserver& aObserver ) = 0;
williamr@4
   129
williamr@4
   130
        /**
williamr@4
   131
         * Creates a new contact associated to this store.
williamr@4
   132
         *
williamr@4
   133
         * The contact can be edited and then it must be committed by
williamr@4
   134
         * calling MVPbkStoreContact::CommitL for actually saving
williamr@4
   135
         * it to the store.
williamr@4
   136
         *
williamr@4
   137
         * @return A new contact associated to this store. Caller takes
williamr@4
   138
         *         ownership of the returned contact.
williamr@4
   139
         * @see MVPbkStoreContact
williamr@4
   140
         * @see MVPbkStoreContact::CommitL
williamr@4
   141
         */
williamr@4
   142
        virtual MVPbkStoreContact* CreateNewContactLC() = 0;
williamr@4
   143
williamr@4
   144
        /**
williamr@4
   145
         * Creates a new contact group associated to this store.
williamr@4
   146
         *
williamr@4
   147
         * MVPbkContactStoreProperties::SupportsContactGroups must be
williamr@4
   148
         * true if this is used.
williamr@4
   149
         * The contact group might be saved to the store immeadiately
williamr@4
   150
         * depending on the store implementation.
williamr@4
   151
         * It is left open for editing. Use CommitL to commit
williamr@4
   152
         * the creation of the group and its content.
williamr@4
   153
         *
williamr@4
   154
         * @return A new contact group associated to this store. Caller takes
williamr@4
   155
         *         the ownership of the returned contact group.
williamr@4
   156
         * @exception KErrNotSupported if the store doesn't support groups.
williamr@4
   157
         *              Client should check store properties before
williamr@4
   158
         *              calling this.
williamr@4
   159
         * @see MVPbkContactStoreProperties
williamr@4
   160
         * @see MVPbkContactGroup
williamr@4
   161
         * @see MVPbkStoreContact
williamr@4
   162
         * @see MVPbkStoreContact::CommitL
williamr@4
   163
         */
williamr@4
   164
        virtual MVPbkContactGroup* CreateNewContactGroupLC() = 0;
williamr@4
   165
williamr@4
   166
        /**
williamr@4
   167
         * Creates a new contact view from the store asynchronously.
williamr@4
   168
         *
williamr@4
   169
         * Client gets the ownership of the view. The content of
williamr@4
   170
         * the view depends on the CVPbkContactViewDefinition. The
williamr@4
   171
         * client must wait the observer event before using the view.
williamr@4
   172
         *
williamr@4
   173
         * @param aViewDefinition Defines the properties of the new view.
williamr@4
   174
         * @param aObserver An observer for the view events.
williamr@4
   175
         * @param aSortOrder Field types that are used in the view contact
williamr@4
   176
         *                   in the same order as in this list. Notice that
williamr@4
   177
         *                   stores may not support all possible field types
williamr@4
   178
         *                   in a view contact. The implementation
williamr@4
   179
         *                   of the view contact must have as many fields as
williamr@4
   180
         *                   the sort order. If the store doesn't support the
williamr@4
   181
         *                   field type in a view contact then it sets empty
williamr@4
   182
         *                   data to the field.
williamr@4
   183
         * @return  A new contact view object. Caller takes ownership of the
williamr@4
   184
         *          returned contact.
williamr@4
   185
         * @see MVPbkContactView
williamr@4
   186
         * @see CVPbkContactViewDefinition
williamr@4
   187
         */
williamr@4
   188
        virtual MVPbkContactView* CreateViewLC(
williamr@4
   189
                const CVPbkContactViewDefinition& aViewDefinition,
williamr@4
   190
                MVPbkContactViewObserver& aObserver,
williamr@4
   191
                const MVPbkFieldTypeList& aSortOrder ) = 0;
williamr@4
   192
williamr@4
   193
        /**
williamr@4
   194
         * Returns contact groups contained in this store.
williamr@4
   195
         *
williamr@4
   196
         * MVPbkContactStoreProperties::SupportsContactGroups must be
williamr@4
   197
         * true if this is used. Implementation should return an empty
williamr@4
   198
         * link array and not NULL.
williamr@4
   199
         *
williamr@4
   200
         * @return Contact group identifiers contained in this store.
williamr@4
   201
         */
williamr@4
   202
        virtual MVPbkContactLinkArray* ContactGroupsLC() const = 0;
williamr@4
   203
williamr@4
   204
        /**
williamr@4
   205
         * Returns a contact store information. Information can vary
williamr@4
   206
         * runtime.
williamr@4
   207
         *
williamr@4
   208
         * @return Contact store information.
williamr@4
   209
         */
williamr@4
   210
        virtual const MVPbkContactStoreInfo& StoreInfo() const = 0;
williamr@4
   211
williamr@4
   212
        /**
williamr@4
   213
         * This is part of Virtual Phonebook internal framefork and not
williamr@4
   214
         * usable for clients. Clients use CVPbkContactManager
williamr@4
   215
         * for creating links from a stream.
williamr@4
   216
         *
williamr@4
   217
         * Creates a link array from a stream. Stream contains the internals
williamr@4
   218
         * of the contact link. Internals are the contact store implementation
williamr@4
   219
         * specific part of the package format.
williamr@4
   220
         *
williamr@4
   221
         * NOTE: this must work wheter the OpenL has been called or not. This
williamr@4
   222
         *       means that a link can not contain any data that would need
williamr@4
   223
         *       an open store before internalizing.
williamr@4
   224
         *
williamr@4
   225
         * @param aStream A stream containing the link internals.
williamr@4
   226
         * @return A new contact link.
williamr@4
   227
         * @internal
williamr@4
   228
         */
williamr@4
   229
        virtual MVPbkContactLink* CreateLinkFromInternalsLC(
williamr@4
   230
                RReadStream& aStream ) const = 0;
williamr@4
   231
williamr@4
   232
        /**
williamr@4
   233
         * Returns an extension point for this interface or NULL.
williamr@4
   234
         *
williamr@4
   235
         * @param aExtensionUid no extensions defined currently.
williamr@4
   236
         * @return an extension point for this interface or NULL.
williamr@4
   237
         */
williamr@4
   238
        virtual TAny* ContactStoreExtension(TUid /*aExtensionUid*/)
williamr@4
   239
                { return NULL; }
williamr@4
   240
williamr@4
   241
    public: // From MVPbkObjectHierarchy
williamr@4
   242
williamr@4
   243
        MVPbkObjectHierarchy& ParentObject() const
williamr@4
   244
            {
williamr@4
   245
            return const_cast<MVPbkObjectHierarchy&>
williamr@4
   246
                ( static_cast<const MVPbkObjectHierarchy&>( *this ) );
williamr@4
   247
            }
williamr@4
   248
        MVPbkContactStore& ContactStore() const
williamr@4
   249
            {
williamr@4
   250
            return const_cast<MVPbkContactStore&>( *this );
williamr@4
   251
            }
williamr@4
   252
williamr@4
   253
    };
williamr@4
   254
williamr@4
   255
#endif // MVPBKCONTACTSTORE_H
williamr@4
   256
williamr@4
   257
// End of File