aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/settingsdriverregistry.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/unstable/settingsdriverregistry.cpp
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
-rw-r--r--src/unstable/settingsdriverregistry.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/src/unstable/settingsdriverregistry.cpp b/src/unstable/settingsdriverregistry.cpp
index 89eda7b..983f48e 100644
--- a/src/unstable/settingsdriverregistry.cpp
+++ b/src/unstable/settingsdriverregistry.cpp
@@ -12,80 +12,80 @@ Bu::SettingsDriverRegistry::SettingsDriverRegistry()
12 12
13Bu::SettingsDriverRegistry::~SettingsDriverRegistry() 13Bu::SettingsDriverRegistry::~SettingsDriverRegistry()
14{ 14{
15 RegCloseKey( *phKey ); 15 RegCloseKey( *phKey );
16} 16}
17 17
18void Bu::SettingsDriverRegistry::init( const Bu::UtfString &sCompany, const Bu::UtfString &sProduct ) 18void Bu::SettingsDriverRegistry::init( const Bu::UtfString &sCompany, const Bu::UtfString &sProduct )
19{ 19{
20 Bu::UtfString us("Software\\"); 20 Bu::UtfString us("Software\\");
21 us += sCompany; 21 us += sCompany;
22 us += "\\"; 22 us += "\\";
23 us += sProduct; 23 us += sProduct;
24 rphKey = new HKEY; 24 rphKey = new HKEY;
25 RegCreateKeyExA( HKEY_CURRENT_USER, us.get().getStr(), 0, NULL, 0, KEY_ALL_ACCESS, NULL, phKey, NULL ); 25 RegCreateKeyExA( HKEY_CURRENT_USER, us.get().getStr(), 0, NULL, 0, KEY_ALL_ACCESS, NULL, phKey, NULL );
26} 26}
27 27
28void Bu::SettingsDriverRegistry::set( const Bu::UtfString &sKey, const Bu::UtfString &sValue ) 28void Bu::SettingsDriverRegistry::set( const Bu::UtfString &sKey, const Bu::UtfString &sValue )
29{ 29{
30 Bu::StringList lPath = sKey.get().split('/'); 30 Bu::StringList lPath = sKey.get().split('/');
31 Bu::StringList::iterator i = lPath.begin(); 31 Bu::StringList::iterator i = lPath.begin();
32 Bu::StringList::iterator in; 32 Bu::StringList::iterator in;
33 33
34 Bu::String sPKey; 34 Bu::String sPKey;
35 for(; i;) 35 for(; i;)
36 { 36 {
37 in = i; 37 in = i;
38 in++; 38 in++;
39 if( in ) 39 if( in )
40 { 40 {
41 if( !sPKey.isEmpty() ) 41 if( !sPKey.isEmpty() )
42 sPKey += "\\"; 42 sPKey += "\\";
43 sPKey += *i; 43 sPKey += *i;
44 } 44 }
45 i = in; 45 i = in;
46 } 46 }
47 47
48 HKEY key; 48 HKEY key;
49 RegCreateKeyExA( *phKey, sPKey.getStr(), 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL ); 49 RegCreateKeyExA( *phKey, sPKey.getStr(), 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL );
50 Bu::String sTmp = sValue.get(); 50 Bu::String sTmp = sValue.get();
51 RegSetValueExA( key, lPath.last().getStr(), 0, REG_SZ, (BYTE *)sTmp.getStr(), sTmp.getSize()+1 ); 51 RegSetValueExA( key, lPath.last().getStr(), 0, REG_SZ, (BYTE *)sTmp.getStr(), sTmp.getSize()+1 );
52 RegCloseKey( key ); 52 RegCloseKey( key );
53} 53}
54 54
55Bu::UtfString Bu::SettingsDriverRegistry::get( const Bu::UtfString &sKey, const Bu::UtfString &sValue ) 55Bu::UtfString Bu::SettingsDriverRegistry::get( const Bu::UtfString &sKey, const Bu::UtfString &sValue )
56{ 56{
57 Bu::StringList lPath = sKey.get().split('/'); 57 Bu::StringList lPath = sKey.get().split('/');
58 Bu::StringList::iterator i = lPath.begin(); 58 Bu::StringList::iterator i = lPath.begin();
59 Bu::StringList::iterator in; 59 Bu::StringList::iterator in;
60 60
61 Bu::String sPKey; 61 Bu::String sPKey;
62 for(; i;) 62 for(; i;)
63 { 63 {
64 in = i; 64 in = i;
65 in++; 65 in++;
66 if( in ) 66 if( in )
67 { 67 {
68 if( !sPKey.isEmpty() ) 68 if( !sPKey.isEmpty() )
69 sPKey += "\\"; 69 sPKey += "\\";
70 sPKey += *i; 70 sPKey += *i;
71 } 71 }
72 i = in; 72 i = in;
73 } 73 }
74 74
75 HKEY key; 75 HKEY key;
76 if( RegOpenKeyExA( *phKey, sPKey.getStr(), 0, KEY_ALL_ACCESS, &key ) 76 if( RegOpenKeyExA( *phKey, sPKey.getStr(), 0, KEY_ALL_ACCESS, &key )
77 != ERROR_SUCCESS ) 77 != ERROR_SUCCESS )
78 return sValue; 78 return sValue;
79 char buf[4096]; 79 char buf[4096];
80 DWORD iRet = 4096; 80 DWORD iRet = 4096;
81 if( RegQueryValueEx( key, lPath.last().getStr(), NULL, NULL, (BYTE *)buf, &iRet ) != ERROR_SUCCESS ) 81 if( RegQueryValueEx( key, lPath.last().getStr(), NULL, NULL, (BYTE *)buf, &iRet ) != ERROR_SUCCESS )
82 { 82 {
83 RegCloseKey( key ); 83 RegCloseKey( key );
84 return sValue; 84 return sValue;
85 } 85 }
86 RegCloseKey( key ); 86 RegCloseKey( key );
87 87
88 return Bu::UtfString( Bu::String( buf, iRet ) ); 88 return Bu::UtfString( Bu::String( buf, iRet ) );
89} 89}
90 90
91#endif 91#endif