6 // Hash table with persistent storage in stringfiles.
9 #include "bcwindowbase.inc"
10 #include "stringfile.inc"
18 BC_Hash(char *filename
);
21 int load(); // load from disk file
22 int save(); // save to disk file
23 int load_string(char *string
); // load from string
24 int save_string(char* &string
); // save to new string
25 void save_stringfile(StringFile
*file
);
26 void load_stringfile(StringFile
*file
);
27 int update(char *name
, Freq value
); // update a value if it exists
28 int update(char *name
, double value
); // update a value if it exists
29 int update(char *name
, float value
); // update a value if it exists
30 int update(char *name
, int32_t value
); // update a value if it exists
31 int update(char *name
, int64_t value
); // update a value if it exists
32 int update(char *name
, char *value
); // create it if it doesn't
34 double get(char *name
, double default_
); // retrieve a value if it exists
35 float get(char *name
, float default_
); // retrieve a value if it exists
36 int32_t get(char *name
, int32_t default_
); // retrieve a value if it exists
37 int64_t get(char *name
, int64_t default_
); // retrieve a value if it exists
38 char* get(char *name
, char *default_
); // return 1 if it doesn't
40 // Update values with values from another table.
41 // Adds values that don't exist and updates existing values.
42 void copy_from(BC_Hash
*src
);
43 // Return 1 if the tables are equivalent
44 int equivalent(BC_Hash
*src
);
50 // Reallocate table so at least total entries exist
51 void reallocate_table(int total
);
53 char **names
; // list of string names
54 char **values
; // list of values
55 int total
; // number of defaults
56 int allocated
; // allocated defaults
57 char filename
[BCTEXTLEN
]; // filename the defaults are stored in
64 // c-file-style: "linux"