|
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 * Creates an instance of CCaSrvMmcHistory. |
|
40 * @return a pointer to CCaSrvMmcHistory insctance. |
|
41 */ |
|
42 IMPORT_C static CCaSrvMmcHistory* NewL(); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CCaSrvMmcHistory(); |
|
48 |
|
49 public: |
|
50 // new methods |
|
51 |
|
52 /** |
|
53 * Load from file. Safe to call if file does not exist. |
|
54 * @param aFs File Server Session. |
|
55 * @param aFname File name. |
|
56 */ |
|
57 IMPORT_C void LoadL( RFs& aFs, const TDesC& aFname ); |
|
58 |
|
59 /** |
|
60 * Save to file. Existing file overwritten. |
|
61 * @param aFs File Server Session. |
|
62 * @param aFname File name. |
|
63 */ |
|
64 IMPORT_C void SaveL( RFs& aFs, const TDesC& aFname ); |
|
65 |
|
66 /** |
|
67 * Insert new ID to first position. |
|
68 * If ID is already in the history, now it is moved to first |
|
69 * position (->latest). |
|
70 * If history is full, oldest ID may be dropped from history. |
|
71 * @param aMmc MMC ID. |
|
72 */ |
|
73 IMPORT_C void InsertL( TUint aMmc ); |
|
74 |
|
75 /** |
|
76 * Find ID in history. |
|
77 * @param aMmc MMC ID. |
|
78 * @return History index, or KErrNotFound. |
|
79 */ |
|
80 IMPORT_C TInt Find( TUint aMmc ); // Find mmc in history. |
|
81 |
|
82 private: |
|
83 /** |
|
84 * Constructor. |
|
85 */ |
|
86 CCaSrvMmcHistory(); |
|
87 |
|
88 /** |
|
89 * Second phase symbian constructor. |
|
90 */ |
|
91 void ConstructL(); |
|
92 |
|
93 private: |
|
94 // data |
|
95 |
|
96 RArray<TUint> iMmcList; ///< ID history list. Own. |
|
97 |
|
98 }; |
|
99 |
|
100 #endif // CASRVMMCHISTORY_H |