Files
haiku-beta6/headers/private/storage/sniffer/Err.h
T

59 lines
1.4 KiB
C++
Raw Normal View History

2002-08-06 08:25:41 +00:00
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*!
\file sniffer/Err.h
Mime Sniffer Error class declarations
*/
2002-08-12 07:24:02 +00:00
#ifndef _SNIFFER_ERR_H
#define _SNIFFER_ERR_H
2002-08-06 08:25:41 +00:00
#include <SupportDefs.h>
#include <string>
namespace BPrivate {
namespace Storage {
2002-08-06 08:25:41 +00:00
namespace Sniffer {
//! Exception class used by the MIME Sniffer
2002-08-08 07:20:47 +00: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 08:25:41 +00: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 07:20:47 +00:00
void SetMsg(const char *msg);
void SetPos(ssize_t pos);
2002-08-06 08:25:41 +00:00
const char* Msg() const;
ssize_t Pos() const;
private:
char *fMsg;
ssize_t fPos;
};
}; // namespace Sniffer
}; // namespace Storage
}; // namespace BPrivate
#endif // _SNIFFER_ERR_H
2002-08-06 08:25:41 +00:00