00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00023 #ifndef __vtkKWRegistryHelper_h
00024 #define __vtkKWRegistryHelper_h
00025
00026 #include "vtkObject.h"
00027 #include "vtkKWWidgets.h"
00028
00029 class KWWIDGETS_EXPORT vtkKWRegistryHelper : public vtkObject
00030 {
00031 public:
00033
00034 static vtkKWRegistryHelper* New();
00035 vtkTypeRevisionMacro(vtkKWRegistryHelper, vtkObject);
00036 void PrintSelf(ostream& os, vtkIndent indent);
00038
00040
00041 int ReadValue(const char *subkey,
00042 const char *key, char *value);
00044
00046 int DeleteKey(const char *subkey, const char *key);
00047
00049 int DeleteValue(const char *subkey, const char *key);
00050
00052
00053 int SetValue(const char *subkey, const char *key,
00054 const char *value);
00056
00058
00059 int Open(const char *toplevel, const char *subkey,
00060 int readonly);
00062
00064 int Close();
00065
00067
00070 vtkSetClampMacro(GlobalScope, int, 0, 1);
00071 vtkBooleanMacro(GlobalScope, int);
00072 vtkGetMacro(GlobalScope, int);
00074
00076
00077 vtkSetStringMacro(TopLevel);
00078 vtkGetStringMacro(TopLevel);
00080
00082
00083 vtkGetMacro(Opened, int);
00085
00087
00088 vtkGetMacro(Locked, int);
00090
00091
00092 enum {
00093 ReadOnly,
00094 ReadWrite
00095 };
00096
00097 enum
00098 {
00099 RegistryKeyValueSizeMax = 8192,
00100 RegistryKeyNameSizeMax = 100
00101 };
00102
00103
00104 protected:
00105 vtkKWRegistryHelper();
00106 virtual ~vtkKWRegistryHelper();
00107
00109
00110 vtkSetClampMacro(Locked, int, 0, 1);
00111 vtkBooleanMacro(Locked, int);
00113
00114
00116 virtual int ReadValueInternal(const char *key, char *value) = 0;
00117
00119 virtual int DeleteKeyInternal(const char *key) = 0;
00120
00122 virtual int DeleteValueInternal(const char *key) = 0;
00123
00125
00126 virtual int SetValueInternal(const char *key,
00127 const char *value) = 0;
00129
00131
00132 virtual int OpenInternal(const char *toplevel, const char *subkey,
00133 int readonly) = 0;
00135
00137 virtual int CloseInternal() = 0;
00138
00140 int IsSpace(char c);
00141
00143 char *Strip(char *str);
00144
00145 int Opened;
00146 int Changed;
00147 int Empty;
00148
00149 private:
00150 char *TopLevel;
00151 int Locked;
00152 int GlobalScope;
00153
00154 vtkKWRegistryHelper(const vtkKWRegistryHelper&);
00155 void operator=(const vtkKWRegistryHelper&);
00156 };
00157
00158 #endif
00159
00160