contentstorage/srvinc/casrvmmchistory.h
author hgs
Tue, 23 Mar 2010 23:42:03 +0200
changeset 87 9d806967057c
parent 85 7feec50967db
child 80 397d00875918
permissions -rw-r--r--
201007

/*
 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:  ?Description
 *
 */

#ifndef CASRVMMCHISTORY_H
#define CASRVMMCHISTORY_H

#include <e32base.h>

// FORWARD DECLARATION

class RFs;

/**
 * MMC History.
 * Stores a fixed number of MMC ids. When new ID-s are inserted,
 * old ones are purged. Supports file persistence.
 */
NONSHARABLE_CLASS( CCaSrvMmcHistory ): public CBase
    {

public:
    // construction

    /**
     * Destructor.
     */
    virtual ~CCaSrvMmcHistory()
        {
        iMmcList.Close();
        }

    /**
     * Constructor.
     */
    CCaSrvMmcHistory()
        {
        }

public:
    // new methods

    /**
     * Load from file. Safe to call if file does not exist.
     * @param aFs File Server Session.
     * @param aFname File name.
     */
    IMPORT_C void LoadL( RFs& aFs, const TDesC& aFname );

    /**
     * Save to file. Existing file overwritten.
     * @param aFs File Server Session.
     * @param aFname File name.
     */
    IMPORT_C void SaveL( RFs& aFs, const TDesC& aFname );

    /**
     * Insert new ID to first position.
     * If ID is already in the history, now it is moved to first
     * position (->latest).
     * If history is full, oldest ID may be dropped from history.
     * @param aMmc MMC ID.
     */
    IMPORT_C void InsertL( TUint aMmc );

    /**
     * Find ID in history.
     * @param aMmc MMC ID.
     * @return History index, or KErrNotFound.
     */
    IMPORT_C TInt Find( TUint aMmc ); // Find mmc in history.

private:
    // data

    RArray<TUint> iMmcList; ///< ID history list. Own.

    };

#endif // CASRVMMCHISTORY_H