predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGridItem.h
branchRCL_3
changeset 39 a6539d1e8e43
equal deleted inserted replaced
35:4ae315f230bc 39:a6539d1e8e43
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Utility class to hold a single item for Adaptive Grid.
       
    15 *               Used to provide quickly to client applications (Phonebook)
       
    16 *               The Adaptive Grid for the full list of contacts, which is
       
    17 *               the one that is displayed when the Find Box is empty.
       
    18 */
       
    19 
       
    20 #ifndef __CPS_ADAPTIVE_GRID_ITEM_H__
       
    21 #define __CPS_ADAPTIVE_GRID_ITEM_H__
       
    22 
       
    23 // SYSTEM INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <s32strm.h>
       
    26 #include <CPcsDefs.h>
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31  * Utility class to hold a single item for the Adaptive Grid.
       
    32  * This class is used to represent one character of the Adaptive Grid
       
    33  * with its reference counters.
       
    34  * 
       
    35  * @lib pcsutils.lib
       
    36  * @since S60 v3.2
       
    37  */
       
    38 class CPcsAdaptiveGridItem : public CBase
       
    39 {
       
    40 	public:
       
    41 
       
    42 		/**
       
    43 		 * Two phase construction
       
    44 		 *
       
    45 		 * @return Instance of CPcsAdaptiveGridItem
       
    46 		 */
       
    47 		static CPcsAdaptiveGridItem* NewL( const TChar& aChar );
       
    48 
       
    49 		/**
       
    50 		 * Destructor
       
    51 		 */
       
    52 		~CPcsAdaptiveGridItem( );
       
    53 
       
    54 		/**
       
    55 		 * TLinearOrder rule for comparison of data objects
       
    56          *
       
    57          * @return order
       
    58 		 */
       
    59 		static TInt CompareByCharacter( const CPcsAdaptiveGridItem& aObject1, 
       
    60 		                                const CPcsAdaptiveGridItem& aObject2 );
       
    61 
       
    62 		/**
       
    63 		 * Returns the character of the Adaptive Grid item
       
    64 		 *
       
    65 		 * @return Character input
       
    66 		 */
       
    67 		TChar Character( ) const;
       
    68 			
       
    69         /**
       
    70          * Selectors for Adaptive Grid character reference counters
       
    71          */
       
    72         enum TCounterSelector
       
    73             {
       
    74             EFirstNameLastName = 0,
       
    75             EUnnamedCompanyName,
       
    76             ECompanyName,
       
    77             ENumberCounters
       
    78             };
       
    79 
       
    80         /**
       
    81          * Return the Adaptive Grid item reference counter for a given selector
       
    82          * 
       
    83          * @param Reference counter selector
       
    84          * @return Reference counter value
       
    85          */
       
    86         TUint GetRefCounter( const TUint aSelector );
       
    87         
       
    88         /**
       
    89          * Increments the Adaptive Grid item reference counter for a given selector
       
    90          * 
       
    91          * @param Reference counter selector
       
    92          */
       
    93         void IncrementRefCounter( const TUint aSelector );
       
    94         
       
    95         /**
       
    96          * Decrements the Adaptive Grid item reference counter for a given selector
       
    97          * 
       
    98          * @param Reference counter selector
       
    99          */
       
   100         void DecrementRefCounter( const TUint aSelector );
       
   101 
       
   102         /**
       
   103          * Checks if Adaptive Grid item reference counters for all selectors are 0
       
   104          * 
       
   105          * @return ETrue if all reference counters are 0
       
   106          *         EFalse otherwise
       
   107          */
       
   108         TBool AreRefCountersZero( );
       
   109         
       
   110         /**
       
   111          * Checks if Adaptive Grid item reference counters for the requested selectors are not 0
       
   112          * 
       
   113          * @return ETrue if one at least of the reference counters is > 0
       
   114          *         EFalse otherwise
       
   115          */
       
   116         TBool IsRefCounterNonZero( const TBool aCompanyName );
       
   117         
       
   118 	private:
       
   119 
       
   120 		/**
       
   121 		 * Default Constructor
       
   122 		 */
       
   123 		CPcsAdaptiveGridItem( const TChar& aChar );
       
   124 
       
   125 		/**
       
   126 		 * Character of the Adaptive Grid
       
   127 		 */
       
   128 		TChar iCharacter;
       
   129 
       
   130 	    /**
       
   131 	     *  Reference counters for the Adaptive Grid characters
       
   132 	     */
       
   133         TFixedArray<TUint, CPcsAdaptiveGridItem::ENumberCounters> iCountersArr; 
       
   134 };
       
   135 
       
   136 #endif // __CPS_ADAPTIVE_GRID_ITEM_H__
       
   137 
       
   138 // End of file