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