Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * R e g i s t r y C l a s s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2005 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXRegistry.h,v 1.29 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXREGISTRY_H 00025 #define FXREGISTRY_H 00026 00027 #ifndef FXSETTINGS_H 00028 #include "FXSettings.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /** 00035 * The registry maintains a database of persistent settings for an application. 00036 * The settings database is organized in two groups of three layers each. The 00037 * system-wide settings group contains settings information pertaining to all 00038 * users on a system. The per-user settings group contains settings affecting 00039 * that user only. 00040 * Each settings group contains a desktop layer, which comprises the settings 00041 * which affect all FOX programs, a vendor layer which holds settings that 00042 * affect all applications from that vendor (e.g. a application-suite), and 00043 * an application layer which holds settings only for a single application. 00044 * The vendor-key and application-key determine which files these layers come 00045 * from, while the "Desktop" key is used for all FOX applications. 00046 * Settings in the system-wide group are overwritten by the per-user group, 00047 * and settings from the "Desktop" layer are overwritten by the vendor-layer; 00048 * vendor-layer settings are overwritten by the application-layer settings. 00049 * Only the per-user, per-application settings ever gets written; the layers 00050 * in the system-group only get written during installation and configuration 00051 * of the application. 00052 * The registry is read when FXApp::init() is called, and written back to the 00053 * system when FXApp::exit() is called. 00054 */ 00055 class FXAPI FXRegistry : public FXSettings { 00056 FXDECLARE(FXRegistry) 00057 protected: 00058 FXString applicationkey; // Application key 00059 FXString vendorkey; // Vendor key 00060 FXbool ascii; // ASCII file-based registry 00061 protected: 00062 FXbool readFromDir(const FXString& dirname,FXbool mark); 00063 #ifdef WIN32 00064 FXbool readFromRegistry(void* hRootKey,FXbool mark); 00065 FXbool writeToRegistry(void* hRootKey); 00066 FXbool readFromRegistryGroup(void* org,const char* groupname,FXbool mark=FALSE); 00067 FXbool writeToRegistryGroup(void* org,const char* groupname); 00068 #endif 00069 private: 00070 FXRegistry(const FXRegistry&); 00071 FXRegistry &operator=(const FXRegistry&); 00072 public: 00073 00074 /** 00075 * Construct registry object; akey and vkey must be string constants. 00076 * Regular applications SHOULD set a vendor key! 00077 */ 00078 FXRegistry(const FXString& akey=FXString::null,const FXString& vkey=FXString::null); 00079 00080 /// Read registry 00081 FXbool read(); 00082 00083 /// Write registry 00084 FXbool write(); 00085 00086 /// Return application key 00087 const FXString& getAppKey() const { return applicationkey; } 00088 00089 /// Return vendor key 00090 const FXString& getVendorKey() const { return vendorkey; } 00091 00092 /** 00093 * Set ASCII mode; under MS-Windows, this will switch the system to a 00094 * file-based registry system, instead of using the System Registry API. 00095 */ 00096 void setAsciiMode(FXbool asciiMode){ ascii=asciiMode; } 00097 00098 /// Get ASCII mode 00099 FXbool getAsciiMode() const { return ascii; } 00100 }; 00101 00102 } 00103 00104 #endif
Copyright © 1997-2005 Jeroen van der Zijp |