include/dictionary_engine.h File Reference

API for dictionary engines. More...

Go to the source code of this file.

Data Structures

struct  _Engine
 Structure describing particular dictionary. More...
struct  EngineModule
 Global functions structure. More...

Defines

Names and Versions
These defines how should be called exported function and what is the version of this Engine API.

#define ENGINE_API_VERSION   "1.0.0"
 ENGINE_API_VERSION tells what version of API this header define.
#define _GLOBAL_FUNCTIONS_   engine_global_functions
 Global functions structure name.
#define GLOBAL_FUNCTIONS_NAME   __TOSTRING(_GLOBAL_FUNCTIONS_)
 String containing global functions structure name.
Global Module Macros
These macros can be used to make it easier to work with many dictionary engine modules.

#define dict_eng_module_check(module, location)   ((module).engine_check(location))
 Checks if given path points to dictionary is in compatible format.
#define dict_eng_module_get_description(module)   ((module).engine_description())
 Get description of the module.
#define dict_eng_module_get_version(module)   ((module).engine_version())
 Get version of the module.
#define dict_eng_module_get_api_version(module)   ((module).engine_api_version())
 Get version of Engine API with which module was compiled.
#define dict_eng_module_get_format(module)   ((module).engine_format())
 Get format of supported dictionaries.
#define dict_eng_module_create(module, location, flags)
 Create engine instance connected with particular dictionary.
#define dict_eng_module_create_ext(module, location, flags, progress_handler, progress_data, seed)
 Create engine instance connected with particular dictionary.
Particular Dictionary Macros
These macros are working on particular dictionary. It makes it easier to work through these macros than by calling member of engine structure.
See also:
Engine


#define dict_eng_set_progress_seed(engine, signal, val)
 Set seed value for particular progress callback.
#define dict_eng_set_auto_free(engine, state)   (engine)->engine_set_auto_free((engine), (state))
 Set-up auto-freeing of memory allocated by engine.
#define dict_eng_optimize(engine)   ((engine)->engine_optimize((engine)))
 Activate optimization mechanizms for particular dictionary.
#define dict_eng_is_optimized(engine)   ((engine)->engine_is_optimized((engine)))
 Find out if specified engine is using optimization now.
#define dict_eng_get_location(engine)   ((engine)->engine_location((engine)))
 To get know from what location was created current dictionary.
#define dict_eng_get_last_status(engine)   ((engine)->engine_status((engine)))
 Tells if last operation was sucesfull.
#define dict_eng_status_message(engine, status)   ((engine)->engine_status_message((status)))
 Translate pure state code to meaningfull message.
#define dict_eng_destroy(engine)   ((engine)->engine_close(engine))
 Destroy gently and completely given dictionary engine.
#define dict_eng_search_word_list(engine, pattern, data)
 Start searching for words matching given pattern.
#define dict_eng_search_word_translation(engine, word, data)
 Start searching for word's translation.
#define dict_eng_set_callback(engine, signal, c_handler, data)
 Set callback function for particular signal.
#define dict_eng_add_word(engine, word, tran)
 Add new word to the dictionary.
#define dict_eng_remove_word(engine, word)
 Remove word from the dictionary.
#define dict_eng_get_lang_from(engine)   ((engine)->engine_get_lang_from(engine))
 Get language from which this dictionary translates.
#define dict_eng_get_lang_to(engine)   ((engine)->engine_get_lang_to(engine))
 Get language to which this dictionary translates.
#define dict_eng_get_title(engine)   ((engine)->engine_get_title(engine))
 Get dictionary title.
#define dict_eng_get_icon_path(engine)   ((engine)->engine_get_icon_path(engine))
 Get dictionary icon path.
Callbacks' Signals
These strings identify signals which will be emitted after dictionary engine finished some work.

Signals are defined as a strings to make it easier to keep compatibility and to be more flexible for future changes.

#define ENGINE_WORD_LIST_SIGNAL   "on_word_list_found"
 Signals that words list matching for given pattern is available.
#define ENGINE_WORD_TRANSLATION_SIGNAL   "on_word_translation_found"
 Signals that translation is available for given word.
#define ENGINE_PROGRESS_OPTIMIZING_SIGNAL   "on_progress_optimizing"
 Signals progress event for optimization proccess.

Typedefs

typedef _Engine Engine
typedef EngineModule(*) getting_additional_t (void)
Callbacks' Types
Types defining of what types should be particular callbacks to properly work with Engine API.
See also:
dict_eng_set_callback


typedef void(*) cb_word_list (GArray *list, gchar *pattern, gpointer user_data, EngineStatus error)
 Type of callback functions for retrieving word list.
typedef void(*) cb_word_translation (gchar *translation, gchar *word, gpointer user_data, EngineStatus error)
 Type of callback functions for retrieving word's translation.
typedef void(*) cb_progress (gdouble value, gpointer user_data, EngineStatus error)
 Type of callback functions for handling progress of optimization.

Enumerations

Flags and Error Codes
enum  EngineOptimizationFlag {
  ENGINE_CREATE = 1 << 0,
  ENGINE_NO = 1 << 1,
  ENGINE_REFRESH = 1 << 2
}
 Flags defining how to use optimization for particular dictionary. More...
enum  EngineStatus {
  ENGINE_NO_ERROR = 0,
  ENGINE_WRONG_FILE = 1 << 0,
  ENGINE_COULDNT_READ = 1 << 1,
  ENGINE_COULDNT_WRITE = 1 << 2,
  ENGINE_INTERNAL_ERROR = 1 << 3,
  ENGINE_NO_FILE = 1 << 4,
  ENGINE_OUT_OF_MEMORY = 1 << 5
}
 Codes of possible errors which can occure while engine is working. More...

Functions

EngineModule engine_global_functions (void)
 Get structure and access to all module functions.


Detailed Description

API for dictionary engines.

This file define engine API which should be implemented by each dictionary and is being used by WhiteStork manager (or any other program that want to use WhiteStork plug-in capabilities).

Author:
Dariusz Wiechecki <dariusz.wiechecki@comarch.com>
Date:
05-11-2007
Version:
1.0.0
See also:
Dictionary Engine API

Definition in file dictionary_engine.h.


Generated on Fri Jan 11 14:30:17 2008 for mDictionary Project by  doxygen 1.5.1