xref: /haiku/headers/private/storage/sniffer/Rule.h (revision 9642f7705b27e5c270c15fa526d14e1848c2c27d)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the MIT License.
4 //---------------------------------------------------------------------
5 /*!
6 	\file sniffer/Rule.h
7 	Mime sniffer rule declarations
8 */
9 #ifndef _SNIFFER_RULE_H
10 #define _SNIFFER_RULE_H
11 
12 #include <SupportDefs.h>
13 
14 #include <sys/types.h>
15 #include <vector>
16 
17 class BPositionIO;
18 
19 namespace BPrivate {
20 namespace Storage {
21 namespace Sniffer {
22 
23 class DisjList;
24 
25 /*! \brief A priority and a list of expressions to be used for sniffing out the
26 	type of an untyped file.
27 */
28 class Rule {
29 public:
30 	Rule();
31 	~Rule();
32 
33 	status_t InitCheck() const;
34 	double Priority() const;
35 	bool Sniff(BPositionIO *data) const;
36 	ssize_t BytesNeeded() const;
37 private:
38 	friend class Parser;
39 
40 	void Unset();
41 	void SetTo(double priority, std::vector<DisjList*>* list);
42 
43 	double fPriority;
44 	std::vector<DisjList*> *fConjList;	// A list of DisjLists to be ANDed
45 };
46 
47 };	// namespace Sniffer
48 };	// namespace Storage
49 };	// namespace BPrivate
50 
51 #endif	// _SNIFFER_RULE_H
52 
53 
54