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

FXRegistry.h

00001 /******************************************************************************** 00002 * * 00003 * R e g i s t r y C l a s s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2004 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.26 2004/02/08 17:17:34 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 * or suite of applications. 00037 */ 00038 class FXAPI FXRegistry : public FXSettings { 00039 FXDECLARE(FXRegistry) 00040 protected: 00041 FXString applicationkey; // Application key 00042 FXString vendorkey; // Vendor key 00043 FXbool ascii; // ASCII file-based registry 00044 protected: 00045 FXbool readFromDir(const FXString& dirname,FXbool mark); 00046 #ifdef WIN32 00047 FXbool readFromRegistry(void* hRootKey,FXbool mark); 00048 FXbool writeToRegistry(void* hRootKey); 00049 FXbool readFromRegistryGroup(void* org,const char* groupname,FXbool mark=FALSE); 00050 FXbool writeToRegistryGroup(void* org,const char* groupname); 00051 #endif 00052 private: 00053 FXRegistry(const FXRegistry&); 00054 FXRegistry &operator=(const FXRegistry&); 00055 public: 00056 00057 /** 00058 * Construct registry object; akey and vkey must be string constants. 00059 * Regular applications SHOULD set a vendor key! 00060 */ 00061 FXRegistry(const FXString& akey=FXString::null,const FXString& vkey=FXString::null); 00062 00063 /// Read registry 00064 FXbool read(); 00065 00066 /// Write registry 00067 FXbool write(); 00068 00069 /// Return application key 00070 FXString getAppKey() const { return applicationkey; } 00071 00072 /// Return vendor key 00073 FXString getVendorKey() const { return vendorkey; } 00074 00075 /** 00076 * Set ASCII mode; under MS-Windows, this will switch the system to a 00077 * file-based registry system, instead of using the System Registry API. 00078 */ 00079 void setAsciiMode(FXbool asciiMode){ ascii=asciiMode; } 00080 00081 /// Get ASCII mode 00082 FXbool getAsciiMode() const { return ascii; } 00083 }; 00084 00085 } 00086 00087 #endif

Copyright © 1997-2004 Jeroen van der Zijp