2 * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
8 #ifndef TRANSLATOR_ROSTER_PRIVATE_H
9 #define TRANSLATOR_ROSTER_PRIVATE_H
18 #include <Messenger.h>
19 #include <TranslatorRoster.h>
22 struct translator_data
;
25 struct translator_item
{
26 BTranslator
* translator
;
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
{
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
,
50 const entry_ref
* ref
= NULL
,
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
,
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
);
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(
100 const entry_ref
& b
) const;
101 bool _IsKnownDirectory(const node_ref
& nodeRef
)
104 void _RemoveTranslators(const node_ref
* nodeRef
,
105 const entry_ref
* ref
= NULL
);
106 void _EntryAdded(const node_ref
& nodeRef
,
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
;
122 #endif // TRANSLATOR_ROSTER_PRIVATE_H