1//---------------------------------------------------------------------- 2// This software is part of the Haiku 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 17class BPositionIO; 18 19namespace BPrivate { 20namespace Storage { 21namespace Sniffer { 22 23class 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*/ 28class Rule { 29public: 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; 37private: 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