Annotation of parser3/src/include/pa_exception.h, revision 1.50

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

E-mail: