epoc32/include/test/datadictionary.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h) This is the epoc32/include tree with the "platform" subtrees removed, and all but a selected few mbg and rsg files removed.

/*
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* 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
* which accompanies this distribution, and is available
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
* @file
* This contains DataDictionary.h
*
*/


#ifndef __DATA_DICTIONARY_H__
#define __DATA_DICTIONARY_H__

#include <e32base.h>
#include <e32hashtab.h>

/**
 * Data dictionary maximum name size
 */
const TInt									KMaxDataDictionaryNameSize = 256;

/**
 * Defines a modifiable buffer descriptor to contain the name of an entry in the dictionary
 */
typedef TBuf<KMaxDataDictionaryNameSize>	TDataDictionaryName;

class CDataWrapper;

class CDataDictionary : public CBase
/**
 * @internalAll
 * @test
 *
 * @see		CBase
 *
 * This dictionary associates a name with a data wrapper object.
 * Maintenance of the dictionary is perfomed by the methods AddDataL and DeleteDataL.
 */
	{
private:
	/**
	 * @internalAll
	 * @test
	 *
	 * Data dictionary storage area
	 */
	typedef RHashMap<TDataDictionaryName, CDataWrapper*>		RDataStore;
	typedef THashMapIter<TDataDictionaryName, CDataWrapper*>	TDataIter;

public:
	CDataDictionary();
	virtual ~CDataDictionary();

	void			AddDataL(const TDataDictionaryName& aName, CDataWrapper* aData);
	void			DeleteDataL(const TDataDictionaryName& aName);
	void			SetCurrentDataL(const TDataDictionaryName& aName);
	CDataWrapper*	GetDataL(const TDataDictionaryName& aName);
	TAny*			CurrentObject();
	TAny*			GetObjectL(const TDesC& aName);
	void			SetObjectL(const TDataDictionaryName& aName, TAny* aObject);
	void			Empty();
	TInt			Outstanding(const TDesC& aName, TBool& aMoreToDo);

private:
	static TUint32	Hash(const TDataDictionaryName& aName);
	static TBool	Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2);

private:
	RDataStore		iStore;
	CDataWrapper*	iCurrentObject;
	};

#endif // __DATA_DICTIONARY_H__