/* libzzinet
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2004-2006, Toni Thomsson <toni@tonjac.org>
*/
#ifndef zz_thread_safe_config_h
#define zz_thread_safe_config_h
#include <zz_string.h>
#include <zz_win_threadmutex.h>
#include <map>
/** Configuration block */
typedef map<CzzString, CzzString > CzzBlock;
/**
Thread safe configuration reader
@author Toni Thomsson, toni@tonjac.org
*/
class ZZ_API CzzThreadSafeConfig
{
public:
/**
Configuration
@param name Path to configuration file
*/
CzzThreadSafeConfig( const CzzString& name );
virtual ~CzzThreadSafeConfig();
/**
Get entry
@param block Name of block in configuration file
@param entry Name of entry in configuration file
*/
CzzString getEntry( const CzzString& block, const CzzString& entry );
/**
Set entry
@param block Name of block in configuration file
@param entry Name of entry in configuration file
@param value Setting
*/
void setEntry( const CzzString& block, const CzzString& entry, const CzzString& value );
protected:
private:
CzzString m_File;
map<CzzString, CzzBlock* > m_BlockList;
static CzzWinThreadMutex m_Mutex;
};
#endif // zz_thread_safe_config_h