Annotation of parser3/src/include/pa_exception.h, revision 1.38.2.8
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.8! paf 11: static const char* IDENT_EXCEPTION_H="$Date: 2003/01/28 12:11:49 $";
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.8! paf 20: static const char *undefined_type;
1.38.2.5 paf 21: static const ConstStringPtr undefined_source;
1.38.2.2 paf 22:
1.19 paf 23: Exception();
1.15 parser 24: Exception(
1.33 paf 25: const char *atype,
1.38.2.3 paf 26: ConstStringPtr aproblem_source,
1.15 parser 27: const char *comment_fmt, ...);
1.38.2.1 paf 28: Exception(const Exception& src):
29: ftype(src.ftype),
30: fproblem_source(src.fproblem_source),
31: fcomment(src.fcomment) {
32: }
33: Exception& operator =(const Exception& src) {
34: ftype=src.ftype;
35: fproblem_source=src.fproblem_source;
36: fcomment=src.fcomment;
37: return *this;
38: }
1.14 parser 39:
40: #ifdef XML
1.28 paf 41: Exception(
1.38.2.6 paf 42: ConstStringPtr aproblem_source,
1.28 paf 43: GdomeException& exc);
1.14 parser 44: #endif
1.1 paf 45:
1.10 paf 46: /// extracts exception type
1.35 paf 47: const char *type(bool can_be_empty=false) const {
48: if(can_be_empty)
49: return ftype;
50: else
51: return ftype?ftype:"<no type>";
52: }
1.10 paf 53: /// extracts exception problem_source
1.38.2.3 paf 54: ConstStringPtr problem_source() const; /// extracts exception comment
1.35 paf 55: const char *comment(bool can_be_empty=false) const {
1.38.2.3 paf 56: const char *result=fcomment.get()!=0 && *fcomment.get()?fcomment.get():0;
1.35 paf 57: if(can_be_empty)
58: return result;
59: else
60: return result?result:"<no comment>";
61: }
1.1 paf 62:
63: private:
64:
1.33 paf 65: const char *ftype;
1.38.2.3 paf 66: ConstStringPtr fproblem_source;
1.38.2.4 paf 67: CharPtr fcomment;
1.15 parser 68:
1.1 paf 69: };
1.38.2.5 paf 70:
1.38.2.8! paf 71: const char *undefined_type=0;
1.38.2.5 paf 72: const ConstStringPtr Exception::undefined_source(0);
1.1 paf 73:
74: #endif
E-mail: