1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
4 //---------------------------------------------------------------------
6 \file sniffer/Pattern.h
7 Mime Sniffer Pattern declarations
9 #ifndef _SNIFFER_PATTERN_H
10 #define _SNIFFER_PATTERN_H
12 #include <SupportDefs.h>
14 #include <sniffer/Range.h>
24 //! A byte string and optional mask to be compared against a data stream.
25 /*! The byte string and mask (if supplied) must be of the same length. */
28 Pattern(const std::string
&string
, const std::string
&mask
);
29 Pattern(const std::string
&string
);
32 status_t
InitCheck() const;
35 bool Sniff(Range range
, BPositionIO
*data
, bool caseInsensitive
) const;
36 ssize_t
BytesNeeded() const;
38 status_t
SetTo(const std::string
&string
, const std::string
&mask
);
40 bool Sniff(off_t start
, off_t size
, BPositionIO
*data
, bool caseInsensitive
) const;
42 void SetStatus(status_t status
, const char *msg
= NULL
);
43 void SetErrorMessage(const char *msg
);
52 }; // namespace Sniffer
53 }; // namespace Storage
54 }; // namespace BPrivate
56 #endif // _SNIFFER_PATTERN_H