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