00001 00031 #ifndef __SPPOOL_H__ 00032 #define __SPPOOL_H__ 00033 00034 #include "spstring.h" 00035 00039 #define MAX_DIM_STRING_POOL 50 00040 00044 #define UNUSED_SLOT 0 00045 00049 #define USED_SLOT 1 00050 00055 typedef struct { 00057 string strings[MAX_DIM_STRING_POOL]; 00061 uint used_counter; 00068 uint positions[MAX_DIM_STRING_POOL]; 00069 } stringpool; 00070 00076 void sp_initialize_stringpool(stringpool* sp); 00077 00083 void sp_free_stringpool(stringpool* sp); 00084 00091 int sp_sizeof(const stringpool* sp); 00092 00098 bool sp_isempty(const stringpool* sp); 00099 00105 bool sp_isfull(const stringpool* sp); 00106 00114 int sp_find_string(const stringpool* sp, const string str); 00115 00124 string sp_get_string(const stringpool* sp, int pos); 00125 00131 void sp_add_string(stringpool* sp, const string str); 00132 00139 void sp_add_string_pos(stringpool* sp, const string str, int pos); 00140 00150 string sp_remove_string(stringpool* sp, int pos); 00151 00159 void sp_replace_string(stringpool* sp, int pos, string str); 00160 00167 int sp_save_to_file(stringpool* sp, const string fname); 00168 00175 int sp_load_from_file(stringpool* sp, const string fname); 00176 00182 void bubble_sort(stringpool* sp); 00183 00195 int bin_search(const stringpool* sp, const string str); 00196 00197 #endif