extras/calcsoft/inc/CalcHistory.h
branchRCL_3
changeset 21 10c6e6d6e4d9
parent 0 3ee3dfdd8d69
equal deleted inserted replaced
20:41b775cdc0c8 21:10c6e6d6e4d9
       
     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:  Define CCalcHistory class. This class is handled historical 
       
    15 *                line of Calculator. 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef     CALCHISTORY_H
       
    21 #define     CALCHISTORY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include   <e32base.h>
       
    25 
       
    26 //  CONSTANTS  
       
    27 const TInt KCalcMaxHistoryLines(100);
       
    28 
       
    29 //  FORWARD DECLARATIONS
       
    30 class TCalcEditLine;
       
    31 
       
    32 //  CLASS DEFINITIONS 
       
    33 
       
    34 /**
       
    35 CCalcHistory handles historical line of the calculator. 
       
    36 */
       
    37 class   CCalcHistory :
       
    38         public CBase
       
    39     {
       
    40     public:  // Constructors and destructor
       
    41         /**
       
    42         * C++ default constructor.
       
    43         */
       
    44         CCalcHistory();
       
    45         
       
    46         /**
       
    47         * Destructor.
       
    48         */
       
    49         virtual ~CCalcHistory();
       
    50         
       
    51         
       
    52     public:     // New functions
       
    53         /**
       
    54         * Return (aIndex + 1)th latest history line.
       
    55         * @param aIndex  
       
    56         * @return (aIndex + 1)th latest history line.
       
    57         */
       
    58         const TCalcEditLine& operator[](TInt aIndex);  
       
    59         
       
    60         /**
       
    61         * Return count of historical lines. 
       
    62         * @return Count of historical lines
       
    63         */
       
    64         TInt Count() const;
       
    65         
       
    66         /**
       
    67         * Add newest history line
       
    68         * @param aLine : added line  
       
    69         */
       
    70         void Add(const TCalcEditLine aLine); 
       
    71 
       
    72         /**
       
    73         * Clear calculation history.
       
    74         */
       
    75         void ClearHistory();
       
    76 
       
    77         /**
       
    78         * Notify changing decimal separator.
       
    79         * @param aOld : Old decimal separator
       
    80         * @param aNew : New decimal separator  
       
    81         */
       
    82         void NotifyChangeDecimal(TChar aOld, TChar aNew);
       
    83         
       
    84     private:    // New functions
       
    85             
       
    86     private:    // Data
       
    87         //
       
    88         //  historical data
       
    89         //  Newest data index is iNewestIndex.
       
    90         //  
       
    91         //  <Case that iCount is smaller than KCalcMaxHistoryLines>
       
    92         //    As data is older, index is smaller. The oldest dara index is zero.
       
    93         //
       
    94         //  <Case that iCount is KCalcMaxHistoryLines>
       
    95         //    As data is older, index is smaller. But previous data index
       
    96         //   to index zero is KCalcMaxHistoryLines-1. previous index to
       
    97         //   KCalcMaxHistoryLines-1 is KCalcMaxHistoryLines-2. ..... 
       
    98         //   Therefore the oldest data index is iNewestIndex+1.
       
    99         //
       
   100         TCalcEditLine iHistory[KCalcMaxHistoryLines]; // Calculation history
       
   101         TInt      iCount;  // Valid historical lines
       
   102         TInt      iNewestIndex;  // Index of newest history
       
   103     };
       
   104 
       
   105 #endif      //  CALCHISTORY_H
       
   106             
       
   107 // End of File