registry_key.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries UICore may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 #pragma once
30 
31 #if defined(WIN32) || defined(DOXYGEN)
32 
33 #include "databuffer.h"
34 #include <vector>
35 
36 namespace uicore
37 {
42  {
43  public:
45  {
51  };
52 
54  {
58  };
59 
60  static std::shared_ptr<RegistryKey> create(PredefinedKey key, const std::string &subkey, unsigned int access_rights = KEY_ALL_ACCESS, unsigned int create_flags = create_always);
61  static std::shared_ptr<RegistryKey> create(HKEY key);
62 
63  static void delete_key(PredefinedKey key, const std::string &subkey, bool recursive);
64 
65  virtual HKEY key() const = 0;
66 
67  virtual std::shared_ptr<RegistryKey> open_key(const std::string &subkey, unsigned int access_rights = KEY_ALL_ACCESS) = 0;
68  virtual std::shared_ptr<RegistryKey> create_key(const std::string &subkey, unsigned int access_rights = KEY_ALL_ACCESS, CreateFlags create_flags = create_always) = 0;
69 
70  virtual std::vector<std::string> subkey_names() const = 0;
71  virtual std::vector<std::string> value_names() const = 0;
72 
73  virtual int value_int(const std::string &name, int default_value = 0) const = 0;
74  virtual DataBufferPtr value_binary(const std::string &name, const DataBufferPtr &default_value = DataBufferPtr()) const = 0;
75  virtual std::string value_string(const std::string &name, const std::string &default_value = std::string()) const = 0;
76  virtual std::vector<std::string> value_multi_string(const std::string &name, const std::vector<std::string> &default_value = std::vector<std::string>()) const = 0;
77 
78  virtual void set_value_int(const std::string &name, int value) = 0;
79  virtual void set_value_binary(const std::string &name, const DataBufferPtr &value) = 0;
80  virtual void set_value_string(const std::string &name, const std::string &value) = 0;
81 
82  virtual void delete_key(const std::string &subkey, bool recursive) = 0;
83  virtual void delete_value(const std::string &name) = 0;
84  };
85 
86  typedef std::shared_ptr<RegistryKey> RegistryKeyPtr;
87 }
88 
89 #endif
Definition: registry_key.h:55
virtual std::vector< std::string > value_names() const =0
CreateFlags
Definition: registry_key.h:53
virtual std::vector< std::string > subkey_names() const =0
virtual void set_value_int(const std::string &name, int value)=0
virtual std::vector< std::string > value_multi_string(const std::string &name, const std::vector< std::string > &default_value=std::vector< std::string >()) const =0
Definition: registry_key.h:49
Definition: registry_key.h:57
Registry key class.
Definition: registry_key.h:41
Definition: registry_key.h:48
virtual void set_value_string(const std::string &name, const std::string &value)=0
Definition: registry_key.h:50
std::shared_ptr< RegistryKey > RegistryKeyPtr
Definition: registry_key.h:86
virtual int value_int(const std::string &name, int default_value=0) const =0
static void delete_key(PredefinedKey key, const std::string &subkey, bool recursive)
virtual std::string value_string(const std::string &name, const std::string &default_value=std::string()) const =0
Definition: registry_key.h:47
virtual void delete_value(const std::string &name)=0
virtual std::shared_ptr< RegistryKey > open_key(const std::string &subkey, unsigned int access_rights=KEY_ALL_ACCESS)=0
virtual std::shared_ptr< RegistryKey > create_key(const std::string &subkey, unsigned int access_rights=KEY_ALL_ACCESS, CreateFlags create_flags=create_always)=0
Definition: registry_key.h:56
Definition: registry_key.h:46
virtual void set_value_binary(const std::string &name, const DataBufferPtr &value)=0
std::shared_ptr< DataBuffer > DataBufferPtr
Definition: databuffer.h:66
PredefinedKey
Definition: registry_key.h:44
static std::shared_ptr< RegistryKey > create(PredefinedKey key, const std::string &subkey, unsigned int access_rights=KEY_ALL_ACCESS, unsigned int create_flags=create_always)
virtual DataBufferPtr value_binary(const std::string &name, const DataBufferPtr &default_value=DataBufferPtr()) const =0
virtual HKEY key() const =0
Definition: Application/application.h:35