epoc32/include/test/datadictionary.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 #ifndef __DATA_DICTIONARY_H__
       
    22 #define __DATA_DICTIONARY_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32hashtab.h>
       
    26 
       
    27 /**
       
    28  * Data dictionary maximum name size
       
    29  */
       
    30 const TInt									KMaxDataDictionaryNameSize = 256;
       
    31 
       
    32 /**
       
    33  * Defines a modifiable buffer descriptor to contain the name of an entry in the dictionary
       
    34  */
       
    35 typedef TBuf<KMaxDataDictionaryNameSize>	TDataDictionaryName;
       
    36 
       
    37 class CDataWrapper;
       
    38 
       
    39 class CDataDictionary : public CBase
       
    40 /**
       
    41  * @internalAll
       
    42  * @test
       
    43  *
       
    44  * @see		CBase
       
    45  *
       
    46  * This dictionary associates a name with a data wrapper object.
       
    47  * Maintenance of the dictionary is perfomed by the methods AddDataL and DeleteDataL.
       
    48  */
       
    49 	{
       
    50 private:
       
    51 	/**
       
    52 	 * @internalAll
       
    53 	 * @test
       
    54 	 *
       
    55 	 * Data dictionary storage area
       
    56 	 */
       
    57 	typedef RHashMap<TDataDictionaryName, CDataWrapper*>		RDataStore;
       
    58 	typedef THashMapIter<TDataDictionaryName, CDataWrapper*>	TDataIter;
       
    59 
       
    60 public:
       
    61 	CDataDictionary();
       
    62 	virtual ~CDataDictionary();
       
    63 
       
    64 	void			AddDataL(const TDataDictionaryName& aName, CDataWrapper* aData);
       
    65 	void			DeleteDataL(const TDataDictionaryName& aName);
       
    66 	void			SetCurrentDataL(const TDataDictionaryName& aName);
       
    67 	CDataWrapper*	GetDataL(const TDataDictionaryName& aName);
       
    68 	TAny*			CurrentObject();
       
    69 	TAny*			GetObjectL(const TDesC& aName);
       
    70 	void			SetObjectL(const TDataDictionaryName& aName, TAny* aObject);
       
    71 	void			Empty();
       
    72 	TInt			Outstanding(const TDesC& aName, TBool& aMoreToDo);
       
    73 
       
    74 private:
       
    75 	static TUint32	Hash(const TDataDictionaryName& aName);
       
    76 	static TBool	Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2);
       
    77 
       
    78 private:
       
    79 	RDataStore		iStore;
       
    80 	CDataWrapper*	iCurrentObject;
       
    81 	};
       
    82 
       
    83 #endif // __DATA_DICTIONARY_H__