menucontentsrv/srvinc/menusrvmmchistory.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2009 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 *
       
    16 */
       
    17 
       
    18 #ifndef __MENUSRVMMCHISTORY_H__
       
    19 #define __MENUSRVMMCHISTORY_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 // FORWARD DECLARATION
       
    24 
       
    25 class CMenuEng;
       
    26 class RFs;
       
    27 
       
    28 /**
       
    29 * MMC History.
       
    30 * Stores a fixed number of MMC ids. When new ID-s are inserted,
       
    31 * old ones are purged. Supports file persistence.
       
    32 */
       
    33 NONSHARABLE_CLASS( CMenuSrvMmcHistory ): public CBase
       
    34     {
       
    35 
       
    36 public:     // construction
       
    37 
       
    38     /**
       
    39     * Destructor.
       
    40     */
       
    41     virtual ~CMenuSrvMmcHistory() { iMmcList.Close(); }
       
    42 
       
    43     /**
       
    44     * Constructor.
       
    45     */
       
    46     CMenuSrvMmcHistory() {}
       
    47 
       
    48 public:     // new methods
       
    49 
       
    50     /**
       
    51     * Load from file. Safe to call if file does not exist.
       
    52     * @param aFs File Server Session.
       
    53     * @param aFname File name.
       
    54     */
       
    55     void LoadL( RFs& aFs, const TDesC& aFname );
       
    56 
       
    57     /**
       
    58     * Save to file. Existing file overwritten.
       
    59     * @param aFs File Server Session.
       
    60     * @param aFname File name.
       
    61     */
       
    62     void SaveL( RFs& aFs, const TDesC& aFname );
       
    63 
       
    64     /**
       
    65     * Insert new ID to first position.
       
    66     * If ID is already in the history, now it is moved to first
       
    67     * position (->latest).
       
    68     * If history is full, oldest ID may be dropped from history.
       
    69     * @param aMmc MMC ID.
       
    70     */
       
    71     void InsertL( TUint aMmc );
       
    72 
       
    73     /**
       
    74     * Find ID in history.
       
    75     * @param aMmc MMC ID.
       
    76     * @return History index, or KErrNotFound.
       
    77     */
       
    78     TInt Find( TUint aMmc ); // Find mmc in history.
       
    79 
       
    80 private:    // data
       
    81 
       
    82     RArray<TUint> iMmcList; ///< ID history list. Own.
       
    83 
       
    84     };
       
    85 
       
    86 #endif // __MENUSRVMMCHISTORY_H__