phonebookui/Phonebook/inc/TPbkContactViewIterator.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *      Safe CContactViewBase iterator.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __TPbkContactViewIterator_H__
       
    21 #define __TPbkContactViewIterator_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <cntdef.h>
       
    25 
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CContactViewBase;
       
    29 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34  * @internal Only Phonebook internal use supported!
       
    35  *
       
    36  * Safe CContactViewBase iterator.
       
    37  */
       
    38 class TPbkContactViewIterator 
       
    39     {
       
    40     public: // Interface
       
    41         /**
       
    42          * Constructor.
       
    43          * @param aContactView  the contact view to iterate.
       
    44          */
       
    45         inline TPbkContactViewIterator(const CContactViewBase& aContactView);
       
    46 
       
    47         /**
       
    48          * Returns the current index of iteration.
       
    49 		 * @return current iteration index
       
    50          */
       
    51         inline TInt Index() const;
       
    52 
       
    53         /**
       
    54          * Forwards this iterator to the next contact in contact view.
       
    55          * @return  next contact item's id in contact view. KNullContactId if
       
    56          *          at the end of iteration.
       
    57          */
       
    58         IMPORT_C TContactItemId NextL();
       
    59                     
       
    60     private:  // Data
       
    61 		/// Ref: contact view
       
    62         const CContactViewBase& iContactView;
       
    63 		/// Own: index number
       
    64         TInt iIndex;
       
    65     };
       
    66 
       
    67 
       
    68 // INLINE FUNCTIONS
       
    69 inline TPbkContactViewIterator::TPbkContactViewIterator
       
    70         (const CContactViewBase& aContactView) :
       
    71     iContactView(aContactView), iIndex(-1) // initialize to errornous value
       
    72     {
       
    73     }
       
    74 
       
    75 inline TInt TPbkContactViewIterator::Index() const
       
    76     {
       
    77     return iIndex;
       
    78     }
       
    79 
       
    80 
       
    81 #endif // __TPbkContactViewIterator_H__
       
    82 
       
    83 // End of File