|
|
| BTranslator () |
| Creates a new BTranslator and sets its reference count to 1.
|
|
BTranslator * | Acquire () |
| Increments the reference count by 1 and returns a pointer to itself.
|
|
BTranslator * | Release () |
| Decrements the reference count by 1. If the reference count is decreased to zero, the object is deleted.
|
|
int32 | ReferenceCount () |
| Gets the current reference count.
|
|
|
virtual const char * | TranslatorName () const =0 |
| Pure virtual. Returns the name of the translator.
|
|
virtual const char * | TranslatorInfo () const =0 |
| Pure virtual. Returns a brief description of the translator.
|
|
virtual int32 | TranslatorVersion () const =0 |
| Pure virtual. Returns the version of the translator.
|
|
virtual const translation_format * | InputFormats (int32 *_count) const =0 |
| Pure virtual. Returns an array containing information about all input formats the translator can handle.
|
|
virtual const translation_format * | OutputFormats (int32 *_count) const =0 |
| Pure virtual. Returns an array containing information about all output formats the translator can produce.
|
|
|
virtual status_t | Identify (BPositionIO *source, const translation_format *format, BMessage *extension, translator_info *info, uint32 outType)=0 |
| Pure virtual. Analyzes source and decides whether this translator can work with the provided format.
|
|
virtual status_t | Translate (BPositionIO *source, const translator_info *info, BMessage *extension, uint32 outType, BPositionIO *destination)=0 |
| Pure virtual. Reads the provided data and tries to translate it to a given format.
|
|
|
virtual status_t | MakeConfigurationView (BMessage *extension, BView **_view, BRect *_extent) |
| Virtual. Creates a BView that contains information and configuration options for the translator.
|
|
virtual status_t | GetConfigurationMessage (BMessage *extension) |
| Populates a BMessage with the settings of the translator.
|
|
| BArchivable () |
| Constructor. Does nothing.
|
|
| BArchivable (BMessage *from) |
| Constructor. Does important behind-the-scenes work in the unarchiving process.
|
|
virtual | ~BArchivable () |
| Destructor. Does nothing.
|
|
virtual status_t | AllArchived (BMessage *archive) const |
| Method relating to the use of BArchiver .
|
|
virtual status_t | AllUnarchived (const BMessage *archive) |
| Method relating to the use of BUnarchiver .
|
|
virtual status_t | Archive (BMessage *into, bool deep=true) const |
| Archive the object into a BMessage.
|
|
virtual status_t | Perform (perform_code d, void *arg) |
| Perform some action (Internal method defined for binary compatibility purposes).
|
|
Abstract class that defines the necessary functionality of a translator.
BTranslator is the core class of the translation kit. Every translator defines input and output data types it can work with. A BTranslator uses BPositionIO as an abstraction for the data it operates on. It is able to decide wether incoming data is of any of its known input types and, upon successful identification, translate it to any of its output formats. It may also provide a config view that appears in the DataTranslations preference app.
Usually, a translator is very specific. It only offers translations between the format it was created for and the basic format for that media type. As an example, the translator for GIF images only translates between GIF images and bitmaps, the baseline format for images.
The function make_nth_translator
enables add-ons to expose translators. Communication between applications and BTranslators is carried out by the BTranslatorRoster class.
- Note
- Another option to create a translator is using a BFuncTranslator.
- Since
- BeOS R3
Pure virtual. Analyzes source and decides whether this translator can work with the provided format.
The translator examines the data in source and tries to identify its format (for instance by checking for magic numbers). It may use the hints provided by format. If it is successful, and it is able to translate the data at hand to outType, it populates info with information about the input format and returns B_OK
. If it is unable to identify the data or cannot translate it to outType, it returns B_NO_TRANSLATOR
.
- Parameters
-
source | Read and seek interface to the input data. |
format | Hints about the incoming data. |
extension | A message containing configuration information for the translator. A standard set of possible fields is defined in TranslatorFormats.h. |
info | Where the translator will write information about the determined input format in case identification is successful. |
outType | If outType is non-zero, identification will only be successful if the translator can transform the data in source to the format denoted by outType. |
- Warning
- When creating a translator, be prepared for the information in format to be inaccurate or wrong.
- Return values
-
B_OK | The translator has identified the data in source, has verified its ability to translate it to outType and has written information describing it to info. |
B_NO_TRANSLATOR | The translator does not know how to handle the data in source or cannot translate it to outType. |
B_BAD_VALUE | extension was NULL or contained bad data. |
B_ERROR | An error occurred. |
- Since
- BeOS R3