xref: /haiku/headers/os/translation/TranslationDefs.h (revision 893988af824e65e49e55f517b157db8386e8002b)
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: Haiku R1 Extensions
58 
59 #define B_TRANSLATION_MAKE_VERSION(major,minor,revision) ((major << 8) | ((minor << 4) & 0xf0) | (revision & 0x0f))
60 #define B_TRANSLATION_MAJOR_VERSION(v) (v >> 8)
61 #define B_TRANSLATION_MINOR_VERSION(v) ((v >> 4) & 0xf)
62 #define B_TRANSLATION_REVISION_VERSION(v) (v & 0xf)
63 
64 // END: Haiku R1 Extensions
65 
66 #endif /* _TRANSLATION_DEFS_H */
67