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
11 This file contains the BTranslator based object for
12 function based translators, aka, the translators
13 that don't use the make_nth_translator() mechanism.
15 This class is used by the BTranslatorRoster class
16 so that function based translators, make_nth_translator()
17 translators and private BTranslator objects could be
18 accessed in the same way.
22 #include "FuncTranslator.h"
29 BFuncTranslator::BFuncTranslator(const translator_data
& data
)
35 BFuncTranslator::~BFuncTranslator()
41 BFuncTranslator::TranslatorName() const
48 BFuncTranslator::TranslatorInfo() const
55 BFuncTranslator::TranslatorVersion() const
61 const translation_format
*
62 BFuncTranslator::InputFormats(int32
* _count
) const
64 if (_count
== NULL
|| fData
.input_formats
== NULL
)
68 while (fData
.input_formats
[count
].type
) {
73 return fData
.input_formats
;
77 const translation_format
*
78 BFuncTranslator::OutputFormats(int32
* _count
) const
80 if (_count
== NULL
|| fData
.output_formats
== NULL
)
84 while (fData
.output_formats
[count
].type
) {
89 return fData
.output_formats
;
94 BFuncTranslator::Identify(BPositionIO
* source
, const translation_format
* format
,
95 BMessage
* ioExtension
, translator_info
* info
, uint32 type
)
97 if (fData
.identify_hook
== NULL
)
100 return fData
.identify_hook(source
, format
, ioExtension
, info
, type
);
105 BFuncTranslator::Translate(BPositionIO
* source
, const translator_info
*info
,
106 BMessage
* ioExtension
, uint32 type
, BPositionIO
* destination
)
108 if (fData
.translate_hook
== NULL
)
111 return fData
.translate_hook(source
, info
, ioExtension
, type
, destination
);
116 BFuncTranslator::MakeConfigurationView(BMessage
* ioExtension
,
117 BView
** _view
, BRect
* _extent
)
119 if (fData
.make_config_hook
== NULL
)
122 return fData
.make_config_hook(ioExtension
, _view
, _extent
);
127 BFuncTranslator::GetConfigurationMessage(BMessage
* ioExtension
)
129 if (fData
.get_config_message_hook
== NULL
)
132 return fData
.get_config_message_hook(ioExtension
);
135 } // namespace BPrivate