Annotation of parser3/src/include/pa_exception.h, revision 1.38.2.7
1.10 paf 1: /** @file
1.11 paf 2: Parser: exception decls.
3:
1.38 paf 4: Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com)
1.31 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6: */
7:
8: #ifndef PA_EXCEPTION_H
9: #define PA_EXCEPTION_H
1.36 paf 10:
1.38.2.7! paf 11: static const char* IDENT_EXCEPTION_H="$Date: 2003/01/27 17:17:06 $";
1.1 paf 12:
1.38.2.7! paf 13: #include "pa_string.h"
1.14 parser 14:
1.22 paf 15: // defines
16:
1.1 paf 17: class Exception {
18: public:
19:
1.38.2.5 paf 20: static const ConstStringPtr undefined_source;
1.38.2.2 paf 21:
1.19 paf 22: Exception();
1.15 parser 23: Exception(
1.33 paf 24: const char *atype,
1.38.2.3 paf 25: ConstStringPtr aproblem_source,
1.15 parser 26: const char *comment_fmt, ...);
1.38.2.1 paf 27: Exception(const Exception& src):
28: ftype(src.ftype),
29: fproblem_source(src.fproblem_source),
30: fcomment(src.fcomment) {
31: }
32: Exception& operator =(const Exception& src) {
33: ftype=src.ftype;
34: fproblem_source=src.fproblem_source;
35: fcomment=src.fcomment;
36: return *this;
37: }
1.14 parser 38:
39: #ifdef XML
1.28 paf 40: Exception(
1.38.2.6 paf 41: ConstStringPtr aproblem_source,
1.28 paf 42: GdomeException& exc);
1.14 parser 43: #endif
1.1 paf 44:
1.10 paf 45: /// extracts exception type
1.35 paf 46: const char *type(bool can_be_empty=false) const {
47: if(can_be_empty)
48: return ftype;
49: else
50: return ftype?ftype:"<no type>";
51: }
1.10 paf 52: /// extracts exception problem_source
1.38.2.3 paf 53: ConstStringPtr problem_source() const; /// extracts exception comment
1.35 paf 54: const char *comment(bool can_be_empty=false) const {
1.38.2.3 paf 55: const char *result=fcomment.get()!=0 && *fcomment.get()?fcomment.get():0;
1.35 paf 56: if(can_be_empty)
57: return result;
58: else
59: return result?result:"<no comment>";
60: }
1.1 paf 61:
62: private:
63:
1.33 paf 64: const char *ftype;
1.38.2.3 paf 65: ConstStringPtr fproblem_source;
1.38.2.4 paf 66: CharPtr fcomment;
1.15 parser 67:
1.1 paf 68: };
1.38.2.5 paf 69:
70: const ConstStringPtr Exception::undefined_source(0);
1.1 paf 71:
72: #endif
E-mail: