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