Annotation of parser3/src/include/pa_exception.h, revision 1.62
1.10 paf 1: /** @file
1.11 paf 2: Parser: exception decls.
3:
1.62 ! moko 4: Copyright (c) 2001-2012 Art. Lebedev Studio (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.62 ! moko 11: #define IDENT_PA_EXCEPTION_H "$Id: 2012-03-08 21:17:57 $"
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.53 misha 15: const char* const PCRE_EXCEPTION_TYPE = "pcre.execute";
1.54 misha 16: const char* const DATE_RANGE_EXCEPTION_TYPE = "date.range";
1.61 misha 17: const char* const BASE64_FORMAT = "base64.format";
1.1 paf 18:
1.48 misha 19: const char* const NAME_MUST_BE_STRING = "name must be string";
20: const char* const FILE_NAME_MUST_BE_STRING = "file name 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:
1.60 misha 25: const char* const FILE_NAME_MUST_BE_SPECIFIED = "file name must be specified";
1.48 misha 26: const char* const FILE_NAME_MUST_NOT_BE_CODE = "file name must not be code";
27: const char* const COORDINATES_MUST_NOT_BE_CODE = "coordinates must not be code";
1.51 misha 28: const char* const FIRST_ARG_MUST_NOT_BE_CODE = "first argument must not be code";
29: const char* const PARAM_MUST_NOT_BE_CODE = "param must not be code";
1.59 misha 30: const char* const PARAM_MUST_BE_HASH = "param must be hash";
1.51 misha 31: const char* const MODE_MUST_NOT_BE_CODE = "mode must not be code";
1.55 misha 32: const char* const OPTIONS_MUST_NOT_BE_CODE = "options must not be code";
1.57 misha 33: const char* const OPTIONS_MUST_BE_HASH_NOT_CODE = "options must be hash, not code";
34: const char* const OPTIONS_MUST_BE_HASH = "options must be hash";
1.48 misha 35:
1.57 misha 36: const char* const CALLED_WITH_INVALID_OPTION = "called with invalid option";
1.56 misha 37:
1.39 paf 38: // includes
1.14 parser 39:
1.39 paf 40: #include "pa_memory.h"
41:
42: // forwards
43:
44: class String;
1.14 parser 45:
1.22 paf 46: // defines
47:
1.1 paf 48: class Exception {
49: public:
50:
1.19 paf 51: Exception();
1.15 parser 52: Exception(
1.39 paf 53: const char* atype,
54: const String* aproblem_source,
55: const char* comment_fmt, ...);
1.22 paf 56: Exception(const Exception& src);
1.44 paf 57: operator bool() { return ftype || fproblem_source || fcomment; }
1.22 paf 58: Exception& operator =(const Exception& src);
1.1 paf 59:
1.10 paf 60: /// extracts exception type
1.39 paf 61: const char* type(bool can_be_empty=false) const {
1.35 paf 62: if(can_be_empty)
63: return ftype;
64: else
65: return ftype?ftype:"<no type>";
66: }
1.10 paf 67: /// extracts exception problem_source
1.39 paf 68: const String* problem_source() const;
1.10 paf 69: /// extracts exception comment
1.39 paf 70: const char* comment(bool can_be_empty=false) const {
71: const char* result=fcomment && *fcomment?fcomment:0;
1.35 paf 72: if(can_be_empty)
73: return result;
74: else
75: return result?result:"<no comment>";
76: }
1.1 paf 77:
1.40 paf 78: protected:
1.1 paf 79:
1.39 paf 80: const char* ftype;
81: const String* fproblem_source;
82: char* fcomment;
1.15 parser 83:
1.1 paf 84: };
85:
86: #endif
E-mail: