Added BytesNeeded() functions to all the sniffer classes to allow

a pre-read data stream to be sniffed instead of actual files on disk.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1149 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder
2002-09-24 05:27:46 +00:00
parent 2f1ee757aa
commit 2150894b73
11 changed files with 189 additions and 13 deletions
@@ -9,6 +9,8 @@
#ifndef _SNIFFER_DISJ_LIST_H
#define _SNIFFER_DISJ_LIST_H
#include <sys/types.h>
class BPositionIO;
namespace BPrivate {
@@ -20,7 +22,9 @@ class DisjList {
public:
DisjList();
virtual ~DisjList();
virtual bool Sniff(BPositionIO *data) const = 0;
virtual ssize_t BytesNeeded() const = 0;
void SetCaseInsensitive(bool how);
bool IsCaseInsensitive();
@@ -33,6 +33,7 @@ public:
Err* GetErr() const;
bool Sniff(Range range, BPositionIO *data, bool caseInsensitive) const;
ssize_t BytesNeeded() const;
status_t SetTo(const std::string &string, const std::string &mask);
private:
@@ -34,6 +34,8 @@ public:
Err* GetErr() const;
virtual bool Sniff(BPositionIO *data) const;
virtual ssize_t BytesNeeded() const;
void Add(Pattern *pattern);
private:
std::vector<Pattern*> fList;
@@ -30,6 +30,7 @@ public:
Err* GetErr() const;
bool Sniff(BPositionIO *data, bool caseInsensitive) const;
ssize_t BytesNeeded() const;
private:
Range fRange;
Pattern *fPattern;
@@ -31,6 +31,7 @@ public:
Err* GetErr() const;
virtual bool Sniff(BPositionIO *data) const;
virtual ssize_t BytesNeeded() const;
void Add(RPattern *rpattern);
private:
std::vector<RPattern*> fList;
+4 -2
View File
@@ -10,6 +10,8 @@
#define _SNIFFER_RULE_H
#include <SupportDefs.h>
#include <sys/types.h>
#include <vector>
class BPositionIO;
@@ -28,10 +30,10 @@ public:
Rule();
~Rule();
status_t InitCheck() const;
status_t InitCheck() const;
double Priority() const;
bool Sniff(BPositionIO *data) const;
ssize_t BytesNeeded() const;
private:
friend class Parser;