Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRegistry.h
1 /********************************************************************************
2 * *
3 * R e g i s t r y C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXREGISTRY_H
22 #define FXREGISTRY_H
23 
24 #ifndef FXSETTINGS_H
25 #include "FXSettings.h"
26 #endif
27 
28 namespace FX {
29 
30 
59 class FXAPI FXRegistry : public FXSettings {
60 protected:
61  FXString applicationkey; // Application key
62  FXString vendorkey; // Vendor key
63  FXString systemdirs; // System-wide settings directories
64  FXString userdir; // User settings directory
65  FXbool ascii; // ASCII file-based registry
66 protected:
67 #if defined(WIN32)
68  FXbool readFromRegistry(FXptr hroot,FXbool mark=false);
69  FXbool writeToRegistry(FXptr hroot);
70  FXbool readFromRegistryGroup(const FXString& group,FXptr hbase,FXbool mark=false);
71  FXbool writeToRegistryGroup(const FXString& group,FXptr hbase);
72 #endif
73 private:
74  FXRegistry(const FXRegistry&);
75  FXRegistry &operator=(const FXRegistry&);
76 public:
77 
82  FXRegistry(const FXString& akey=FXString::null,const FXString& vkey=FXString::null);
83 
88  void setAsciiMode(FXbool asciiMode){ ascii=asciiMode; }
89 
91  FXbool getAsciiMode() const { return ascii; }
92 
94  void setAppKey(const FXString& name){ applicationkey=name; }
95 
97  const FXString& getAppKey() const { return applicationkey; }
98 
100  void setVendorKey(const FXString& name){ vendorkey=name; }
101 
103  const FXString& getVendorKey() const { return vendorkey; }
104 
106  void setSystemDirectories(const FXString& dirs){ systemdirs=dirs; }
107 
109  const FXString& getSystemDirectories() const { return systemdirs; }
110 
112  void setUserDirectory(const FXString& dir){ userdir=dir; }
113 
115  const FXString& getUserDirectory() const { return userdir; }
116 
118  virtual FXbool read();
119 
121  virtual FXbool write();
122 
124  static const FXchar ext[];
125 
127  static const FXchar foxrc[];
128 
130  virtual ~FXRegistry();
131  };
132 
133 }
134 
135 #endif
const FXString & getSystemDirectories() const
Return search path for system-wide settings.
Definition: FXRegistry.h:109
void setVendorKey(const FXString &name)
Change vendor key name.
Definition: FXRegistry.h:100
void setUserDirectory(const FXString &dir)
Change directory root for per-user settings tree.
Definition: FXRegistry.h:112
FXbool getAsciiMode() const
Get ASCII mode.
Definition: FXRegistry.h:91
void setAsciiMode(FXbool asciiMode)
Set ASCII mode; under MS-Windows, this will switch the system to a file-based registry system...
Definition: FXRegistry.h:88
The Registry maintains a persistent settings database for an application.
Definition: FXRegistry.h:59
void setAppKey(const FXString &name)
Change application key name.
Definition: FXRegistry.h:94
The Settings class manages a key-value database.
Definition: FXSettings.h:34
Definition: FX4Splitter.h:28
void setSystemDirectories(const FXString &dirs)
Change search path for system-wide settings.
Definition: FXRegistry.h:106
const FXString & getAppKey() const
Return application key name.
Definition: FXRegistry.h:97
const FXString & getUserDirectory() const
Return directory root of per-user settings tree.
Definition: FXRegistry.h:115
const FXString & getVendorKey() const
Return vendor key name.
Definition: FXRegistry.h:103
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp