xref: /haiku/headers/os/translation/TranslationDefs.h (revision d7e489f80a82a0dc5974df1e780d7a908129bab4)
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;			/* format quality 0.0-1.0*/
38 	float		capability;			/* translator capability 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;		/* Quality of format in group 0.0-1.0*/
52 	float			capability;		/* How much of the format do we do? 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 // END: Added by Michael Wilber
79 
80 #endif /* _TRANSLATION_DEFS_H */
81