f90e454336
class, and only wraps around that one. * Translating is no longer serialized, you can translate more than one object at a time now. * A BTranslator that is released (ie. deleted) will no longer let its BTranslatorRoster crash. * Removed BTranslatorRoster::Version() - this kind of call definitely makes no sense at all. It's still exported from the sources, though, for backwards compatibility. * Simplified and improved code. * Images are now unloaded only once. * Added new method IsTranslator() that will be used by the DataTranslations preferences application. * Began implementing new methods StartWatching()/StopWatching() that will notify you if new translators are installed or old ones removed (this will also be used by DataTranslations once it's ready). * The private BTranslatorRoster class will now add itself to the existing BApplication, in order to provide automatic updating of the translators if needed (not yet implemented though). * Not heavily tested yet, there might be some regressions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17247 a95241bf-73f2-0310-859d-f6bbb57e9c96
76 lines
2.5 KiB
C++
76 lines
2.5 KiB
C++
/*
|
|
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _TRANSLATOR_H
|
|
#define _TRANSLATOR_H
|
|
|
|
|
|
#include <Archivable.h>
|
|
#include <TranslationDefs.h>
|
|
#include <TranslatorRoster.h>
|
|
|
|
|
|
class BTranslator : public BArchivable {
|
|
public:
|
|
BTranslator();
|
|
|
|
BTranslator* Acquire();
|
|
BTranslator* Release();
|
|
|
|
int32 ReferenceCount();
|
|
// returns the refcount, THIS IS NOT THREAD SAFE, ITS ONLY FOR "FUN"
|
|
|
|
virtual const char *TranslatorName() const = 0;
|
|
virtual const char *TranslatorInfo() const = 0;
|
|
virtual int32 TranslatorVersion() const = 0;
|
|
|
|
virtual const translation_format *InputFormats(int32 *out_count)
|
|
const = 0;
|
|
virtual const translation_format *OutputFormats(int32 *out_count)
|
|
const = 0;
|
|
virtual status_t Identify(BPositionIO *inSource,
|
|
const translation_format *inFormat, BMessage *ioExtension,
|
|
translator_info *outInfo, uint32 outType) = 0;
|
|
virtual status_t Translate(BPositionIO *inSource,
|
|
const translator_info *inInfo, BMessage *ioExtension,
|
|
uint32 outType, BPositionIO *outDestination) = 0;
|
|
virtual status_t MakeConfigurationView(BMessage *ioExtension,
|
|
BView **outView, BRect *outExtent);
|
|
virtual status_t GetConfigurationMessage(BMessage *ioExtension);
|
|
|
|
protected:
|
|
virtual ~BTranslator();
|
|
// this is protected because the object is deleted by the
|
|
// Release() function instead of being deleted directly by
|
|
// the user
|
|
|
|
private:
|
|
friend class BTranslatorRoster::Private;
|
|
|
|
virtual status_t _Reserved_Translator_0(int32, void *);
|
|
virtual status_t _Reserved_Translator_1(int32, void *);
|
|
virtual status_t _Reserved_Translator_2(int32, void *);
|
|
virtual status_t _Reserved_Translator_3(int32, void *);
|
|
virtual status_t _Reserved_Translator_4(int32, void *);
|
|
virtual status_t _Reserved_Translator_5(int32, void *);
|
|
virtual status_t _Reserved_Translator_6(int32, void *);
|
|
virtual status_t _Reserved_Translator_7(int32, void *);
|
|
|
|
BTranslatorRoster::Private* fOwningRoster;
|
|
translator_id fID;
|
|
int32 fRefCount;
|
|
|
|
uint32 _reserved[7];
|
|
};
|
|
|
|
// The post-4.5 API suggests implementing this function in your translator
|
|
// add-on rather than the separate functions and variables of the previous
|
|
// API. You will be called for values of n starting at 0 and increasing;
|
|
// return 0 when you can't make another kind of translator (i.e. for n=1
|
|
// if you only implement one subclass of BTranslator). Ignore flags for now.
|
|
extern "C" _EXPORT BTranslator *make_nth_translator(int32 n, image_id you,
|
|
uint32 flags, ...);
|
|
|
|
#endif /* _TRANSLATOR_H */
|