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,2002 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.21 2002/01/23 18:53:57 jeroen Exp $                     *
00023 ********************************************************************************/
00024 #ifndef FXREGISTRY_H
00025 #define FXREGISTRY_H
00026 
00027 #ifndef FXSETTINGS_H
00028 #include "FXSettings.h"
00029 #endif
00030 
00031 
00032 
00033 /**
00034 * The registry maintains a database of persistent settings for an application,
00035 * or suite of applications.
00036 */
00037 class FXAPI FXRegistry : public FXSettings {
00038   FXDECLARE(FXRegistry)
00039 protected:
00040   FXString applicationkey;  // Application key
00041   FXString vendorkey;       // Vendor key
00042   FXbool   ascii;           // ASCII file-based registry
00043 protected:
00044   FXbool readFromDir(const FXString& dirname,FXbool mark);
00045 #ifdef WIN32
00046   FXbool readFromRegistry(void* hRootKey,FXbool mark);
00047   FXbool writeToRegistry(void* hRootKey);
00048   FXbool readFromRegistryGroup(void* org,const char* groupname,FXbool mark=FALSE);
00049   FXbool writeToRegistryGroup(void* org,const char* groupname);
00050 #endif
00051 private:
00052   FXRegistry(const FXRegistry&);
00053   FXRegistry &operator=(const FXRegistry&);
00054 public:
00055 
00056   /**
00057   * Construct registry object; akey and vkey must be string constants.
00058   * Regular applications SHOULD set a vendor key!
00059   */
00060   FXRegistry(const FXString& akey=FXString::null,const FXString& vkey=FXString::null);
00061 
00062   /// Read registry
00063   FXbool read();
00064 
00065   /// Write registry
00066   FXbool write();
00067 
00068   /// Return application key
00069   const FXString& getAppKey() const { return applicationkey; }
00070 
00071   /// Return vendor key
00072   const FXString& getVendorKey() const { return vendorkey; }
00073 
00074   /**
00075   * Set ASCII mode; under MS-Windows, this will switch the system to a
00076   * file-based registry system, instead of using the System Registry API.
00077   */
00078   void setAsciiMode(FXbool asciiMode){ ascii=asciiMode; }
00079 
00080   /// Get ASCII mode
00081   FXbool getAsciiMode() const { return ascii; }
00082   };
00083 
00084 
00085 #endif