epoc32/include/app/cpbkcontactiter.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  
williamr@2
    15
*    Phonebook contact iterator
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef __CPbkContactIter_H__
williamr@2
    21
#define __CPbkContactIter_H__
williamr@2
    22
williamr@2
    23
//  INCLUDES
williamr@2
    24
#include    <e32base.h>     // CBase
williamr@2
    25
#include    <cntdb.h>       // TContactIter
williamr@2
    26
williamr@2
    27
// FORWARD DECLARATIONS
williamr@2
    28
class CPbkContactEngine;
williamr@2
    29
class CPbkContactItem;
williamr@2
    30
class CContactItem;
williamr@2
    31
williamr@2
    32
// CLASS DECLARATION
williamr@2
    33
williamr@2
    34
/**
williamr@2
    35
 * Phonebook contact iterator. Only iterates through recognised Phonebook
williamr@2
    36
 * contact cards, not groups or templates. NextL jumps over any other contacts. 
williamr@2
    37
 */
williamr@2
    38
class CPbkContactIter : public CBase
williamr@2
    39
	{
williamr@2
    40
    public:  // Constructors and destructor
williamr@2
    41
        /**
williamr@2
    42
         * Creates a new instace of this class.
williamr@2
    43
         *
williamr@2
    44
         * @param aEngine   Phonebook engine whose contacts to iterate.
williamr@2
    45
         * @param aUseMinimalRead   Use ReadMinimalContactL instead of 
williamr@2
    46
         *                          ReadContactL to read the contacts.
williamr@2
    47
         * @return Contact iterator instance.
williamr@2
    48
         */
williamr@2
    49
        IMPORT_C static CPbkContactIter* NewL
williamr@2
    50
            (CPbkContactEngine& aEngine, TBool aUseMinimalRead=EFalse);
williamr@2
    51
williamr@2
    52
        /**
williamr@2
    53
         * Same as NewL but leaves the created object on the cleanup stack.
williamr@2
    54
         * Creates a new instace of this class.
williamr@2
    55
         *
williamr@2
    56
         * @param aEngine   Phonebook engine whose contacts to iterate.
williamr@2
    57
         * @param aUseMinimalRead   Use ReadMinimalContactL instead of 
williamr@2
    58
         *                          ReadContactL to read the contacts.
williamr@2
    59
         * @return Contact iterator instance.
williamr@2
    60
         */
williamr@2
    61
        IMPORT_C static CPbkContactIter* NewLC
williamr@2
    62
            (CPbkContactEngine& aEngine, TBool aUseMinimalRead=EFalse);
williamr@2
    63
williamr@2
    64
	    /**
williamr@2
    65
         * Destructor.
williamr@2
    66
         */
williamr@2
    67
        ~CPbkContactIter();
williamr@2
    68
williamr@2
    69
    public:  // interface
williamr@2
    70
        /**
williamr@2
    71
         * Intializes the iterator to the first Phonebook contact.
williamr@2
    72
         * @return Id of the first Phonebook contact, KNullContactId if none found.
williamr@2
    73
         */
williamr@2
    74
	    IMPORT_C TContactItemId FirstL();
williamr@2
    75
williamr@2
    76
        /**
williamr@2
    77
         * Advances the iterator to the next Phonebook contact.
williamr@2
    78
         * @return Id of the next Phonebook contact, KNullContactId if none found.
williamr@2
    79
         */
williamr@2
    80
	    IMPORT_C TContactItemId NextL();
williamr@2
    81
williamr@2
    82
        /**
williamr@2
    83
         * Resets the iterator to null state.
williamr@2
    84
         */
williamr@2
    85
	    IMPORT_C void Reset();
williamr@2
    86
williamr@2
    87
        /**
williamr@2
    88
         * Returns the current Phonebook contact, NULL if none.
williamr@2
    89
         * @return  The contact item the iterator is currently pointing at.
williamr@2
    90
         */
williamr@2
    91
        IMPORT_C CPbkContactItem* CurrentL() const;
williamr@2
    92
williamr@2
    93
        /**
williamr@2
    94
         * Returns the current Phonebook contact, NULL if none.
williamr@2
    95
         * Caller is responsible for deleting the contact, thus ownership of the
williamr@2
    96
         * contact item is passed to the client.
williamr@2
    97
         * @return  The contact item the iterator is currently pointing at.
williamr@2
    98
         */
williamr@2
    99
        IMPORT_C CPbkContactItem* GetCurrentL() const;
williamr@2
   100
williamr@2
   101
        __DECLARE_TEST;
williamr@2
   102
williamr@2
   103
    private:  // Implementation
williamr@2
   104
	    CPbkContactIter(CPbkContactEngine& aEngine, TBool aUseMinimalRead);
williamr@2
   105
        CContactItem* ReadPhonebookContactL(TContactItemId aId);
williamr@2
   106
williamr@2
   107
    private:  // Data
williamr@2
   108
		/// Ref: phonebook engine
williamr@2
   109
        CPbkContactEngine& iEngine;
williamr@2
   110
		/// Own: contact iterator
williamr@2
   111
        TContactIter iCmIter;
williamr@2
   112
		/// Own: current item
williamr@2
   113
        mutable CContactItem* iCurrentItem;
williamr@2
   114
		/// Own: current pbk-item
williamr@2
   115
        mutable CPbkContactItem* iCurrentPbkItem;
williamr@2
   116
		/// Own: minimal read flag
williamr@2
   117
        const TBool iUseMinimalRead;
williamr@2
   118
	};
williamr@2
   119
williamr@2
   120
williamr@2
   121
#endif // __CPbkContactIter_H__
williamr@2
   122
williamr@2
   123
// End of File