]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/TextException.h
1 #ifndef SQUID__TEXTEXCEPTION_H
2 #define SQUID__TEXTEXCEPTION_H
4 // Origin: xstd/TextException
9 // simple exception to report custom errors
10 // we may want to change the interface to be able to report system errors
12 class TextException
: public std::exception
17 TextException(const char *aMessage
, const char *aFileName
= 0, int aLineNo
= -1);
18 TextException(const TextException
& right
);
19 virtual ~TextException() throw();
21 virtual const char *what() const throw();
23 TextException
& operator=(const TextException
&right
);
26 char *message
; // read-only
29 // optional location information
30 const char *theFileName
;
35 //ostream &operator <<(ostream &os, const TextException &exx) {
36 // return exx.print(os);
39 #if !defined(TexcHere)
40 # define TexcHere(msg) TextException((msg), __FILE__, __LINE__)
43 extern void Throw(const char *message
, const char *fileName
, int lineNo
);
45 // Must(condition) is like assert(condition) but throws an exception instead
47 # define Must(cond) ((cond) ? \
49 (void)Throw(#cond, __FILE__, __LINE__))
52 #endif /* SQUID__TEXTEXCEPTION_H */