Annotation of parser3/src/include/pa_exception.h, revision 1.37
1.10 paf 1: /** @file
1.11 paf 2: Parser: exception decls.
3:
1.30 paf 4: Copyright (c) 2001, 2002 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.37 ! paf 11: static const char* IDENT_EXCEPTION_H="$Date: pa_exception.h,v 1.36 2002/08/01 11:26:47 paf Exp $";
1.1 paf 12:
13: #include "pa_types.h"
14: #include "pa_string.h"
1.14 parser 15:
16: class Pool;
17:
1.22 paf 18: // defines
19:
1.1 paf 20: class Exception {
21: public:
22:
1.19 paf 23: Exception();
1.15 parser 24: Exception(
1.33 paf 25: const char *atype,
1.1 paf 26: const String *aproblem_source,
1.15 parser 27: const char *comment_fmt, ...);
1.22 paf 28: Exception(const Exception& src);
29: Exception& operator =(const Exception& src);
30: ~Exception();
1.14 parser 31:
32: #ifdef XML
1.28 paf 33: Exception(
34: const String *aproblem_source,
35: GdomeException& exc);
1.14 parser 36: #endif
1.1 paf 37:
1.10 paf 38: /// extracts exception type
1.35 paf 39: const char *type(bool can_be_empty=false) const {
40: if(can_be_empty)
41: return ftype;
42: else
43: return ftype?ftype:"<no type>";
44: }
1.10 paf 45: /// extracts exception problem_source
1.34 paf 46: const String *problem_source() const {
47: return fproblem_source && fproblem_source->size()?fproblem_source:0;
48: }
1.10 paf 49: /// extracts exception comment
1.35 paf 50: const char *comment(bool can_be_empty=false) const {
51: const char *result=fcomment && *fcomment?fcomment:0;
52: if(can_be_empty)
53: return result;
54: else
55: return result?result:"<no comment>";
56: }
1.1 paf 57:
58: private:
59:
1.33 paf 60: const char *ftype;
61: const String *fproblem_source;
62: bool owns_comment; char *fcomment;
1.15 parser 63:
1.1 paf 64: };
65:
66: #endif
E-mail: