2002-08-06 12:25:41 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// This software is part of the OpenBeOS distribution and is covered
|
2017-02-10 06:03:59 +03:00
|
|
|
// by the MIT License.
|
2002-08-06 12:25:41 +04:00
|
|
|
//---------------------------------------------------------------------
|
|
|
|
/*!
|
|
|
|
\file sniffer/Err.h
|
|
|
|
Mime Sniffer Error class declarations
|
|
|
|
*/
|
2002-08-12 11:24:02 +04:00
|
|
|
#ifndef _SNIFFER_ERR_H
|
|
|
|
#define _SNIFFER_ERR_H
|
2002-08-06 12:25:41 +04:00
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <string>
|
|
|
|
|
2002-08-12 12:42:01 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
namespace Storage {
|
2002-08-06 12:25:41 +04:00
|
|
|
namespace Sniffer {
|
|
|
|
|
|
|
|
//! Exception class used by the MIME Sniffer
|
2002-08-08 11:20:47 +04:00
|
|
|
/*! Each exception contains an error message, and an byte offset into
|
|
|
|
the original rule that generated the error, for the sake of
|
|
|
|
providing spiffy error messages of the following sort:
|
|
|
|
|
|
|
|
<code>
|
|
|
|
"1.0 ('abc' & 0xFFAAFFAA)"
|
|
|
|
^ Sniffer pattern error: pattern and mask lengths do not match
|
|
|
|
</code>
|
|
|
|
*/
|
2002-08-06 12:25:41 +04:00
|
|
|
class Err {
|
|
|
|
public:
|
|
|
|
Err(const char *msg, const ssize_t pos);
|
|
|
|
Err(const std::string &msg, const ssize_t pos);
|
|
|
|
Err(const Err &ref);
|
|
|
|
virtual ~Err();
|
|
|
|
Err& operator=(const Err &ref);
|
|
|
|
|
|
|
|
status_t SetTo(const char *msg, const ssize_t pos);
|
|
|
|
status_t SetTo(const std::string &msg, const ssize_t pos);
|
|
|
|
void Unset();
|
|
|
|
|
2002-08-08 11:20:47 +04:00
|
|
|
void SetMsg(const char *msg);
|
|
|
|
void SetPos(ssize_t pos);
|
|
|
|
|
2002-08-06 12:25:41 +04:00
|
|
|
const char* Msg() const;
|
|
|
|
ssize_t Pos() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
char *fMsg;
|
|
|
|
ssize_t fPos;
|
|
|
|
};
|
|
|
|
|
2002-08-12 12:42:01 +04:00
|
|
|
}; // namespace Sniffer
|
|
|
|
}; // namespace Storage
|
|
|
|
}; // namespace BPrivate
|
|
|
|
|
|
|
|
#endif // _SNIFFER_ERR_H
|
|
|
|
|
2002-08-06 12:25:41 +04:00
|
|
|
|