00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032
00033 #pragma once
00034
00035 #ifdef WIN32
00036
00037 #include "../api_core.h"
00038 #include "databuffer.h"
00039 #include <vector>
00040
00041 class CL_RegistryKey_Impl;
00042
00044
00046 class CL_API_CORE CL_RegistryKey
00047 {
00050
00051 public:
00052 enum PredefinedKey
00053 {
00054 key_classes_root,
00055 key_current_config,
00056 key_current_user,
00057 key_local_machine,
00058 key_users
00059 };
00060
00061 enum CreateFlags
00062 {
00063 create_always = 0,
00064 create_new = 1,
00065 create_volatile = 2
00066 };
00067
00068 CL_RegistryKey();
00069
00070 CL_RegistryKey(PredefinedKey key, const CL_StringRef &subkey, unsigned int access_rights = KEY_ALL_ACCESS, unsigned int create_flags = create_always);
00071
00072 CL_RegistryKey(HKEY key);
00073
00074 ~CL_RegistryKey();
00075
00076
00080
00081 public:
00082 HKEY get_key() const;
00083
00084 std::vector<CL_String> get_subkey_names() const;
00085
00086 std::vector<CL_String> get_value_names() const;
00087
00088 int get_value_int(const CL_StringRef &name, int default_value = 0) const;
00089
00090 CL_DataBuffer get_value_binary(const CL_StringRef &name, const CL_DataBuffer &default_value = CL_DataBuffer()) const;
00091
00092 CL_String get_value_string(const CL_StringRef &name, const CL_StringRef &default_value = CL_StringRef()) const;
00093
00094 std::vector<CL_String> get_value_multi_string(const CL_StringRef &name, const std::vector<CL_String> &default_value = std::vector<CL_String>()) const;
00095
00096
00100
00101 public:
00102 CL_RegistryKey open_key(const CL_StringRef &subkey, unsigned int access_rights = KEY_ALL_ACCESS);
00103
00104 CL_RegistryKey create_key(const CL_StringRef &subkey, unsigned int access_rights = KEY_ALL_ACCESS, CreateFlags create_flags = create_always);
00105
00106 void delete_key(const CL_StringRef &subkey, bool recursive);
00107
00108 static void delete_key(PredefinedKey key, const CL_StringRef &subkey, bool recursive);
00109
00110 void set_value_int(const CL_StringRef &name, int value);
00111
00112 void set_value_binary(const CL_StringRef &name, const CL_DataBuffer &value);
00113
00114 void set_value_string(const CL_StringRef &name, const CL_StringRef &value);
00115
00116
00117
00118 void delete_value(const CL_StringRef &name);
00119
00120
00124
00125 private:
00126 CL_SharedPtr<CL_RegistryKey_Impl> impl;
00128 };
00129
00130 #endif
00131