1 /*============================================================================
2 KWSys - Kitware System Library
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #ifndef @KWSYS_NAMESPACE@_Registry_hxx
13 #define @KWSYS_NAMESPACE@_Registry_hxx
15 #include <@KWSYS_NAMESPACE@/Configure.h>
17 #include <@KWSYS_NAMESPACE@/stl/string>
19 namespace @KWSYS_NAMESPACE@
25 * \brief Portable registry class
27 * This class abstracts the storing of data that can be restored
28 * when the program executes again. On Win32 platform it is
29 * implemented using the registry and on unix as a file in
30 * the user's home directory.
32 class @KWSYS_NAMESPACE@_EXPORT Registry
44 Registry(RegistryType registryType = WIN32_REGISTRY);
46 Registry(RegistryType registryType = FILE_REGISTRY);
51 //! Read a value from the registry.
52 bool ReadValue(const char *subkey, const char *key, const char **value);
54 //! Delete a key from the registry.
55 bool DeleteKey(const char *subkey, const char *key);
57 //! Delete a value from a given key.
58 bool DeleteValue(const char *subkey, const char *key);
60 //! Set value in a given key.
61 bool SetValue(const char *subkey, const char *key,
64 //! Open the registry at toplevel/subkey.
65 bool Open(const char *toplevel, const char *subkey,
68 //! Close the registry.
71 //! Read from local or global scope. On Windows this mean from local machine
72 // or local user. On unix this will read from $HOME/.Projectrc or
74 void GlobalScopeOn() { this->SetGlobalScope(1); }
75 void GlobalScopeOff() { this->SetGlobalScope(0); }
76 void SetGlobalScope(bool b);
77 bool GetGlobalScope();
79 // Set or get the toplevel registry key.
80 void SetTopLevel(const char* tl);
81 const char* GetTopLevel();
83 // Return true if registry opened
84 bool GetOpened() { return m_Opened; }
86 // Should the registry be locked?
87 bool GetLocked() { return m_Locked; }
94 // Return true if the character is space.
98 RegistryHelper* Helper;
103 }; // End Class: Registry
105 } // namespace @KWSYS_NAMESPACE@