debian/tmp/usr/include/KWWidgets/vtkKWRegistryHelper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWRegistryHelper.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 // .NAME vtkKWRegistryHelper - A registry class
00015 // .SECTION Description
00016 // This class abstracts the storing of data that can be restored
00017 // when the program executes again. On Win32 platform it is 
00018 // implemented using the registry and on unix as a file in
00019 // the user's home directory.
00020 
00021 #ifndef __vtkKWRegistryHelper_h
00022 #define __vtkKWRegistryHelper_h
00023 
00024 #include "vtkObject.h"
00025 #include "vtkKWWidgets.h" // Needed for export symbols directives
00026 
00027 class KWWidgets_EXPORT vtkKWRegistryHelper : public vtkObject
00028 {
00029 public:
00030   // Description:
00031   // Standard New and type methods
00032   static vtkKWRegistryHelper* New();
00033   vtkTypeRevisionMacro(vtkKWRegistryHelper, vtkObject);
00034   void PrintSelf(ostream& os, vtkIndent indent);
00035 
00036   // Description:
00037   // Read a value from the registry.
00038   int ReadValue(const char *subkey, 
00039                 const char *key, char *value);
00040 
00041   // Description:
00042   // Delete a key from the registry.
00043   int DeleteKey(const char *subkey, const char *key);
00044 
00045   // Description:
00046   // Delete a value from a given key.
00047   int DeleteValue(const char *subkey, const char *key);
00048 
00049   // Description:
00050   // Set value in a given key.
00051   int SetValue(const char *subkey, const char *key, 
00052                const char *value);
00053 
00054   // Description:
00055   // Open the registry at toplevel/subkey.
00056   int Open(const char *toplevel, const char *subkey, 
00057            int readonly);
00058   
00059   // Description:
00060   // Close the registry. 
00061   int Close();
00062 
00063   // Description:
00064   // Read from local or global scope. On Windows this mean from local machine
00065   // or local user. On unix this will read from $HOME/.Projectrc or 
00066   // /etc/Project
00067   vtkSetClampMacro(GlobalScope, int, 0, 1);
00068   vtkBooleanMacro(GlobalScope, int);
00069   vtkGetMacro(GlobalScope, int);
00070   
00071   // Description:
00072   // Set or get the toplevel registry key.
00073   vtkSetStringMacro(TopLevel);
00074   vtkGetStringMacro(TopLevel);
00075 
00076   // Description:
00077   // Return true if registry opened
00078   vtkGetMacro(Opened, int);
00079 
00080   // Description:
00081   // Should the registry be locked?
00082   vtkGetMacro(Locked, int);
00083 
00084   //BTX
00085   enum {
00086     ReadOnly,
00087     ReadWrite
00088   };
00089 
00090   enum
00091   {
00092     RegistryKeyValueSizeMax = 8192,
00093     RegistryKeyNameSizeMax = 100
00094   };
00095   //ETX
00096 
00097 protected:
00098   vtkKWRegistryHelper();
00099   virtual ~vtkKWRegistryHelper();
00100 
00101   // Description:
00102   // Should the registry be locked?
00103   vtkSetClampMacro(Locked, int, 0, 1);
00104   vtkBooleanMacro(Locked, int);
00105 
00106   
00107   // Description:
00108   // Read a value from the registry.
00109   virtual int ReadValueInternal(const char *key, char *value) = 0;
00110   
00111   // Description:
00112   // Delete a key from the registry.
00113   virtual int DeleteKeyInternal(const char *key) = 0;
00114 
00115   // Description:
00116   // Delete a value from a given key.
00117   virtual int DeleteValueInternal(const char *key) = 0;
00118 
00119   // Description:
00120   // Set value in a given key.
00121   virtual int SetValueInternal(const char *key, 
00122                                const char *value) = 0;
00123 
00124   // Description:
00125   // Open the registry at toplevel/subkey.
00126   virtual int OpenInternal(const char *toplevel, const char *subkey, 
00127                            int readonly) = 0;
00128   
00129   // Description:
00130   // Close the registry. 
00131   virtual int CloseInternal() = 0;
00132 
00133   // Description:
00134   // Return true if the character is space.
00135   int IsSpace(char c);
00136 
00137   // Description:
00138   // Strip trailing and ending spaces.
00139   char *Strip(char *str);
00140 
00141   int Opened;
00142   int Changed;
00143   int Empty;
00144    
00145 private:
00146   char *TopLevel;  
00147   int Locked;
00148   int GlobalScope;
00149 
00150   vtkKWRegistryHelper(const vtkKWRegistryHelper&); // Not implemented
00151   void operator=(const vtkKWRegistryHelper&); // Not implemented
00152 };
00153 
00154 #endif
00155 
00156 

Generated by  doxygen 1.6.2