Annotation of parser3/src/include/pa_exception.h, revision 1.52
1.10 paf 1: /** @file
1.11 paf 2: Parser: exception decls.
3:
1.45 paf 4: Copyright (c) 2001-2005 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.52 ! misha 11: static const char * const IDENT_EXCEPTION_H="$Date: 2007/11/14 09:44:06 $";
1.46 misha 12:
1.47 misha 13: const char* const PARSER_RUNTIME = "parser.runtime";
1.52 ! misha 14: const char* const IMAGE_FORMAT = "image.format";
1.1 paf 15:
1.48 misha 16: const char* const NAME_MUST_BE_STRING = "name must be string";
17: const char* const FILE_NAME_MUST_BE_STRING = "file name must be string";
18: const char* const NAMESPACEURI_MUST_BE_STRING = "namespaceURI must be string";
1.49 misha 19: const char* const DATA_MUST_BE_STRING = "data must be string";
1.48 misha 20: const char* const LOCALNAME_MUST_BE_STRING = "localName must be string";
21: const char* const VALUE_MUST_BE_STRING = "value must be string";
1.49 misha 22: const char* const PARAMETER_MUST_BE_STRING = "parameter must be string";
1.50 misha 23: const char* const COLUMN_NAME_MUST_BE_STRING = "column name must be string";
1.48 misha 24:
25: const char* const FILE_NAME_MUST_NOT_BE_CODE = "file name must not be code";
26: const char* const COORDINATES_MUST_NOT_BE_CODE = "coordinates must not be code";
1.51 misha 27: const char* const FIRST_ARG_MUST_NOT_BE_CODE = "first argument must not be code";
28: const char* const PARAM_MUST_NOT_BE_CODE = "param must not be code";
29: const char* const MODE_MUST_NOT_BE_CODE = "mode must not be code";
1.48 misha 30:
1.39 paf 31: // includes
1.14 parser 32:
1.39 paf 33: #include "pa_memory.h"
34:
35: // forwards
36:
37: class String;
1.14 parser 38:
1.22 paf 39: // defines
40:
1.1 paf 41: class Exception {
42: public:
43:
1.19 paf 44: Exception();
1.15 parser 45: Exception(
1.39 paf 46: const char* atype,
47: const String* aproblem_source,
48: const char* comment_fmt, ...);
1.22 paf 49: Exception(const Exception& src);
1.44 paf 50: operator bool() { return ftype || fproblem_source || fcomment; }
1.22 paf 51: Exception& operator =(const Exception& src);
1.1 paf 52:
1.10 paf 53: /// extracts exception type
1.39 paf 54: const char* type(bool can_be_empty=false) const {
1.35 paf 55: if(can_be_empty)
56: return ftype;
57: else
58: return ftype?ftype:"<no type>";
59: }
1.10 paf 60: /// extracts exception problem_source
1.39 paf 61: const String* problem_source() const;
1.10 paf 62: /// extracts exception comment
1.39 paf 63: const char* comment(bool can_be_empty=false) const {
64: const char* result=fcomment && *fcomment?fcomment:0;
1.35 paf 65: if(can_be_empty)
66: return result;
67: else
68: return result?result:"<no comment>";
69: }
1.1 paf 70:
1.40 paf 71: protected:
1.1 paf 72:
1.39 paf 73: const char* ftype;
74: const String* fproblem_source;
75: char* fcomment;
1.15 parser 76:
1.1 paf 77: };
78:
79: #endif
E-mail: