|
1 /* |
|
2 * Copyright (c) 2005-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 * @file |
|
16 * This contains DataDictionary.h |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __DATA_DICTIONARY_H__ |
|
23 #define __DATA_DICTIONARY_H__ |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <e32hashtab.h> |
|
27 |
|
28 /** |
|
29 * Data dictionary maximum name size |
|
30 */ |
|
31 const TInt KMaxDataDictionaryNameSize = 256; |
|
32 |
|
33 /** |
|
34 * Defines a modifiable buffer descriptor to contain the name of an entry in the dictionary |
|
35 */ |
|
36 typedef TBuf<KMaxDataDictionaryNameSize> TDataDictionaryName; |
|
37 |
|
38 class CDataWrapper; |
|
39 |
|
40 class CDataDictionary : public CBase |
|
41 /** |
|
42 * @internalAll |
|
43 * @test |
|
44 * |
|
45 * @see CBase |
|
46 * |
|
47 * This dictionary associates a name with a data wrapper object. |
|
48 * Maintenance of the dictionary is perfomed by the methods AddDataL and DeleteDataL. |
|
49 */ |
|
50 { |
|
51 private: |
|
52 /** |
|
53 * @internalAll |
|
54 * @test |
|
55 * |
|
56 * Data dictionary storage area |
|
57 */ |
|
58 typedef RHashMap<TDataDictionaryName, CDataWrapper*> RDataStore; |
|
59 typedef THashMapIter<TDataDictionaryName, CDataWrapper*> TDataIter; |
|
60 |
|
61 public: |
|
62 CDataDictionary(); |
|
63 virtual ~CDataDictionary(); |
|
64 |
|
65 void AddDataL(const TDataDictionaryName& aName, CDataWrapper* aData); |
|
66 void DeleteDataL(const TDataDictionaryName& aName); |
|
67 void SetCurrentDataL(const TDataDictionaryName& aName); |
|
68 CDataWrapper* GetDataL(const TDataDictionaryName& aName); |
|
69 TAny* CurrentObject(); |
|
70 TAny* GetObjectL(const TDesC& aName); |
|
71 void SetObjectL(const TDataDictionaryName& aName, TAny* aObject); |
|
72 void Empty(); |
|
73 TInt Outstanding(const TDesC& aName, TBool& aMoreToDo); |
|
74 |
|
75 private: |
|
76 static TUint32 Hash(const TDataDictionaryName& aName); |
|
77 static TBool Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2); |
|
78 |
|
79 private: |
|
80 RDataStore iStore; |
|
81 CDataWrapper* iCurrentObject; |
|
82 }; |
|
83 |
|
84 #endif // __DATA_DICTIONARY_H__ |