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

1.10      paf         1: /** @file
1.11      paf         2:        Parser: exception decls.
                      3: 
1.39      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.42    ! paf        11: static const char * const IDENT_EXCEPTION_H="$Date: 2003/11/06 08:48:59 $";
1.1       paf        12: 
1.39      paf        13: // includes
1.14      parser     14: 
1.39      paf        15: #include "pa_memory.h"
                     16: 
                     17: // forwards
                     18: 
                     19: class String;
1.14      parser     20: 
1.22      paf        21: // defines
                     22: 
1.1       paf        23: class Exception {
                     24: public:
                     25: 
1.19      paf        26:        Exception();
1.15      parser     27:        Exception(
1.39      paf        28:                const char* atype,
                     29:                const String* aproblem_source, 
                     30:                const char* comment_fmt, ...);
1.22      paf        31:        Exception(const Exception& src);
                     32:        Exception& operator =(const Exception& src);
1.1       paf        33: 
1.10      paf        34:        /// extracts exception type
1.39      paf        35:        const char* type(bool can_be_empty=false) const { 
1.35      paf        36:                if(can_be_empty)
                     37:                        return ftype; 
                     38:                else
                     39:                        return ftype?ftype:"<no type>";
                     40:        }
1.10      paf        41:        /// extracts exception problem_source
1.39      paf        42:        const String* problem_source() const;
1.10      paf        43:        /// extracts exception comment
1.39      paf        44:        const char* comment(bool can_be_empty=false) const { 
                     45:                const char* result=fcomment && *fcomment?fcomment:0;
1.35      paf        46:                if(can_be_empty)
                     47:                        return result; 
                     48:                else
                     49:                        return result?result:"<no comment>";
                     50:        }
1.1       paf        51: 
1.40      paf        52: protected:
1.1       paf        53: 
1.39      paf        54:        const char* ftype;
                     55:        const String* fproblem_source;
                     56:        char* fcomment;
1.15      parser     57: 
1.1       paf        58: };
                     59: 
                     60: #endif

E-mail: