xref: /haiku/docs/user/translation/TranslatorRoster.dox (revision a8081885d2bcc5076d27ea1cbc5b9c0cc60f1126)
170dc2e27SMarkus Himmel/*
270dc2e27SMarkus Himmel * Copyright 2014-2015 Markus Himmel. All rights reserved.
370dc2e27SMarkus Himmel * Distributed under the terms of the MIT License.
470dc2e27SMarkus Himmel *
570dc2e27SMarkus Himmel * Authors:
670dc2e27SMarkus Himmel *		Markus Himmel, markus@himmel-villmar.de
770dc2e27SMarkus Himmel *
870dc2e27SMarkus Himmel * Corresponds to:
970dc2e27SMarkus Himmel *		headers/os/translation/TranslatorRoster.h	hrev48588
1070dc2e27SMarkus Himmel *		src/kits/translation/TranslatorRoster.cpp	hrev48588
1170dc2e27SMarkus Himmel */
1270dc2e27SMarkus Himmel
1370dc2e27SMarkus Himmel/*!
1470dc2e27SMarkus Himmel	\file TranslatorRoster.h
1570dc2e27SMarkus Himmel	\ingroup translation
1670dc2e27SMarkus Himmel	\ingroup libtranslation
1770dc2e27SMarkus Himmel	\brief BTranslatorRoster class definition
1870dc2e27SMarkus Himmel*/
1970dc2e27SMarkus Himmel
2070dc2e27SMarkus Himmel/*!
2170dc2e27SMarkus Himmel	\class BTranslatorRoster
2270dc2e27SMarkus Himmel	\ingroup translation
2370dc2e27SMarkus Himmel	\ingroup libtranslation
2470dc2e27SMarkus Himmel	\brief Class that serves as an interface between applications and
2570dc2e27SMarkus Himmel		translators.
2670dc2e27SMarkus Himmel
2770dc2e27SMarkus Himmel	BTranslatorRoster gives applications access to the translation kit.
2870dc2e27SMarkus Himmel	Applications can request translations and BTranslatorRoster will
2970dc2e27SMarkus Himmel	automatically search for a matching translator and have it perfrom the
3070dc2e27SMarkus Himmel	translation.
3170dc2e27SMarkus Himmel
3270dc2e27SMarkus Himmel	\warning BTranslatorRoster does not perform chaining of any sort. Only
3370dc2e27SMarkus Himmel		translations that can be made by invoking a single translator are
3470dc2e27SMarkus Himmel		supported.
3570dc2e27SMarkus Himmel
3670dc2e27SMarkus Himmel	\note BTranslationUtils provides some helper methods that perform the
3770dc2e27SMarkus Himmel		interaction with BTranslatorRoster for you.
3870dc2e27SMarkus Himmel
3970dc2e27SMarkus Himmel	BTranslationRoster acts as a container. While in most cases the default
4070dc2e27SMarkus Himmel	roster is used, it is possible to create a roster that interacts with a
4170dc2e27SMarkus Himmel	custom set of translators.
4270dc2e27SMarkus Himmel*/
4370dc2e27SMarkus Himmel
4470dc2e27SMarkus Himmel/*!
4570dc2e27SMarkus Himmel	\name Constructors and Destructor
4670dc2e27SMarkus Himmel*/
4770dc2e27SMarkus Himmel
4870dc2e27SMarkus Himmel//! @{
4970dc2e27SMarkus Himmel
5070dc2e27SMarkus Himmel/*!
5170dc2e27SMarkus Himmel	\fn BTranslatorRoster::BTranslatorRoster()
5270dc2e27SMarkus Himmel	\brief Constructs an empty BTranslatorRoster.
5370dc2e27SMarkus Himmel
5470dc2e27SMarkus Himmel	\warning Only call the contructor if you want to use a custom collection of
5570dc2e27SMarkus Himmel		translators. Use Default() if you don't.
5670dc2e27SMarkus Himmel*/
5770dc2e27SMarkus Himmel
5870dc2e27SMarkus Himmel/*!
5970dc2e27SMarkus Himmel	\fn BTranslatorRoster::BTranslatorRoster(BMessage* model);
6070dc2e27SMarkus Himmel	\brief Constructs a BTranslatorRoster and fills it.
6170dc2e27SMarkus Himmel
6270dc2e27SMarkus Himmel	\param model A message that contains information about a
6370dc2e27SMarkus Himmel		BTranslatorRoster.
6470dc2e27SMarkus Himmel
6570dc2e27SMarkus Himmel	After initialization, \a model is searched for strings with the name
6670dc2e27SMarkus Himmel	\c "be:translator_path". The translators that are located at each path
6770dc2e27SMarkus Himmel	are added to the roster. If multiple paths point to translators with the
6870dc2e27SMarkus Himmel	same name, the translator at the path with the lowest index within the
6970dc2e27SMarkus Himmel	message will be kept.
7070dc2e27SMarkus Himmel
7170dc2e27SMarkus Himmel	\warning Use Instantiate() instead of this constructor if \a model was
7270dc2e27SMarkus Himmel		created using Archive().
7370dc2e27SMarkus Himmel*/
7470dc2e27SMarkus Himmel
7570dc2e27SMarkus Himmel/*!
7670dc2e27SMarkus Himmel	\fn BTranslatorRoster::~BTranslatorRoster();
7770dc2e27SMarkus Himmel	\brief Deletes this BTranslatorRoster.
7870dc2e27SMarkus Himmel
7970dc2e27SMarkus Himmel	If the BTranslatorRoster that is deleted is the default roster, a new
8070dc2e27SMarkus Himmel	default roster will be created when BTranslatorRoster::Default() is called
8170dc2e27SMarkus Himmel	for the next time.
8270dc2e27SMarkus Himmel
8370dc2e27SMarkus Himmel	Release() is called on all translators in the roster.
8470dc2e27SMarkus Himmel*/
8570dc2e27SMarkus Himmel
8670dc2e27SMarkus Himmel/*!
8770dc2e27SMarkus Himmel	\fn static BTranslatorRoster* BTranslatorRoster::Default();
8870dc2e27SMarkus Himmel	\brief Gets the default BTranslatorRoster.
8970dc2e27SMarkus Himmel
90ed3c7f8fSAdrien Destugues	At any point, there is only one default roster. It is created when this
91ed3c7f8fSAdrien Destugues	method is called for the first time (possibly after being deleted) and is
92ed3c7f8fSAdrien Destugues	populated according to the following rules:
9370dc2e27SMarkus Himmel
94ed3c7f8fSAdrien Destugues	If the environment variable \c TRANSLATORS is set, the default roster will
95ed3c7f8fSAdrien Destugues	be populated with all translators that are present in the directories
96ed3c7f8fSAdrien Destugues	denoted by \c TRANSLATORS. The paths are separated by a colon (<tt>:</tt>).
97ed3c7f8fSAdrien Destugues	If multiple paths contain a translator with the same name, the translator
9870dc2e27SMarkus Himmel	that is located in the path that appears earliest in \c TRANSLATORS will
9970dc2e27SMarkus Himmel	be kept.
10070dc2e27SMarkus Himmel
101ed3c7f8fSAdrien Destugues	If \c TRANSLATORS is not set, the user non-packaged add-ons directory, the
10270dc2e27SMarkus Himmel	user add-ons directory, the system non-packaged add-ons directory and the
10370dc2e27SMarkus Himmel	system add-ons directory will be used. If those directories do not contain
10470dc2e27SMarkus Himmel	a subdirectory \c Translators, it will be created. The subdirectories are
10570dc2e27SMarkus Himmel	then added in the above order. If multiple directories contain a translator
10670dc2e27SMarkus Himmel	with the same name, the translator that is located in the path that appears
10770dc2e27SMarkus Himmel	earliest in the above list will be kept.
10870dc2e27SMarkus Himmel*/
10970dc2e27SMarkus Himmel
11070dc2e27SMarkus Himmel//! @}
11170dc2e27SMarkus Himmel
11270dc2e27SMarkus Himmel/*!
11370dc2e27SMarkus Himmel	\name Archiving
11470dc2e27SMarkus Himmel*/
11570dc2e27SMarkus Himmel
11670dc2e27SMarkus Himmel//! @{
11770dc2e27SMarkus Himmel
11870dc2e27SMarkus Himmel/*!
11970dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::Archive(BMessage* into, bool deep\
12070dc2e27SMarkus Himmel		= true) const;
12170dc2e27SMarkus Himmel	\brief Archive this BTranslatorRoster into a BMessage.
12270dc2e27SMarkus Himmel
12370dc2e27SMarkus Himmel	\param into Where the BTranslatorRoster will be stored.
12470dc2e27SMarkus Himmel	\param deep Unused.
12570dc2e27SMarkus Himmel
12670dc2e27SMarkus Himmel	\retval B_OK The operation was successful.
12770dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a into was NULL.
12870dc2e27SMarkus Himmel	\retval B_ERROR The operation failed.
12970dc2e27SMarkus Himmel*/
13070dc2e27SMarkus Himmel
13170dc2e27SMarkus Himmel/*!
13270dc2e27SMarkus Himmel	\fn static BArchivable* BTranslatorRoster::Instantiate(BMessage* from);
13370dc2e27SMarkus Himmel	\brief Creates a new BTranslatorRoster from a message.
13470dc2e27SMarkus Himmel
13570dc2e27SMarkus Himmel	\param from The message that contains information about a
13670dc2e27SMarkus Himmel		BTranslatorRoster.
13770dc2e27SMarkus Himmel
13870dc2e27SMarkus Himmel	\returns \c NULL if \a from was \c NULL, contained invalid archive data or
13970dc2e27SMarkus Himmel		archive data of a class that is not BTranslatorRoster. A pointer to a
14070dc2e27SMarkus Himmel		new BTranslatorRoster containing the information from \a from
14170dc2e27SMarkus Himmel		otherwise.
14270dc2e27SMarkus Himmel*/
14370dc2e27SMarkus Himmel
14470dc2e27SMarkus Himmel//! @}
14570dc2e27SMarkus Himmel
14670dc2e27SMarkus Himmel/*!
14770dc2e27SMarkus Himmel	\name Roster Management
14870dc2e27SMarkus Himmel*/
14970dc2e27SMarkus Himmel
15070dc2e27SMarkus Himmel//! @{
15170dc2e27SMarkus Himmel
15270dc2e27SMarkus Himmel/*!
15370dc2e27SMarkus Himmel	\fn status_t BTranslatorRoster::AddTranslators(const char* loadPath =\
15470dc2e27SMarkus Himmel		NULL);
15570dc2e27SMarkus Himmel	\brief Adds translators from a directory to the roster.
15670dc2e27SMarkus Himmel
15770dc2e27SMarkus Himmel	\param loadPath A colon-separated list of directories to search for
15870dc2e27SMarkus Himmel		translators in.
15970dc2e27SMarkus Himmel
16070dc2e27SMarkus Himmel	The following method is used to determine which translators to add:
16170dc2e27SMarkus Himmel
16270dc2e27SMarkus Himmel	If \a loadPath is not \c NULL, the roster will be populated with all
16370dc2e27SMarkus Himmel	translators that are present in the directores denoted by \a loadPath. The
16470dc2e27SMarkus Himmel	paths are separated by a colon (<tt>:</tt>). If multiple paths contain a
16570dc2e27SMarkus Himmel	translator with the same name, the translator that is located in the path
16670dc2e27SMarkus Himmel	that appears earliest in \a loadPath will be kept.
16770dc2e27SMarkus Himmel
16870dc2e27SMarkus Himmel	If \a loadPath is \c NULL and the environment variable \c TRANSLATORS is
16970dc2e27SMarkus Himmel	set, it will be populated with all translators that are present in the
17070dc2e27SMarkus Himmel	directories denoted by \c TRANSLATORS. The paths are separated by a colon
17170dc2e27SMarkus Himmel	(<tt>:</tt>). If multiple paths contain a translator with the same name,
17270dc2e27SMarkus Himmel	the translator that is located in the path that appears earliest in
17370dc2e27SMarkus Himmel	\c TRANSLATORS will be kept.
17470dc2e27SMarkus Himmel
17570dc2e27SMarkus Himmel	If \a loadPath is \c NULL and \c TRANSLATORS is unset, the user
17670dc2e27SMarkus Himmel	non-packaged add-ons directory, the user add-ons directory, the system
17770dc2e27SMarkus Himmel	non-packaged add-ons directory and the system add-ons directory will be
17870dc2e27SMarkus Himmel	used. If those directories do not contain a subdirectory \c Translators, it
17970dc2e27SMarkus Himmel	will be created. The subdirectories are then added in the above order. If
18070dc2e27SMarkus Himmel	multiple directories contain a translator with the same name, the
18170dc2e27SMarkus Himmel	translator that is located in the path that appears earliest in the above
18270dc2e27SMarkus Himmel	list will be kept.
18370dc2e27SMarkus Himmel
18470dc2e27SMarkus Himmel	\returns \c B_OK if everything went well, an error code specific to the
18570dc2e27SMarkus Himmel		operation that failed otherwise.
18670dc2e27SMarkus Himmel*/
18770dc2e27SMarkus Himmel
18870dc2e27SMarkus Himmel/*!
18970dc2e27SMarkus Himmel	\fn status_t BTranslatorRoster::AddTranslator(BTranslator* translator);
19070dc2e27SMarkus Himmel	\brief Adds a single BTranslator to the roster.
19170dc2e27SMarkus Himmel
19270dc2e27SMarkus Himmel	\param translator The translator that should be added.
19370dc2e27SMarkus Himmel
19470dc2e27SMarkus Himmel	\remark AddTranslator() calls Acquire() on the translator, so it is safe
19570dc2e27SMarkus Himmel		to release it if you had acquired it before.
19670dc2e27SMarkus Himmel
19770dc2e27SMarkus Himmel	\retval B_OK The translator was successfully added to the roster.
19870dc2e27SMarkus Himmel	\retval B_NO_MEMORY There was no memory to enlarge the roster.
19970dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a translator was \c NULL.
20070dc2e27SMarkus Himmel*/
20170dc2e27SMarkus Himmel
20270dc2e27SMarkus Himmel//! @}
20370dc2e27SMarkus Himmel
20470dc2e27SMarkus Himmel/*!
20570dc2e27SMarkus Himmel	\name Translator Access
20670dc2e27SMarkus Himmel*/
20770dc2e27SMarkus Himmel
20870dc2e27SMarkus Himmel//! @{
20970dc2e27SMarkus Himmel
21070dc2e27SMarkus Himmel/*!
21170dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::GetTranslators(BPositionIO*\
21270dc2e27SMarkus Himmel		source, BMessage* ioExtension, translator_info** _info, int32*\
21370dc2e27SMarkus Himmel		_numInfo, uint32 hintType = 0, const char* hintMIME = NULL, uint32\
21470dc2e27SMarkus Himmel		wantType = 0);
21570dc2e27SMarkus Himmel	\brief Collects information about all translators that are able to perform
21670dc2e27SMarkus Himmel		a certain conversion in an array.
21770dc2e27SMarkus Himmel
21870dc2e27SMarkus Himmel	\param source Read and seek interface to the data to be examinded.
21970dc2e27SMarkus Himmel	\param ioExtension A message containing configuration information for the
22070dc2e27SMarkus Himmel		translators.
22170dc2e27SMarkus Himmel	\param _info Where the resulting array will be stored.
22270dc2e27SMarkus Himmel	\param _numInfo Where the number of elements in the resulting array will
22370dc2e27SMarkus Himmel		be stored.
22470dc2e27SMarkus Himmel	\param hintType A hint about the data format in \a source. \c 0 represents
22570dc2e27SMarkus Himmel		an unknown type.
22670dc2e27SMarkus Himmel	\param hintMIME A hint about the MIME type of \a source. \c NULL represents
22770dc2e27SMarkus Himmel		an unknown type.
22870dc2e27SMarkus Himmel	\param wantType The format that \a source needs to be translated into. \c 0
22970dc2e27SMarkus Himmel		permits any output type.
23070dc2e27SMarkus Himmel
23170dc2e27SMarkus Himmel	If this function returns \c B_OK the caller has to call \c delete[] when
23270dc2e27SMarkus Himmel	they are done using \a _info.
23370dc2e27SMarkus Himmel
23470dc2e27SMarkus Himmel	\retval B_OK \a _info and \a _numInfo were successfully populated.
23570dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR No suitable translator was found.
23670dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a source, \a _info or \a _numInfo was \c NULL.
23770dc2e27SMarkus Himmel	\retval B_IO_ERROR There was an error interacting with \a source.
23870dc2e27SMarkus Himmel	\retval B_NO_MEMORY Could not allocate enough memory for the array.
23970dc2e27SMarkus Himmel*/
24070dc2e27SMarkus Himmel
24170dc2e27SMarkus Himmel/*!
24270dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::GetAllTranslators(translator_id**\
24370dc2e27SMarkus Himmel		_list, int32* _count);
24470dc2e27SMarkus Himmel	\brief Collects the IDs of all translators in the roster in an array.
24570dc2e27SMarkus Himmel
24670dc2e27SMarkus Himmel	\param _list Where the resulting array will be stored.
24770dc2e27SMarkus Himmel	\param _count Where the number of elements in the resulting array will be
24870dc2e27SMarkus Himmel		stored.
24970dc2e27SMarkus Himmel
25070dc2e27SMarkus Himmel	If this function returns \c B_OK the caller has to call \c delete[] when
25170dc2e27SMarkus Himmel	they are done using \a _info.
25270dc2e27SMarkus Himmel
25370dc2e27SMarkus Himmel	\retval B_OK \a _list and \a _count were populated successfully.
25470dc2e27SMarkus Himmel	\retval B_NO_MEMORY Could not allocate the memory for the array.
25570dc2e27SMarkus Himmel*/
25670dc2e27SMarkus Himmel
25770dc2e27SMarkus Himmel/*!
25870dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::GetTranslatorInfo(translator_id\
25970dc2e27SMarkus Himmel		translatorID, const char** _name, const char** _info, int32* _version);
26070dc2e27SMarkus Himmel	\brief Looks up general information of the translator with a given ID.
26170dc2e27SMarkus Himmel
26270dc2e27SMarkus Himmel	\param translatorID The ID of the translator whose information is
26370dc2e27SMarkus Himmel		requested.
26470dc2e27SMarkus Himmel	\param _name Where the name of the translator will be stored.
26570dc2e27SMarkus Himmel	\param _info Where the description of the translator will be stored.
26670dc2e27SMarkus Himmel	\param _version Where the version of the translator will be stored.
26770dc2e27SMarkus Himmel
26870dc2e27SMarkus Himmel	Do not free any returned data. If any of \a _name, \a _info and \a _version
26970dc2e27SMarkus Himmel	are \c NULL, the non-null pointers will still be written to.
27070dc2e27SMarkus Himmel
27170dc2e27SMarkus Himmel	\retval B_OK All non-null pointers were written to successfully.
27270dc2e27SMarkus Himmel	\retval B_BAD_VALUE All three pointers were \c NULL.
27370dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The roster does not contain any translator with the
27470dc2e27SMarkus Himmel		ID \a translatorID.
27570dc2e27SMarkus Himmel*/
27670dc2e27SMarkus Himmel
27770dc2e27SMarkus Himmel/*!
27870dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::GetInputFormats(translator_id\
27970dc2e27SMarkus Himmel		translatorID, const translation_format** _formats, int32* _numFormats);
28070dc2e27SMarkus Himmel	\brief Looks up the input formats of the translator with a given ID.
28170dc2e27SMarkus Himmel
28270dc2e27SMarkus Himmel	\param translatorID The ID of the translator whose input formats are
28370dc2e27SMarkus Himmel		requested.
28470dc2e27SMarkus Himmel	\param _formats Where the array of input formats will be stored.
28570dc2e27SMarkus Himmel	\param _numFormats Where the number of elements in the array of input
28670dc2e27SMarkus Himmel		formats will be stored.
28770dc2e27SMarkus Himmel
28870dc2e27SMarkus Himmel	Do not free any of the returned data.
28970dc2e27SMarkus Himmel
29070dc2e27SMarkus Himmel	\retval B_OK \a _formats and \a _numFormats were successfully set.
29170dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a _formats or \a _numFormats was \c NULL.
29270dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The roster does not contain any translator with the
29370dc2e27SMarkus Himmel		ID \a translatorID.
29470dc2e27SMarkus Himmel*/
29570dc2e27SMarkus Himmel
29670dc2e27SMarkus Himmel/*!
29770dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::GetOutputFormats(translator_id\
29870dc2e27SMarkus Himmel		translatorID, const translation_format** _formats, int32* _numFormats);
29970dc2e27SMarkus Himmel	\brief Looks up the output formats of the translator with a given ID.
30070dc2e27SMarkus Himmel
30170dc2e27SMarkus Himmel	\param translatorID The ID of the translator whose output formats are
30270dc2e27SMarkus Himmel		requested.
30370dc2e27SMarkus Himmel	\param _formats Where the array of output formats will be stored.
30470dc2e27SMarkus Himmel	\param _numFormats Where the number of elements in the array of output
30570dc2e27SMarkus Himmel		formats will be stored.
30670dc2e27SMarkus Himmel
30770dc2e27SMarkus Himmel	Do not free any of the returned data.
30870dc2e27SMarkus Himmel
30970dc2e27SMarkus Himmel	\retval B_OK \a _formats and \a _numFormats were successfully set.
31070dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a _formats or \a _numFormats was \c NULL.
31170dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The roster does not contain any translator with the
31270dc2e27SMarkus Himmel		ID \a translatorID.
31370dc2e27SMarkus Himmel*/
31470dc2e27SMarkus Himmel
31570dc2e27SMarkus Himmel/*!
31670dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::MakeConfigurationView(\
31770dc2e27SMarkus Himmel		translator_id translatorID, BMessage* ioExtension, BView** _view,\
31870dc2e27SMarkus Himmel		BRect* _extent);
31970dc2e27SMarkus Himmel	\brief Creates the configuration view of a specified translator from the
32070dc2e27SMarkus Himmel		roster.
32170dc2e27SMarkus Himmel
32270dc2e27SMarkus Himmel	\param translatorID The ID of the translator whose configuration view
32370dc2e27SMarkus Himmel		should be created.
32470dc2e27SMarkus Himmel	\param ioExtension A message containing configuration information for the
32570dc2e27SMarkus Himmel		translator.
32670dc2e27SMarkus Himmel	\param _view Where a pointer to the newly created configuration view will
32770dc2e27SMarkus Himmel		be stored.
32870dc2e27SMarkus Himmel	\param _extent Where the size of of the newly created configuration view
32970dc2e27SMarkus Himmel		will be stored.
33070dc2e27SMarkus Himmel
33170dc2e27SMarkus Himmel	\retval B_OK Everything went well.
33270dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a _view or \a _extent were \c NULL or \a ioExtension
33370dc2e27SMarkus Himmel		was \c NULL or contained bad data.
33470dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The roster does not contain any translator with the
33570dc2e27SMarkus Himmel		ID \a translatorID.
33670dc2e27SMarkus Himmel	\retval B_ERROR An error occurred or the translator chose not to supply
33770dc2e27SMarkus Himmel		a configuration view.
33870dc2e27SMarkus Himmel*/
33970dc2e27SMarkus Himmel
34070dc2e27SMarkus Himmel/*!
34170dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::GetConfigurationMessage(\
34270dc2e27SMarkus Himmel		translator_id translatorID, BMessage* ioExtension)
34370dc2e27SMarkus Himmel	\brief Populates a BMessage with the settings of the specified translator.
34470dc2e27SMarkus Himmel
34570dc2e27SMarkus Himmel	\param translatorID The ID of the translator whose settings \a ioExtension
34670dc2e27SMarkus Himmel		should be populated with.
34770dc2e27SMarkus Himmel	\param ioExtension The message that should be populated.
34870dc2e27SMarkus Himmel
34970dc2e27SMarkus Himmel	\retval B_OK \a ioExtension was populated successfully.
35070dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The roster does not contain any translator with the
35170dc2e27SMarkus Himmel		ID \a translatorID.
35270dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a ioExtension was \c NULL.
35370dc2e27SMarkus Himmel	\retval B_ERROR An error occurred or the translator chose not to provide
35470dc2e27SMarkus Himmel		this functionality.
35570dc2e27SMarkus Himmel*/
35670dc2e27SMarkus Himmel
35770dc2e27SMarkus Himmel/*!
35870dc2e27SMarkus Himmel	\fn status_t BTranslatorRoster::GetRefFor(translator_id translatorID,\
35970dc2e27SMarkus Himmel		entry_ref* ref);
36070dc2e27SMarkus Himmel	\brief Returns the entry_ref of the specified translator.
36170dc2e27SMarkus Himmel
36270dc2e27SMarkus Himmel	\param translatorID The ID of the translator whose entry_ref is to be
36370dc2e27SMarkus Himmel		found.
36470dc2e27SMarkus Himmel	\param ref Where the entry_ref will be written.
36570dc2e27SMarkus Himmel
36670dc2e27SMarkus Himmel	\retval B_OK Everything went well.
36770dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a ref was \c NULL.
36870dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The roster does not contain any translator with the
36970dc2e27SMarkus Himmel		ID \a translatorID.
37070dc2e27SMarkus Himmel	\retval B_ERROR An error occurred.
37170dc2e27SMarkus Himmel*/
37270dc2e27SMarkus Himmel
37370dc2e27SMarkus Himmel//! @}
37470dc2e27SMarkus Himmel
37570dc2e27SMarkus Himmel/*!
37670dc2e27SMarkus Himmel	\name Core Methods
37770dc2e27SMarkus Himmel*/
37870dc2e27SMarkus Himmel
37970dc2e27SMarkus Himmel//! @{
38070dc2e27SMarkus Himmel
38170dc2e27SMarkus Himmel/*!
38270dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::Identify(BPositionIO* source,\
38370dc2e27SMarkus Himmel		BMessage* ioExtension, translator_info* _info, uint32 hintType = 0,\
38470dc2e27SMarkus Himmel		const char* hintMIME = NULL, uint32 wantType = 0);
38570dc2e27SMarkus Himmel	\brief Determines the best translator in the roster to perform a certain
38670dc2e27SMarkus Himmel		conversion.
38770dc2e27SMarkus Himmel
38870dc2e27SMarkus Himmel	\param source Read and seek interface to the data to be examined.
38970dc2e27SMarkus Himmel	\param ioExtension A message containing configuration infortmation for the
39070dc2e27SMarkus Himmel		translators.
39170dc2e27SMarkus Himmel	\param _info Where information about the best translator will be written.
39270dc2e27SMarkus Himmel	\param hintType A hint about the data format in \a source. \c 0 represents
39370dc2e27SMarkus Himmel		an unknown type.
39470dc2e27SMarkus Himmel	\param hintMIME A hint about the MIME type of \a source. \c NULL represents
39570dc2e27SMarkus Himmel		an unknown type.
39670dc2e27SMarkus Himmel	\param wantType The format that \a source needs to be translated into. \c 0
39770dc2e27SMarkus Himmel		permits any output type.
39870dc2e27SMarkus Himmel
39970dc2e27SMarkus Himmel	To determine the best translator, for all translators that report that
40070dc2e27SMarkus Himmel	they are able to perform the translation, the values they return for
40170dc2e27SMarkus Himmel	quality and capability are multiplied. The translator with the highest
40270dc2e27SMarkus Himmel	value gets returned. Note that quality and capability for the output
40370dc2e27SMarkus Himmel	format are not taken into consideration.
40470dc2e27SMarkus Himmel
40570dc2e27SMarkus Himmel	\retval B_OK Identification was successful. Information about the chosen
40670dc2e27SMarkus Himmel		translator was written to \a _info.
40770dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR No suitable translator was found.
40870dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a source or \a _info was \c NULL.
40970dc2e27SMarkus Himmel	\retval B_IO_ERROR There was an error interacting with \a source.
41070dc2e27SMarkus Himmel*/
41170dc2e27SMarkus Himmel
41270dc2e27SMarkus Himmel/*!
41370dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::Translate(BPositionIO* source,\
41470dc2e27SMarkus Himmel		const translator_info* info, BMessage* ioExtension, BPositionIO*\
41570dc2e27SMarkus Himmel		destination, uint32 wantOutType, uint32 hintType = 0, const char*\
41670dc2e27SMarkus Himmel		hintMIME = NULL);
41770dc2e27SMarkus Himmel	\brief Finds and invokes the best translator for a conversion.
41870dc2e27SMarkus Himmel
41970dc2e27SMarkus Himmel	\param source Read and seek interface to the input data.
42070dc2e27SMarkus Himmel	\param info Information about wich translator should be used. If
42170dc2e27SMarkus Himmel		\a info is \c NULL, Identify() will be used to find a suitable
42270dc2e27SMarkus Himmel		translator.
42370dc2e27SMarkus Himmel	\param ioExtension A message containing configuration information for the
42470dc2e27SMarkus Himmel		translator.
42570dc2e27SMarkus Himmel	\param destination Write interface to the output location.
42670dc2e27SMarkus Himmel	\param wantOutType The desired output format. If this is \c 0, any type
42770dc2e27SMarkus Himmel		is permitted.
42870dc2e27SMarkus Himmel	\param hintType A hint about the type of the data in \a source.
42970dc2e27SMarkus Himmel	\param hintMIME A hint about the MIME type of the data in \a source.
43070dc2e27SMarkus Himmel
43170dc2e27SMarkus Himmel	\retval B_OK The translated data was successfully written to
43270dc2e27SMarkus Himmel		\a destination.
433*a8081885SNiels Sascha Reedijk	\retval B_NO_TRANSLATOR When \a info was non-null, it did not match to any
434*a8081885SNiels Sascha Reedijk		translator in the roster. If \a info was \c NULL, then no suitable
435*a8081885SNiels Sascha Reedijk		translator was found.
43670dc2e27SMarkus Himmel	\retval B_ERROR An error occurred.
43770dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a source or \a destination was \c NULL or
43870dc2e27SMarkus Himmel		\a ioExtension was \c NULL or contained bad data.
43970dc2e27SMarkus Himmel	\retval B_IO_ERROR An error occurred accessing \a source or \a destination.
44070dc2e27SMarkus Himmel*/
44170dc2e27SMarkus Himmel
44270dc2e27SMarkus Himmel/*!
44370dc2e27SMarkus Himmel	\fn virtual status_t BTranslatorRoster::Translate(translator_id\
44470dc2e27SMarkus Himmel		translatorID, BPositionIO* source, BMessage* ioExtension, BPositionIO*\
44570dc2e27SMarkus Himmel		destination, uint32 wantOutType);
44670dc2e27SMarkus Himmel	\brief Uses a specified translator from the roster to perform a conversion.
44770dc2e27SMarkus Himmel
44870dc2e27SMarkus Himmel	\param translatorID The ID of the translator that should be used.
44970dc2e27SMarkus Himmel	\param source Read and seek interface to the input data.
45070dc2e27SMarkus Himmel	\param ioExtension A message containing configuration information for the
45170dc2e27SMarkus Himmel		translator.
45270dc2e27SMarkus Himmel	\param destination Write interface to the output location.
45370dc2e27SMarkus Himmel	\param wantOutType The desired output format. If this is \c 0, any type is
45470dc2e27SMarkus Himmel		permitted.
45570dc2e27SMarkus Himmel
45670dc2e27SMarkus Himmel	\retval B_OK The translated data was successfully written to
45770dc2e27SMarkus Himmel		\a destination.
45870dc2e27SMarkus Himmel	\retval B_NO_TRANSLATOR The specified translator cannot handle the data in
45970dc2e27SMarkus Himmel		\a source.
46070dc2e27SMarkus Himmel	\retval B_ERROR An error occurred.
46170dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a source or \a destination was \c NULL or
46270dc2e27SMarkus Himmel		\a ioExtension was \c NULL or contained bad data.
46370dc2e27SMarkus Himmel	\retval B_IO_ERROR An error occurred accessing \a source or \a destination.
46470dc2e27SMarkus Himmel*/
46570dc2e27SMarkus Himmel
46670dc2e27SMarkus Himmel//! @}
46770dc2e27SMarkus Himmel
46870dc2e27SMarkus Himmel/*!
46970dc2e27SMarkus Himmel	\name Miscellaneous
47070dc2e27SMarkus Himmel*/
47170dc2e27SMarkus Himmel
47270dc2e27SMarkus Himmel//! @{
47370dc2e27SMarkus Himmel
47470dc2e27SMarkus Himmel/*!
47570dc2e27SMarkus Himmel	\fn bool BTranslatorRoster::IsTranslator(entry_ref* ref);
47670dc2e27SMarkus Himmel	\brief Determines whether the specified add-on contains at least one
47770dc2e27SMarkus Himmel		translator.
47870dc2e27SMarkus Himmel
47970dc2e27SMarkus Himmel	\param ref The entry_ref to be tested.
48070dc2e27SMarkus Himmel
48170dc2e27SMarkus Himmel	\retval true The add-on exposes translators.
48270dc2e27SMarkus Himmel	\retval false The add-on exposes no translators or an error occurred.
48370dc2e27SMarkus Himmel*/
48470dc2e27SMarkus Himmel
48570dc2e27SMarkus Himmel//! @}
48670dc2e27SMarkus Himmel
48770dc2e27SMarkus Himmel/*!
48870dc2e27SMarkus Himmel	\name Notifications
48970dc2e27SMarkus Himmel*/
49070dc2e27SMarkus Himmel
49170dc2e27SMarkus Himmel//! @{
49270dc2e27SMarkus Himmel
49370dc2e27SMarkus Himmel/*!
49470dc2e27SMarkus Himmel	\fn status_t BTranslatorRoster::StartWatching(BMessenger target);
49570dc2e27SMarkus Himmel	\brief Register a messenger to be notified when the roster changes.
49670dc2e27SMarkus Himmel
49770dc2e27SMarkus Himmel	\param target The BMessenger to be registered.
49870dc2e27SMarkus Himmel
49970dc2e27SMarkus Himmel	Whenever a translator is added to or removed from the roster, all
50070dc2e27SMarkus Himmel	messengers that were registered through this method are sent a message.
50170dc2e27SMarkus Himmel	\c message->what will be \c B_TRANSLATOR_ADDED or \c B_TRANSLATOR_REMOVED
50270dc2e27SMarkus Himmel	(as defined in AppDefs.h) respectively.
50370dc2e27SMarkus Himmel
50470dc2e27SMarkus Himmel	\retval B_OK \a target was successfully registered.
50570dc2e27SMarkus Himmel	\retval B_NO_MEMORY Unable to allocate more memory for the list of targets.
50670dc2e27SMarkus Himmel*/
50770dc2e27SMarkus Himmel
50870dc2e27SMarkus Himmel/*!
50970dc2e27SMarkus Himmel	\fn status_t BTranslatorRoster::StopWatching(BMessenger target);
51070dc2e27SMarkus Himmel	\brief Unregister a messenger from the notification list.
51170dc2e27SMarkus Himmel
51270dc2e27SMarkus Himmel	\param target The BMessenger to be removed.
51370dc2e27SMarkus Himmel
51470dc2e27SMarkus Himmel	\retval B_OK \a target was successfully unsubscribed.
51570dc2e27SMarkus Himmel	\retval B_BAD_VALUE \a target could not be found on the notification list.
51670dc2e27SMarkus Himmel
51770dc2e27SMarkus Himmel	\sa StartWatching(BMessenger target)
51870dc2e27SMarkus Himmel*/
51970dc2e27SMarkus Himmel
52070dc2e27SMarkus Himmel//! @}
521