1 /* 2 * Copyright 2002-2009, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _TRANSLATOR_ROSTER_H 6 #define _TRANSLATOR_ROSTER_H 7 8 9 #include <Archivable.h> 10 #include <TranslationDefs.h> 11 12 13 struct translation_format; 14 15 class BBitmap; 16 class BMessage; 17 class BMessenger; 18 class BPositionIO; 19 class BQuery; 20 class BRect; 21 class BTranslator; 22 class BView; 23 struct entry_ref; 24 25 26 class BTranslatorRoster : public BArchivable { 27 public: 28 BTranslatorRoster(); 29 BTranslatorRoster(BMessage* model); 30 virtual ~BTranslatorRoster(); 31 32 static BTranslatorRoster* Default(); 33 34 virtual status_t Archive(BMessage* into, bool deep = true) const; 35 static BArchivable* Instantiate(BMessage* from); 36 37 status_t AddTranslators(const char* loadPath = NULL); 38 status_t AddTranslator(BTranslator* translator); 39 40 virtual status_t Identify(BPositionIO* source, 41 BMessage* ioExtension, 42 translator_info* _info, uint32 hintType = 0, 43 const char* hintMIME = NULL, 44 uint32 wantType = 0); 45 46 virtual status_t GetTranslators(BPositionIO* source, 47 BMessage* ioExtension, 48 translator_info** _info, int32* _numInfo, 49 uint32 hintType = 0, 50 const char* hintMIME = NULL, 51 uint32 wantType = 0); 52 53 virtual status_t GetAllTranslators(translator_id** _list, 54 int32* _count); 55 56 virtual status_t GetTranslatorInfo(translator_id translatorID, 57 const char** _name, const char** _info, 58 int32* _version); 59 60 virtual status_t GetInputFormats(translator_id translatorID, 61 const translation_format** _formats, 62 int32* _numFormats); 63 64 virtual status_t GetOutputFormats(translator_id translatorID, 65 const translation_format** _formats, 66 int32* _numFormats); 67 68 virtual status_t Translate(BPositionIO* source, 69 const translator_info* info, 70 BMessage* ioExtension, 71 BPositionIO* destination, 72 uint32 wantOutType, uint32 hintType = 0, 73 const char* hintMIME = NULL); 74 75 virtual status_t Translate(translator_id translatorID, 76 BPositionIO* source, BMessage* ioExtension, 77 BPositionIO* destination, 78 uint32 wantOutType); 79 80 virtual status_t MakeConfigurationView( 81 translator_id translatorID, 82 BMessage* ioExtension, BView** _view, 83 BRect* _extent); 84 85 virtual status_t GetConfigurationMessage( 86 translator_id translatorID, 87 BMessage* ioExtension); 88 89 status_t GetRefFor(translator_id translatorID, 90 entry_ref* ref); 91 bool IsTranslator(entry_ref* ref); 92 93 status_t StartWatching(BMessenger target); 94 status_t StopWatching(BMessenger target); 95 96 class Private; 97 98 private: 99 // unimplemented 100 BTranslatorRoster( 101 const BTranslatorRoster& other); 102 BTranslatorRoster& operator=(const BTranslatorRoster& other); 103 104 virtual void ReservedTranslatorRoster1(); 105 virtual void ReservedTranslatorRoster2(); 106 virtual void ReservedTranslatorRoster3(); 107 virtual void ReservedTranslatorRoster4(); 108 virtual void ReservedTranslatorRoster5(); 109 virtual void ReservedTranslatorRoster6(); 110 111 void _Initialize(); 112 113 static const char* Version(int32* outCurVersion, 114 int32* outMinVersion, 115 int32 inAppVersion); 116 // for backward compatiblity only 117 118 private: 119 friend class Private; 120 121 Private* fPrivate; 122 int32 fUnused[6]; 123 124 static BTranslatorRoster* sDefaultRoster; 125 }; 126 127 128 #endif // _TRANSLATOR_ROSTER_H 129