src/bookmarks/sql/include/engine_bookmark.h

00001 /*******************************************************************************
00002 This file is part of mdictionary.
00003 
00004 mdictionary is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 mdictionary is distributed in the hope that it will be useful, 
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License 
00015 along with mdictionary; if not, write to the Free Software
00016 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00017 
00018 Copyright 2006 ComArch S.A.
00019 *******************************************************************************/
00020 #ifndef _DICTIONARY_ENGINE_BOOKMARK
00021 #define _DICTIONARY_ENGINE_BOOKMARK
00022 
00023 #ifdef __cplusplus
00024         extern "C" {
00025 #endif
00026 
00027 //______________________________________________________________________________
00028 // *****************************************************************************
00029 //************************************************************* HEADERS SECTION:
00030 //------------------------------------------------------------------------------
00031 // headers with unix types/functions - only for timers
00032 #include <sys/types.h>
00033 #include <sys/stat.h>
00034 #include <sys/time.h>
00035 #include <fcntl.h>
00036 #include <unistd.h>
00037 //------------------------------------------------------------------------------
00038 // header with GLIB definitions/functions/types
00039 #include <glib.h>
00040 //------------------------------------------------------------------------------
00041 // header wit engine API
00042 #include <dictionary_engine.h>
00043 //------------------------------------------------------------------------------
00044 // header wit sqlite 2.x API
00045 #include <sqlite.h>
00046 //------------------------------------------------------------------------------
00047 
00048 //______________________________________________________________________________
00049 // *****************************************************************************
00050 //********************************************************* DEFINITIONS SECTION:
00051 //------------------------------------------------------------------------------
00052 // definitions for timer function - flag telling if we want to start or stop
00053 // timing
00054 #define TIMER_START     TRUE
00055 #define TIMER_STOP      FALSE
00056 //------------------------------------------------------------------------------
00057 // definitions of version and format which engine handles
00058 static const gchar* DIC_ENG_VERSION = "0.1"; 
00059 static const gchar* DIC_ENG_FORMAT = "Users' Bookmarks";
00060 static const gchar* DIC_ENG_DESCRIPTION = "This module handles users' bookmarks.";
00061                             
00062 //------------------------------------------------------------------------------
00063 // macro for "printing" gboolean statement - "TRUE" or "FALSE"
00064 #define PRINT_STATE(state) ( (state) ? "TRUE" : "FALSE" )
00065 //------------------------------------------------------------------------------
00066 
00067 
00068 //______________________________________________________________________________
00069 // *****************************************************************************
00070 //****************************************** DATA STRUCTURE DEFINITIONS SECTION:
00071 //------------------------------------------------------------------------------
00074 struct _BookData {
00075         sqlite*                 db;
00076         
00077         gchar*                  dict_path;
00078         EngineStatus            last_error;
00079         gboolean                auto_free;
00080 
00081         cb_progress             cb_progress_caching;
00082         gpointer                cb_progress_caching_data;
00083         gdouble                 cb_progress_caching_seed;
00084 
00085         cb_progress             cb_progress_word_list;
00086         gpointer                cb_progress_word_list_data;
00087         gdouble                 cb_progress_word_list_seed;
00088 
00089         cb_progress             cb_progress_word_trans;
00090         gpointer                cb_progress_word_trans_data;
00091         gdouble                 cb_progress_word_trans_seed;
00092 
00093         cb_word_list            cb_search_word_list;
00094         gpointer                cb_search_word_list_data;
00095 
00096         cb_word_translation     cb_search_word_trans;
00097         gpointer                cb_search_word_trans_data;      
00098 };
00099 typedef struct _BookData        BookData;
00100 //------------------------------------------------------------------------------
00101 
00102 
00103 //______________________________________________________________________________
00104 // *****************************************************************************
00105 //************************************************ ADDITIONAL FUNCTIONS SECTION:
00106 //------------------------------------------------------------------------------
00107 // returning concrete part of file
00108 //static gchar*           read_file_part(FilePart* part, GnomeVFSHandle* file);
00109 //------------------------------------------------------------------------------
00110 // convert string to proper path name (no filename, no "/" at the ned, file
00111 // exist)
00112 static gchar*           string_to_path(gchar** string);
00113 //------------------------------------------------------------------------------
00114 // tells if file is in XDXF format (file should exist)
00115 //static gboolean         is_xdxf_file(gchar* file); 
00116 //------------------------------------------------------------------------------
00117 // start/stop timers -  returnet -1.0 if we start or seconds passed from start 
00118 // if we want to stop timer
00119 static double           timer(gboolean start, gchar* message);
00120 //------------------------------------------------------------------------------
00121 
00122 
00123 //______________________________________________________________________________
00124 // *****************************************************************************
00125 //****************************************************** MAIN FUNCTIONS SECTION:
00126 //------------------------------------------------------------------------------
00127 gboolean        bm_engine_add_word(Engine* engine,
00128                                  gchar*  word,
00129                                  gchar*  translation);
00130 //------------------------------------------------------------------------------
00131 gboolean        bm_engine_remove_word(Engine* engine,
00132                                      gchar*  word);  
00133 //------------------------------------------------------------------------------      
00134 gchar*          bm_engine_get_lang_from(Engine* engine);
00135 //------------------------------------------------------------------------------
00136 gchar*          bm_engine_get_lang_to(Engine* engine);
00137 //------------------------------------------------------------------------------
00138 gchar*          bm_engine_get_title(Engine* engine);
00139 //------------------------------------------------------------------------------
00140 gchar*          bm_engine_get_icon_path(Engine* engine);
00141 
00142 
00143 
00144 //------------------------------------------------------------------------------
00145 // implementation of dict_eng_module_check(module,location) function
00146 gboolean        bm_engine_check(gchar* location);
00147 //------------------------------------------------------------------------------
00148 // implementation of dict_eng_module_get_description(module) function
00149 gchar*          bm_engine_description();
00150 //------------------------------------------------------------------------------
00151 // implementation of dict_eng_module_get_format(module) function
00152 gchar*          bm_engine_format();
00153 //------------------------------------------------------------------------------
00154 // implementation of dict_eng_module_get_version(module) function
00155 gchar*          bm_engine_version();
00156 //------------------------------------------------------------------------------
00157 // implementation of dict_eng_module_create(module,location,flags) and
00158 // dict_eng_module_create_ext(module,location,flags) functions
00159 Engine*         bm_engine_create(gchar* location, 
00160                               EngineOptimizationFlag flags,
00161                               cb_progress progress_handler,
00162                               gpointer progress_data,
00163                               gdouble seed);
00164 //------------------------------------------------------------------------------
00165 // implementation of dict_eng_destroy(engine) function
00166 void            bm_engine_close(Engine* engine);
00167 //------------------------------------------------------------------------------
00168 // implementation of dict_eng_get_location(engine) function
00169 gchar*          bm_engine_location(Engine* engine);
00170 //------------------------------------------------------------------------------
00171 // implementation of dict_eng_optimize(engine) function
00172 void            bm_engine_optimize(Engine* engine);
00173 //------------------------------------------------------------------------------
00174 // implementation of dict_eng_is_optimized( engine ) function
00175 gboolean        bm_engine_is_optimized(Engine* engine);
00176 //------------------------------------------------------------------------------
00177 // implementation of dict_eng_set_auto_free(engine, state) function
00178 void            bm_engine_set_auto_free(Engine* engine, gboolean state);
00179 //------------------------------------------------------------------------------
00180 // implementation of dict_eng_set_callback(engine,signal,c_handler,data) 
00181 // function
00182 gpointer        bm_engine_set_callback(Engine* engine,
00183                                      gchar* event,
00184                                      gpointer c_handler,
00185                                      gpointer user_data);
00186 //------------------------------------------------------------------------------
00187 // implementation of dict_eng_set_progress_seed(engine, signal, val) function
00188 void            bm_engine_set_progress_seed(Engine* engine,
00189                                          gchar* signal,
00190                                          gdouble seed);
00191 //------------------------------------------------------------------------------
00192 // implementation ofdict_eng_search_word_list(engine,pattern) function
00193 void            bm_engine_search_word_list(Engine* engine, gchar* pattern);
00194 //------------------------------------------------------------------------------
00195 // implementation of dict_eng_search_word_translation(engine,word) function
00196 void            bm_engine_search_word_translation(Engine* engine, gchar* word);
00197 //------------------------------------------------------------------------------
00198 // implementation of dict_eng_get_last_state(engine) function
00199 EngineStatus    bm_engine_status(Engine* engine);
00200 //------------------------------------------------------------------------------
00201 // implementation of dict_eng_state_message(error) function
00202 gchar*          bm_engine_status_message(EngineStatus error);
00203 //------------------------------------------------------------------------------
00204 // implementation of engine_global_functions(void) function
00205 EngineModule    engine_global_functions();
00206 
00207 #ifdef __cplusplus
00208 }
00209 #endif
00210 #endif /* #ifndef _DICTIONARY_ENGINE_STARDICT */

Generated on Wed Jan 2 09:19:42 2008 for WhiteStork Project by  doxygen 1.5.1