xref: /haiku/headers/os/translation/TranslatorRoster.h (revision ed6250c95736c0b55da79d6e9dd01369532260c0)
1 /*
2  * Copyright 2002-2007, 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 struct translation_format;
13 
14 class BBitmap;
15 class BMessage;
16 class BMessenger;
17 class BPositionIO;
18 class BQuery;
19 class BRect;
20 class BTranslator;
21 class BView;
22 struct entry_ref;
23 
24 
25 class BTranslatorRoster : public BArchivable {
26 	public:
27 		BTranslatorRoster();
28 		BTranslatorRoster(BMessage* model);
29 		virtual ~BTranslatorRoster();
30 
31 		static BTranslatorRoster *Default();
32 
33 		virtual status_t Archive(BMessage* into, bool deep = true) const;
34 		static BArchivable* Instantiate(BMessage* from);
35 
36 		status_t AddTranslators(const char* loadPath = NULL);
37 		status_t AddTranslator(BTranslator* translator);
38 
39 		virtual status_t Identify(BPositionIO* source, BMessage* ioExtension,
40 			translator_info* _info, uint32 hintType = 0,
41 			const char* hintMIME = NULL, uint32 wantType = 0);
42 
43 		virtual status_t GetTranslators(BPositionIO* source,
44 			BMessage* ioExtension, translator_info** _info, int32* _numInfo,
45 			uint32 hintType = 0, const char* hintMIME = NULL,
46 			uint32 wantType = 0);
47 
48 		virtual status_t GetAllTranslators(translator_id** _list,
49 			int32* _count);
50 
51 		virtual	status_t GetTranslatorInfo(translator_id translatorID,
52 			const char** _name, const char** _info, int32* _version);
53 
54 		virtual status_t GetInputFormats(translator_id translatorID,
55 			const translation_format** _formats, int32* _numFormats);
56 
57 		virtual	status_t GetOutputFormats(translator_id translatorID,
58 			const translation_format** _formats, int32* _numFormats);
59 
60 		virtual	status_t Translate(BPositionIO* source,
61 			const translator_info* info, BMessage* ioExtension,
62 			BPositionIO* destination, uint32 wantOutType,
63 			uint32 hintType = 0, const char* hintMIME = NULL);
64 
65 		virtual	status_t Translate(translator_id translatorID,
66 			BPositionIO* source, BMessage* ioExtension,
67 			BPositionIO* destination, uint32 wantOutType);
68 
69 		virtual status_t MakeConfigurationView(translator_id translatorID,
70 			BMessage* ioExtension, BView** _view, BRect* _extent);
71 
72 		virtual	status_t GetConfigurationMessage(translator_id translatorID,
73 			BMessage* ioExtension);
74 
75 		status_t GetRefFor(translator_id translatorID, entry_ref* ref);
76 		bool IsTranslator(entry_ref* ref);
77 
78 		status_t StartWatching(BMessenger target);
79 		status_t StopWatching(BMessenger target);
80 
81 		class Private;
82 
83 	private:
84 		// unimplemented
85 		BTranslatorRoster(const BTranslatorRoster& other);
86 		BTranslatorRoster& operator=(const BTranslatorRoster& other);
87 
88 		virtual	void ReservedTranslatorRoster1();
89 		virtual	void ReservedTranslatorRoster2();
90 		virtual	void ReservedTranslatorRoster3();
91 		virtual	void ReservedTranslatorRoster4();
92 		virtual	void ReservedTranslatorRoster5();
93 		virtual	void ReservedTranslatorRoster6();
94 
95 		void _Initialize();
96 
97 	private:
98 		friend class Private;
99 
100 		Private*	fPrivate;
101 		int32		fUnused[6];
102 
103 		static BTranslatorRoster* sDefaultRoster;
104 };
105 
106 #endif	/* _TRANSLATOR_ROSTER_H */
107