2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
7 * Axel Dörfler, axeld@pinc-software.de
9 #ifndef _FUNC_TRANSLATOR_H
10 #define _FUNC_TRANSLATOR_H
13 #include <Translator.h>
16 // Structure used to hold the collection of function pointers and
17 // public variables exported by function based translator add-ons.
18 struct translator_data
{
22 const translation_format
* input_formats
;
23 const translation_format
* output_formats
;
25 status_t (*identify_hook
)(BPositionIO
* source
, const translation_format
* format
,
26 BMessage
* ioExtension
, translator_info
* outInfo
, uint32 outType
);
28 status_t (*translate_hook
)(BPositionIO
* source
, const translator_info
* info
,
29 BMessage
* ioExtension
, uint32 outType
, BPositionIO
* destination
);
31 status_t (*make_config_hook
)(BMessage
* ioExtension
, BView
** _view
, BRect
* _extent
);
32 status_t (*get_config_message_hook
)(BMessage
* ioExtension
);
37 class BFuncTranslator
: public BTranslator
{
39 BFuncTranslator(const translator_data
& data
);
41 virtual const char *TranslatorName() const;
42 virtual const char *TranslatorInfo() const;
43 virtual int32
TranslatorVersion() const;
45 virtual const translation_format
*InputFormats(int32
*out_count
) const;
46 virtual const translation_format
*OutputFormats(int32
*out_count
) const;
48 virtual status_t
Identify(BPositionIO
*inSource
,
49 const translation_format
*inFormat
, BMessage
*ioExtension
,
50 translator_info
*outInfo
, uint32 outType
);
51 virtual status_t
Translate(BPositionIO
*inSource
,
52 const translator_info
*inInfo
, BMessage
*ioExtension
, uint32 outType
,
53 BPositionIO
* outDestination
);
54 virtual status_t
MakeConfigurationView(BMessage
*ioExtension
,
55 BView
**outView
, BRect
*outExtent
);
56 virtual status_t
GetConfigurationMessage(BMessage
*ioExtension
);
59 virtual ~BFuncTranslator();
60 // This object is deleted by calling Release(),
61 // it can not be deleted directly. See BTranslator in the Be Book
64 translator_data fData
;
67 } // namespace BPrivate
69 #endif // _FUNC_TRANSLATOR_H