1 //---------------------------------------------------------------------- 2 // This software is part of the OpenBeOS distribution and is covered 3 // by the MIT License. 4 //--------------------------------------------------------------------- 5 /*! 6 \file sniffer/PatternList.h 7 MIME sniffer pattern list declarations 8 */ 9 #ifndef _SNIFFER_PATTERN_LIST_H 10 #define _SNIFFER_PATTERN_LIST_H 11 12 #include <sniffer/DisjList.h> 13 #include <sniffer/Range.h> 14 #include <vector> 15 16 class BPositionIO; 17 18 namespace BPrivate { 19 namespace Storage { 20 namespace Sniffer { 21 22 class Err; 23 class Pattern; 24 25 /*! \brief A list of patterns, one of which must match for the list to match, all 26 of which are to be searched over the same range. 27 */ 28 class PatternList : public DisjList { 29 public: 30 PatternList(Range range); 31 virtual ~PatternList(); 32 33 status_t InitCheck() const; 34 Err* GetErr() const; 35 36 virtual bool Sniff(BPositionIO *data) const; 37 virtual ssize_t BytesNeeded() const; 38 39 void Add(Pattern *pattern); 40 private: 41 std::vector<Pattern*> fList; 42 Range fRange; 43 }; 44 45 }; // namespace Sniffer 46 }; // namespace Storage 47 }; // namespace BPrivate 48 49 #endif // _SNIFFER_PATTERN_LIST_H 50 51 52