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

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

E-mail: