phonebookui/Phonebook/inc/TPbkMatchPriorityLevel.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 *      Phonebook field matching priority level.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __TPbkMatchPriorityLevel_H__
       
    21 #define __TPbkMatchPriorityLevel_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32def.h>
       
    25 
       
    26 // CLASS DECLARATION
       
    27 
       
    28 /**
       
    29  * Phonebook field matching priority level.
       
    30  */
       
    31 class TPbkMatchPriorityLevel
       
    32     {
       
    33     private: // Constructors
       
    34         /// Only class CPbkFieldsInfo can create instances of this class
       
    35         friend class CPbkFieldsInfo;
       
    36 
       
    37         /**
       
    38          * Constructor.
       
    39          * @param aMaxNumberOfLevels maximum number of matching levels
       
    40          */
       
    41         TPbkMatchPriorityLevel(TInt aMaxNumberOfLevels);
       
    42 
       
    43         // Default copy constructor, assignment and destructor are ok for
       
    44         // this class.
       
    45 
       
    46     public:  // New functions
       
    47         /**
       
    48          * Advances current priority to the next level.
       
    49          */
       
    50         void Next();
       
    51 
       
    52         /**
       
    53          * Returns ETrue if all priority levels have been enumerated with 
       
    54          * Next().
       
    55 		 * @return ETrue if all levels have been enumerated
       
    56          */
       
    57         TBool End() const;
       
    58 
       
    59         /**
       
    60          * Returns the current matching priority level.
       
    61 		 * @return current level
       
    62          */
       
    63         TInt CurrentLevel() const;
       
    64 
       
    65     private:  // Data
       
    66 		/// Own: current level
       
    67         TInt iCurrentLevel;
       
    68 		/// Own: maximum level
       
    69         TInt iMaxLevel;
       
    70     };
       
    71 
       
    72 
       
    73 // INLINE FUNCTIONS
       
    74 inline TPbkMatchPriorityLevel::TPbkMatchPriorityLevel(TInt aMaxNumberOfLevels) :
       
    75     iCurrentLevel(0), iMaxLevel(aMaxNumberOfLevels)
       
    76     {
       
    77     }
       
    78 
       
    79 inline TBool TPbkMatchPriorityLevel::End() const
       
    80     {
       
    81     return (iCurrentLevel > iMaxLevel);
       
    82     }
       
    83 
       
    84 inline void TPbkMatchPriorityLevel::Next()
       
    85     {
       
    86     ++iCurrentLevel;
       
    87     }
       
    88 
       
    89 inline TInt TPbkMatchPriorityLevel::CurrentLevel() const
       
    90     {
       
    91     return iCurrentLevel;
       
    92     }
       
    93 
       
    94 
       
    95 #endif // __TPbkMatchPriorityLevel_H__
       
    96 
       
    97 // End of File