HaikuDepot: notify work status from main window
[haiku.git] / src / apps / expander / ExpanderRules.h
blob4c17a8c66dbd125733fa7f001363cb371909c97c
1 /*
2 * Copyright 2004-2006, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #ifndef _EXPANDER_RULES_H
8 #define _EXPANDER_RULES_H
10 #include <File.h>
11 #include <FilePanel.h>
12 #include <List.h>
13 #include <Mime.h>
14 #include <String.h>
17 class ExpanderRule {
18 public:
19 ExpanderRule(const char* mimetype,
20 const BString& filenameExtension,
21 const BString& listingCommand,
22 const BString& expandCommand);
24 const BMimeType& MimeType() const
25 { return fMimeType; }
26 const BString& FilenameExtension() const
27 { return fFilenameExtension; }
28 const BString& ListingCmd() const
29 { return fListingCmd; }
30 const BString& ExpandCmd() const
31 { return fExpandCmd; }
33 private:
34 BMimeType fMimeType;
35 BString fFilenameExtension;
36 BString fListingCmd;
37 BString fExpandCmd;
41 class ExpanderRules {
42 public:
43 ExpanderRules();
44 ~ExpanderRules();
46 ExpanderRule* MatchingRule(BString& fileName,
47 const char* filetype);
48 ExpanderRule* MatchingRule(const entry_ref* ref);
50 private:
51 void _LoadRulesFiles();
52 void _LoadRulesFile(const char* path);
54 bool _AddRule(const char* mimetype,
55 const BString& filenameExtension,
56 const BString& listingCommand,
57 const BString& expandCommand);
59 private:
60 BList fList;
64 class RuleRefFilter : public BRefFilter {
65 public:
66 RuleRefFilter(ExpanderRules& rules);
67 bool Filter(const entry_ref* ref, BNode* node,
68 struct stat_beos* stat,
69 const char* filetype);
71 protected:
72 ExpanderRules& fRules;
76 #endif // _EXPANDER_RULES_H