Make UEFI boot-platform build again
[haiku.git] / headers / private / storage / sniffer / Pattern.h
blobeec4e635986ec65874afa69e0ea9ec17029cfbfb
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //---------------------------------------------------------------------
5 /*!
6 \file sniffer/Pattern.h
7 Mime Sniffer Pattern declarations
8 */
9 #ifndef _SNIFFER_PATTERN_H
10 #define _SNIFFER_PATTERN_H
12 #include <SupportDefs.h>
13 #include <string>
14 #include <sniffer/Range.h>
16 class BPositionIO;
18 namespace BPrivate {
19 namespace Storage {
20 namespace Sniffer {
22 class Err;
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. */
26 class Pattern {
27 public:
28 Pattern(const std::string &string, const std::string &mask);
29 Pattern(const std::string &string);
30 ~Pattern();
32 status_t InitCheck() const;
33 Err* GetErr() 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);
39 private:
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);
45 std::string fString;
46 std::string fMask;
48 status_t fCStatus;
49 Err *fErrorMessage;
52 }; // namespace Sniffer
53 }; // namespace Storage
54 }; // namespace BPrivate
56 #endif // _SNIFFER_PATTERN_H