aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/settings.cpp
blob: 792aff9f6fd46f7fde4261cf52a23aeae2d13bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "bu/settings.h"

#include "bu/settingsdrivertaf.h"
#include "bu/settingsdriverregistry.h"

Bu::Settings::Settings( const Bu::UtfString &sCompany,
		const Bu::UtfString &sProduct, Bu::Settings::Driver eDriver ) :
	sCompany( sCompany ),
	sProduct( sProduct ),
	pDriver( NULL )
{
	switch( eDriver )
	{
		case DriverNative:
#if defined( WIN32 )
			pDriver = new Bu::SettingsDriverRegistry();
#else
			pDriver = new Bu::SettingsDriverTaf();
#endif
			break;

		case DriverTaf:
			pDriver = new Bu::SettingsDriverTaf();
			break;

		case DriverIni:
			throw Bu::ExceptionBase("Not supported");
			break;
	}

	pDriver->init( sCompany, sProduct );
}

Bu::Settings::~Settings()
{
	delete pDriver;
}

void Bu::Settings::set( const Bu::UtfString &sKey, const Bu::UtfString &sValue )
{
	pDriver->set( sKey, sValue );
}

Bu::UtfString Bu::Settings::get( const Bu::UtfString &sKey,
		const Bu::UtfString &sValue )
{
	return pDriver->get( sKey, sValue );
}