2002-07-26 11:47:07 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// This software is part of the OpenBeOS distribution and is covered
|
2017-02-10 06:03:59 +03:00
|
|
|
// by the MIT License.
|
2002-07-26 11:47:07 +04:00
|
|
|
//---------------------------------------------------------------------
|
|
|
|
/*!
|
|
|
|
\file sniffer/Rule.h
|
|
|
|
Mime sniffer rule declarations
|
|
|
|
*/
|
2002-08-12 11:24:02 +04:00
|
|
|
#ifndef _SNIFFER_RULE_H
|
|
|
|
#define _SNIFFER_RULE_H
|
2002-07-26 11:47:07 +04:00
|
|
|
|
2002-08-06 12:32:27 +04:00
|
|
|
#include <SupportDefs.h>
|
2002-09-24 09:27:46 +04:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
2002-07-29 11:03:23 +04:00
|
|
|
#include <vector>
|
2002-07-26 11:47:07 +04:00
|
|
|
|
2002-08-06 12:32:27 +04:00
|
|
|
class BPositionIO;
|
|
|
|
|
2002-08-12 12:42:01 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
namespace Storage {
|
2002-07-26 11:47:07 +04:00
|
|
|
namespace Sniffer {
|
|
|
|
|
2002-08-10 13:36:00 +04:00
|
|
|
class DisjList;
|
2002-07-26 11:47:07 +04:00
|
|
|
|
2002-08-08 11:21:31 +04:00
|
|
|
/*! \brief A priority and a list of expressions to be used for sniffing out the
|
|
|
|
type of an untyped file.
|
|
|
|
*/
|
2002-07-26 11:47:07 +04:00
|
|
|
class Rule {
|
|
|
|
public:
|
|
|
|
Rule();
|
2002-07-29 11:03:23 +04:00
|
|
|
~Rule();
|
2002-08-06 12:32:27 +04:00
|
|
|
|
2002-09-24 09:27:46 +04:00
|
|
|
status_t InitCheck() const;
|
2002-08-06 12:32:27 +04:00
|
|
|
double Priority() const;
|
|
|
|
bool Sniff(BPositionIO *data) const;
|
2002-09-24 09:27:46 +04:00
|
|
|
ssize_t BytesNeeded() const;
|
2002-07-26 11:47:07 +04:00
|
|
|
private:
|
2002-07-29 11:03:23 +04:00
|
|
|
friend class Parser;
|
|
|
|
|
|
|
|
void Unset();
|
2002-08-10 13:36:00 +04:00
|
|
|
void SetTo(double priority, std::vector<DisjList*>* list);
|
2002-07-29 11:03:23 +04:00
|
|
|
|
|
|
|
double fPriority;
|
2002-08-10 13:36:00 +04:00
|
|
|
std::vector<DisjList*> *fConjList; // A list of DisjLists to be ANDed
|
2002-07-26 11:47:07 +04:00
|
|
|
};
|
|
|
|
|
2002-08-12 12:42:01 +04:00
|
|
|
}; // namespace Sniffer
|
|
|
|
}; // namespace Storage
|
|
|
|
}; // namespace BPrivate
|
|
|
|
|
|
|
|
#endif // _SNIFFER_RULE_H
|
|
|
|
|
2002-07-26 11:47:07 +04:00
|
|
|
|