epoc32/include/app/cpbkcontactiter.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/app/cpbkcontactiter.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/app/cpbkcontactiter.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,123 @@
     1.4 -cpbkcontactiter.h
     1.5 +/*
     1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* 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
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:  
    1.19 +*    Phonebook contact iterator
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +#ifndef __CPbkContactIter_H__
    1.25 +#define __CPbkContactIter_H__
    1.26 +
    1.27 +//  INCLUDES
    1.28 +#include    <e32base.h>     // CBase
    1.29 +#include    <cntdb.h>       // TContactIter
    1.30 +
    1.31 +// FORWARD DECLARATIONS
    1.32 +class CPbkContactEngine;
    1.33 +class CPbkContactItem;
    1.34 +class CContactItem;
    1.35 +
    1.36 +// CLASS DECLARATION
    1.37 +
    1.38 +/**
    1.39 + * Phonebook contact iterator. Only iterates through recognised Phonebook
    1.40 + * contact cards, not groups or templates. NextL jumps over any other contacts. 
    1.41 + */
    1.42 +class CPbkContactIter : public CBase
    1.43 +	{
    1.44 +    public:  // Constructors and destructor
    1.45 +        /**
    1.46 +         * Creates a new instace of this class.
    1.47 +         *
    1.48 +         * @param aEngine   Phonebook engine whose contacts to iterate.
    1.49 +         * @param aUseMinimalRead   Use ReadMinimalContactL instead of 
    1.50 +         *                          ReadContactL to read the contacts.
    1.51 +         * @return Contact iterator instance.
    1.52 +         */
    1.53 +        IMPORT_C static CPbkContactIter* NewL
    1.54 +            (CPbkContactEngine& aEngine, TBool aUseMinimalRead=EFalse);
    1.55 +
    1.56 +        /**
    1.57 +         * Same as NewL but leaves the created object on the cleanup stack.
    1.58 +         * Creates a new instace of this class.
    1.59 +         *
    1.60 +         * @param aEngine   Phonebook engine whose contacts to iterate.
    1.61 +         * @param aUseMinimalRead   Use ReadMinimalContactL instead of 
    1.62 +         *                          ReadContactL to read the contacts.
    1.63 +         * @return Contact iterator instance.
    1.64 +         */
    1.65 +        IMPORT_C static CPbkContactIter* NewLC
    1.66 +            (CPbkContactEngine& aEngine, TBool aUseMinimalRead=EFalse);
    1.67 +
    1.68 +	    /**
    1.69 +         * Destructor.
    1.70 +         */
    1.71 +        ~CPbkContactIter();
    1.72 +
    1.73 +    public:  // interface
    1.74 +        /**
    1.75 +         * Intializes the iterator to the first Phonebook contact.
    1.76 +         * @return Id of the first Phonebook contact, KNullContactId if none found.
    1.77 +         */
    1.78 +	    IMPORT_C TContactItemId FirstL();
    1.79 +
    1.80 +        /**
    1.81 +         * Advances the iterator to the next Phonebook contact.
    1.82 +         * @return Id of the next Phonebook contact, KNullContactId if none found.
    1.83 +         */
    1.84 +	    IMPORT_C TContactItemId NextL();
    1.85 +
    1.86 +        /**
    1.87 +         * Resets the iterator to null state.
    1.88 +         */
    1.89 +	    IMPORT_C void Reset();
    1.90 +
    1.91 +        /**
    1.92 +         * Returns the current Phonebook contact, NULL if none.
    1.93 +         * @return  The contact item the iterator is currently pointing at.
    1.94 +         */
    1.95 +        IMPORT_C CPbkContactItem* CurrentL() const;
    1.96 +
    1.97 +        /**
    1.98 +         * Returns the current Phonebook contact, NULL if none.
    1.99 +         * Caller is responsible for deleting the contact, thus ownership of the
   1.100 +         * contact item is passed to the client.
   1.101 +         * @return  The contact item the iterator is currently pointing at.
   1.102 +         */
   1.103 +        IMPORT_C CPbkContactItem* GetCurrentL() const;
   1.104 +
   1.105 +        __DECLARE_TEST;
   1.106 +
   1.107 +    private:  // Implementation
   1.108 +	    CPbkContactIter(CPbkContactEngine& aEngine, TBool aUseMinimalRead);
   1.109 +        CContactItem* ReadPhonebookContactL(TContactItemId aId);
   1.110 +
   1.111 +    private:  // Data
   1.112 +		/// Ref: phonebook engine
   1.113 +        CPbkContactEngine& iEngine;
   1.114 +		/// Own: contact iterator
   1.115 +        TContactIter iCmIter;
   1.116 +		/// Own: current item
   1.117 +        mutable CContactItem* iCurrentItem;
   1.118 +		/// Own: current pbk-item
   1.119 +        mutable CPbkContactItem* iCurrentPbkItem;
   1.120 +		/// Own: minimal read flag
   1.121 +        const TBool iUseMinimalRead;
   1.122 +	};
   1.123 +
   1.124 +
   1.125 +#endif // __CPbkContactIter_H__
   1.126 +
   1.127 +// End of File