1 /******************************************************************************** 2 / 3 / File: TranslationDefs.h 4 / 5 / Description: Miscellaneous basic definitions for the Translation Kit 6 / 7 / Copyright 1998, Be Incorporated, All Rights Reserved. 8 / Copyright 1995-1997, Jon Watte 9 / 10 / 2002 - translation_data struct added by Michael Wilber, OBOS TransKit Team 11 ********************************************************************************/ 12 13 #if !defined(_TRANSLATION_DEFS_H) 14 #define _TRANSLATION_DEFS_H 15 16 #include <BeBuild.h> 17 #include <SupportDefs.h> 18 #include <TranslationErrors.h> 19 20 21 typedef unsigned long translator_id; 22 23 24 /* when you export this struct, end with an empty */ 25 /* record that has 0 for "type" */ 26 27 28 /* These are defines, because they reflect the state at which the app was compiled */ 29 #define B_TRANSLATION_CURRENT_VERSION B_BEOS_VERSION 30 #define B_TRANSLATION_MIN_VERSION 161 31 32 extern const char * B_TRANSLATOR_MIME_TYPE; 33 34 struct translation_format { 35 uint32 type; /* B_ASCII_TYPE, ...*/ 36 uint32 group; /* B_TRANSLATOR_BITMAP, B_TRANSLATOR_TEXT, ...*/ 37 float quality; /* ability of the format to retain the data of its group (0.0-1.0) */ 38 float capability; /* ability of the translator to decode the format (0.0-1.0) */ 39 char MIME[251]; /* MIME string*/ 40 char name[251]; /* only descriptive */ 41 }; 42 43 44 /* This struct is different from the format struct for a reason: */ 45 /* to separate the notion of formats from the notion of translations */ 46 47 struct translator_info { /* Info about a specific translation*/ 48 uint32 type; /* B_ASCII_TYPE, ...*/ 49 translator_id translator; /* Filled in by BTranslationRoster*/ 50 uint32 group; /* B_TRANSLATOR_BITMAP, B_TRANSLATOR_TEXT, ...*/ 51 float quality; /* ability of the format to retain the data of its group (0.0-1.0) */ 52 float capability; /* ability of the translator to decode the format (0.0-1.0) */ 53 char name[251]; 54 char MIME[251]; 55 }; 56 57 // BEGIN: Added by Michael Wilber 58 struct translator_data { 59 const char *translatorName; 60 const char *translatorInfo; 61 int32 translatorVersion; 62 const translation_format *inputFormats; 63 const translation_format *outputFormats; 64 65 status_t (*Identify)(BPositionIO *inSource, 66 const translation_format *inFormat, BMessage *ioExtension, 67 translator_info *outInfo, uint32 outType); 68 69 status_t (*Translate)(BPositionIO *inSource, 70 const translator_info *inInfo, BMessage *ioExtension, 71 uint32 outType, BPositionIO *outDestination); 72 73 status_t (*MakeConfig)(BMessage *ioExtension, 74 BView **outView, BRect *outExtent); 75 76 status_t (*GetConfigMessage)(BMessage *ioExtension); 77 }; 78 79 #define B_TRANSLATION_MAKE_VER(mjr,mnr,rev) ((mjr << 8) | ((mnr << 4) & 0xf0) | (rev & 0x0f)) 80 #define B_TRANSLATION_MAJOR_VER(v) (v >> 8) 81 #define B_TRANSLATION_MINOR_VER(v) ((v >> 4) & 0xf) 82 #define B_TRANSLATION_REVSN_VER(v) (v & 0xf) 83 84 // END: Added by Michael Wilber 85 86 #endif /* _TRANSLATION_DEFS_H */ 87