Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

defaults.h

Go to the documentation of this file.
00001 #ifndef DEFAULTS_H
00002 #define DEFAULTS_H
00003 
00004 
00005 
00006 // Hash table with persistent storage in stringfiles.
00007 
00008 
00009 #include "stringfile.inc"
00010 #include "units.h"
00011 
00012 
00013 class Defaults
00014 {
00015 public:
00016         Defaults();
00017         Defaults(char *filename);
00018         virtual ~Defaults();
00019 
00020         int load();        // load from disk file
00021         int save();        // save to disk file
00022         int load_string(char *string);        // load from string
00023         int save_string(char* &string);       // save to new string
00024         void save_stringfile(StringFile *file);
00025         void load_stringfile(StringFile *file);
00026         int update(char *name, Freq value); // update a value if it exists
00027         int update(char *name, double value); // update a value if it exists
00028         int update(char *name, float value); // update a value if it exists
00029         int update(char *name, int32_t value); // update a value if it exists
00030         int update(char *name, int64_t value); // update a value if it exists
00031         int update(char *name, char *value); // create it if it doesn't
00032 
00033         double get(char *name, double default_);   // retrieve a value if it exists
00034         float get(char *name, float default_);   // retrieve a value if it exists
00035         int32_t get(char *name, int32_t default_);   // retrieve a value if it exists
00036         int64_t get(char *name, int64_t default_);   // retrieve a value if it exists
00037         char* get(char *name, char *default_); // return 1 if it doesn't
00038         
00039         char *names[1024];  // list of string names
00040         char *values[1024];    // list of values
00041         int total;             // number of defaults
00042         char filename[1024];        // filename the defaults are stored in
00043 };
00044 
00045 #endif

Generated on Sun Jan 8 13:26:34 2006 for Guicast-svn by  doxygen 1.4.4