btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / sniffer / Err.h
blob69c176145ca6c72f513f016acda654302836ba86
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //---------------------------------------------------------------------
5 /*!
6 \file sniffer/Err.h
7 Mime Sniffer Error class declarations
8 */
9 #ifndef _SNIFFER_ERR_H
10 #define _SNIFFER_ERR_H
12 #include <SupportDefs.h>
13 #include <string>
15 namespace BPrivate {
16 namespace Storage {
17 namespace Sniffer {
19 //! Exception class used by the MIME Sniffer
20 /*! Each exception contains an error message, and an byte offset into
21 the original rule that generated the error, for the sake of
22 providing spiffy error messages of the following sort:
24 <code>
25 "1.0 ('abc' & 0xFFAAFFAA)"
26 ^ Sniffer pattern error: pattern and mask lengths do not match
27 </code>
29 class Err {
30 public:
31 Err(const char *msg, const ssize_t pos);
32 Err(const std::string &msg, const ssize_t pos);
33 Err(const Err &ref);
34 virtual ~Err();
35 Err& operator=(const Err &ref);
37 status_t SetTo(const char *msg, const ssize_t pos);
38 status_t SetTo(const std::string &msg, const ssize_t pos);
39 void Unset();
41 void SetMsg(const char *msg);
42 void SetPos(ssize_t pos);
44 const char* Msg() const;
45 ssize_t Pos() const;
47 private:
48 char *fMsg;
49 ssize_t fPos;
52 }; // namespace Sniffer
53 }; // namespace Storage
54 }; // namespace BPrivate
56 #endif // _SNIFFER_ERR_H