]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ICAP/TextException.h
Adding ICAP library files
[thirdparty/squid.git] / src / ICAP / TextException.h
CommitLineData
774c051c 1#ifndef SQUID__TEXTEXCEPTION_H
2#define SQUID__TEXTEXCEPTION_H
3
4// Origin: xstd/TextException
5
6
7// simple exception to report custom errors
8// we may want to change the interface to be able to report system errors
9
10class TextException
11{
12
13public:
14 TextException(const char *aMessage, const char *aFileName = 0, int aLineNo = -1);
15 ~TextException();
16
17 // ostream &print(ostream &os) const;
18
19public:
20 char *message; // read-only
21
22protected:
23 // optional location information
24 const char *theFileName;
25 int theLineNo;
26};
27
28//inline
29//ostream &operator <<(ostream &os, const TextException &exx) {
30// return exx.print(os);
31//}
32
33#if !defined(TexcHere)
34# define TexcHere(msg) TextException((msg), __FILE__, __LINE__)
35#endif
36
37extern void Throw(const char *message, const char *fileName, int lineNo);
38
39// Must(condition) is like assert(condition) but throws an exception instead
40#if !defined(Must)
41# define Must(cond) ((cond) ? \
42 (void)0 : \
43 (void)Throw(#cond, __FILE__, __LINE__))
44#endif
45
46#endif /* SQUID__TEXTEXCEPTION_H */