tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / kits / translation / TranslatorRosterPrivate.h
blobdac2c01ef1cec43b50f9f31624f3406cfb1b7f60
1 /*
2 * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Author:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
8 #ifndef TRANSLATOR_ROSTER_PRIVATE_H
9 #define TRANSLATOR_ROSTER_PRIVATE_H
11 #include <map>
12 #include <set>
13 #include <vector>
15 #include <Entry.h>
16 #include <Handler.h>
17 #include <Locker.h>
18 #include <Messenger.h>
19 #include <TranslatorRoster.h>
22 struct translator_data;
25 struct translator_item {
26 BTranslator* translator;
27 entry_ref ref;
28 ino_t node;
29 image_id image;
32 typedef std::map<translator_id, translator_item> TranslatorMap;
33 typedef std::vector<BMessenger> MessengerList;
34 typedef std::vector<node_ref> NodeRefList;
35 typedef std::set<entry_ref> EntryRefSet;
38 class BTranslatorRoster::Private : public BHandler, public BLocker {
39 public:
40 Private();
41 virtual ~Private();
43 virtual void MessageReceived(BMessage* message);
45 void AddDefaultPaths();
46 status_t AddPaths(const char* paths);
47 status_t AddPath(const char* path, int32* _added = NULL);
48 status_t AddTranslator(BTranslator* translator,
49 image_id image = -1,
50 const entry_ref* ref = NULL,
51 ino_t node = 0);
53 void RemoveTranslators(entry_ref& ref);
55 BTranslator* FindTranslator(translator_id id);
57 status_t StoreTranslators(BMessage& archive);
58 status_t Identify(BPositionIO* source,
59 BMessage* ioExtension, uint32 hintType,
60 const char* hintMIME, uint32 wantType,
61 translator_info* _info);
63 status_t GetTranslators(BPositionIO* source,
64 BMessage* ioExtension, uint32 hintType,
65 const char* hintMIME, uint32 wantType,
66 translator_info** _info, int32* _numInfo);
67 status_t GetAllTranslators(translator_id** _ids,
68 int32* _count);
69 status_t GetRefFor(translator_id id, entry_ref& ref);
71 bool IsActive() const { return Looper(); }
73 status_t CreateTranslators(const entry_ref& ref,
74 int32& count, BMessage* update = NULL);
75 status_t GetTranslatorData(image_id image,
76 translator_data& data);
78 status_t StartWatching(BMessenger target);
79 status_t StopWatching(BMessenger target);
81 void TranslatorDeleted(translator_id id);
83 private:
84 static int _CompareSupport(const void* _a, const void* _b);
86 void _RescanChanged();
88 const translation_format* _CheckHints(
89 const translation_format* formats,
90 int32 formatsCount, uint32 hintType,
91 const char* hintMIME);
93 const translator_item* _FindTranslator(translator_id id) const;
94 const translator_item* _FindTranslator(const char* name) const;
95 const translator_item* _FindTranslator(entry_ref& ref) const;
96 translator_item* _FindTranslator(node_ref& nodeRef);
98 int32 _CompareTranslatorDirectoryPriority(
99 const entry_ref& a,
100 const entry_ref& b) const;
101 bool _IsKnownDirectory(const node_ref& nodeRef)
102 const;
104 void _RemoveTranslators(const node_ref* nodeRef,
105 const entry_ref* ref = NULL);
106 void _EntryAdded(const node_ref& nodeRef,
107 const char* name);
108 void _EntryAdded(const entry_ref& ref);
109 void _NotifyListeners(BMessage& update) const;
111 NodeRefList fDirectories;
112 TranslatorMap fTranslators;
113 MessengerList fMessengers;
114 EntryRefSet fRescanEntries;
115 const char* fABISubDirectory;
116 int32 fNextID;
117 bool fLazyScanning;
118 bool fSafeMode;
122 #endif // TRANSLATOR_ROSTER_PRIVATE_H