2002-07-26 07:47:07 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// This software is part of the OpenBeOS distribution and is covered
|
|
|
|
// by the OpenBeOS license.
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
/*!
|
|
|
|
\file sniffer/Rule.h
|
|
|
|
Mime sniffer rule declarations
|
|
|
|
*/
|
|
|
|
#ifndef _sk_sniffer_rule_h_
|
|
|
|
#define _sk_sniffer_rule_h_
|
|
|
|
|
2002-08-06 08:32:27 +00:00
|
|
|
#include <SupportDefs.h>
|
2002-07-29 07:03:23 +00:00
|
|
|
#include <vector>
|
2002-07-26 07:47:07 +00:00
|
|
|
|
2002-08-06 08:32:27 +00:00
|
|
|
class BPositionIO;
|
|
|
|
|
2002-07-26 07:47:07 +00:00
|
|
|
namespace Sniffer {
|
|
|
|
|
|
|
|
class Expr;
|
|
|
|
|
2002-08-08 07:21:31 +00:00
|
|
|
/*! \brief A priority and a list of expressions to be used for sniffing out the
|
|
|
|
type of an untyped file.
|
|
|
|
*/
|
2002-07-26 07:47:07 +00:00
|
|
|
class Rule {
|
|
|
|
public:
|
|
|
|
Rule();
|
2002-07-29 07:03:23 +00:00
|
|
|
~Rule();
|
2002-08-06 08:32:27 +00:00
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
|
|
|
double Priority() const;
|
|
|
|
bool Sniff(BPositionIO *data) const;
|
2002-07-26 07:47:07 +00:00
|
|
|
private:
|
2002-07-29 07:03:23 +00:00
|
|
|
friend class Parser;
|
|
|
|
|
|
|
|
void Unset();
|
2002-08-06 08:32:27 +00:00
|
|
|
void SetTo(double priority, std::vector<Expr*>* list);
|
2002-07-29 07:03:23 +00:00
|
|
|
|
|
|
|
double fPriority;
|
2002-08-06 08:32:27 +00:00
|
|
|
std::vector<Expr*> *fExprList;
|
2002-07-26 07:47:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _sk_sniffer_rule_h_
|